From 82597911d8508bbec995d28040ffc8f22c895ddd Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Sun, 22 Dec 2024 19:34:48 -0800 Subject: [PATCH] [AutoRelease] t2-cosmosdb-2024-12-02-73672(can only be merged by SDK owner) (#38739) * code and test * update testcases * update format * Update release date in CHANGELOG.md --------- Co-authored-by: azure-sdk Co-authored-by: ChenxiJiang333 Co-authored-by: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> --- sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md | 43 + sdk/cosmos/azure-mgmt-cosmosdb/_meta.json | 6 +- .../azure/mgmt/cosmosdb/__init__.py | 12 +- .../azure/mgmt/cosmosdb/_configuration.py | 11 +- .../cosmosdb/_cosmos_db_management_client.py | 57 +- .../azure/mgmt/cosmosdb/_serialization.py | 424 +- .../azure/mgmt/cosmosdb/_version.py | 2 +- .../azure/mgmt/cosmosdb/aio/__init__.py | 12 +- .../azure/mgmt/cosmosdb/aio/_configuration.py | 11 +- .../aio/_cosmos_db_management_client.py | 57 +- .../mgmt/cosmosdb/aio/operations/__init__.py | 100 +- .../_cassandra_clusters_operations.py | 531 +- .../_cassandra_data_centers_operations.py | 15 +- .../_cassandra_resources_operations.py | 1092 +- .../aio/operations/_chaos_fault_operations.py | 413 + .../aio/operations/_collection_operations.py | 11 +- .../_collection_partition_operations.py | 9 +- ..._collection_partition_region_operations.py | 7 +- .../_collection_region_operations.py | 7 +- .../_data_transfer_jobs_operations.py | 589 + .../_database_account_region_operations.py | 7 +- .../_database_accounts_operations.py | 46 +- .../aio/operations/_database_operations.py | 11 +- .../operations/_graph_resources_operations.py | 543 + .../_gremlin_resources_operations.py | 40 +- .../aio/operations/_locations_operations.py | 9 +- .../_mongo_db_resources_operations.py | 1684 ++- ...ity_perimeter_configurations_operations.py | 340 + .../_notebook_workspaces_operations.py | 33 +- .../cosmosdb/aio/operations/_operations.py | 7 +- .../_partition_key_range_id_operations.py | 7 +- ...artition_key_range_id_region_operations.py | 7 +- .../aio/operations/_percentile_operations.py | 7 +- .../_percentile_source_target_operations.py | 7 +- .../_percentile_target_operations.py | 7 +- ...private_endpoint_connections_operations.py | 17 +- .../_private_link_resources_operations.py | 9 +- ...restorable_database_accounts_operations.py | 11 +- ...restorable_gremlin_databases_operations.py | 7 +- .../_restorable_gremlin_graphs_operations.py | 7 +- ...restorable_gremlin_resources_operations.py | 7 +- ...storable_mongodb_collections_operations.py | 7 +- ...restorable_mongodb_databases_operations.py | 7 +- ...restorable_mongodb_resources_operations.py | 7 +- .../_restorable_sql_containers_operations.py | 7 +- .../_restorable_sql_databases_operations.py | 7 +- .../_restorable_sql_resources_operations.py | 7 +- .../_restorable_table_resources_operations.py | 7 +- .../_restorable_tables_operations.py | 7 +- .../aio/operations/_service_operations.py | 22 +- .../operations/_sql_resources_operations.py | 2442 +++- .../operations/_table_resources_operations.py | 1004 +- .../_throughput_pool_account_operations.py | 459 + .../_throughput_pool_accounts_operations.py | 141 + .../operations/_throughput_pool_operations.py | 639 ++ .../_throughput_pools_operations.py | 215 + .../azure/mgmt/cosmosdb/models/__init__.py | 851 +- .../_cosmos_db_management_client_enums.py | 173 +- .../azure/mgmt/cosmosdb/models/_models_py3.py | 9960 +++++++++++------ .../mgmt/cosmosdb/operations/__init__.py | 100 +- .../_cassandra_clusters_operations.py | 760 +- .../_cassandra_data_centers_operations.py | 35 +- .../_cassandra_resources_operations.py | 1437 ++- .../operations/_chaos_fault_operations.py | 523 + .../operations/_collection_operations.py | 23 +- .../_collection_partition_operations.py | 17 +- ..._collection_partition_region_operations.py | 11 +- .../_collection_region_operations.py | 11 +- .../_data_transfer_jobs_operations.py | 836 ++ .../_database_account_region_operations.py | 11 +- .../_database_accounts_operations.py | 116 +- .../operations/_database_operations.py | 23 +- .../operations/_graph_resources_operations.py | 679 ++ .../_gremlin_resources_operations.py | 108 +- .../operations/_locations_operations.py | 17 +- .../_mongo_db_resources_operations.py | 2062 +++- ...ity_perimeter_configurations_operations.py | 461 + .../_notebook_workspaces_operations.py | 62 +- .../mgmt/cosmosdb/operations/_operations.py | 9 +- .../_partition_key_range_id_operations.py | 11 +- ...artition_key_range_id_region_operations.py | 11 +- .../operations/_percentile_operations.py | 11 +- .../_percentile_source_target_operations.py | 11 +- .../_percentile_target_operations.py | 11 +- ...private_endpoint_connections_operations.py | 33 +- .../_private_link_resources_operations.py | 17 +- ...restorable_database_accounts_operations.py | 23 +- ...restorable_gremlin_databases_operations.py | 11 +- .../_restorable_gremlin_graphs_operations.py | 11 +- ...restorable_gremlin_resources_operations.py | 11 +- ...storable_mongodb_collections_operations.py | 11 +- ...restorable_mongodb_databases_operations.py | 11 +- ...restorable_mongodb_resources_operations.py | 11 +- .../_restorable_sql_containers_operations.py | 11 +- .../_restorable_sql_databases_operations.py | 11 +- .../_restorable_sql_resources_operations.py | 11 +- .../_restorable_table_resources_operations.py | 11 +- .../_restorable_tables_operations.py | 11 +- .../operations/_service_operations.py | 38 +- .../operations/_sql_resources_operations.py | 2740 ++++- .../operations/_table_resources_operations.py | 1316 ++- .../_throughput_pool_account_operations.py | 616 + .../_throughput_pool_accounts_operations.py | 183 + .../operations/_throughput_pool_operations.py | 795 ++ .../_throughput_pools_operations.py | 270 + .../chaos_fault_enable_disable.py | 51 + .../generated_samples/chaos_fault_get.py | 43 + .../generated_samples/chaos_fault_list.py | 43 + ...mos_db_cassandra_keyspace_create_update.py | 2 +- .../cosmos_db_cassandra_keyspace_delete.py | 2 +- .../cosmos_db_cassandra_keyspace_get.py | 2 +- .../cosmos_db_cassandra_keyspace_list.py | 2 +- ...cassandra_keyspace_migrate_to_autoscale.py | 2 +- ...a_keyspace_migrate_to_manual_throughput.py | 2 +- ...os_db_cassandra_keyspace_throughput_get.py | 2 +- ...db_cassandra_keyspace_throughput_update.py | 2 +- ...cosmos_db_cassandra_table_create_update.py | 3 +- .../cosmos_db_cassandra_table_delete.py | 2 +- .../cosmos_db_cassandra_table_get.py | 2 +- .../cosmos_db_cassandra_table_list.py | 2 +- ...db_cassandra_table_migrate_to_autoscale.py | 2 +- ...ndra_table_migrate_to_manual_throughput.py | 2 +- ...osmos_db_cassandra_table_throughput_get.py | 2 +- ...os_db_cassandra_table_throughput_update.py | 2 +- .../cosmos_db_cassandra_view_create_update.py | 54 + .../cosmos_db_cassandra_view_delete.py | 43 + .../cosmos_db_cassandra_view_get.py | 44 + .../cosmos_db_cassandra_view_list.py | 44 + ..._db_cassandra_view_migrate_to_autoscale.py | 44 + ...andra_view_migrate_to_manual_throughput.py | 44 + ...cosmos_db_cassandra_view_throughput_get.py | 44 + ...mos_db_cassandra_view_throughput_update.py | 45 + ...os_db_collection_get_metric_definitions.py | 2 +- .../cosmos_db_collection_get_metrics.py | 2 +- .../cosmos_db_collection_get_usages.py | 2 +- ...mos_db_collection_partition_get_metrics.py | 2 +- ...smos_db_collection_partition_get_usages.py | 2 +- ...collection_partition_region_get_metrics.py | 2 +- .../cosmos_db_data_transfer_service_create.py | 2 +- .../cosmos_db_data_transfer_service_delete.py | 2 +- .../cosmos_db_data_transfer_service_get.py | 2 +- ...s_db_database_account_check_name_exists.py | 2 +- .../cosmos_db_database_account_create_max.py | 6 +- .../cosmos_db_database_account_create_min.py | 2 +- .../cosmos_db_database_account_delete.py | 2 +- ...tabase_account_failover_priority_change.py | 2 +- .../cosmos_db_database_account_get.py | 2 +- ...database_account_get_metric_definitions.py | 2 +- .../cosmos_db_database_account_get_metrics.py | 2 +- .../cosmos_db_database_account_get_usages.py | 2 +- .../cosmos_db_database_account_list.py | 2 +- ...database_account_list_by_resource_group.py | 2 +- ...atabase_account_list_connection_strings.py | 2 +- ...e_account_list_connection_strings_mongo.py | 2 +- .../cosmos_db_database_account_list_keys.py | 2 +- ...db_database_account_list_read_only_keys.py | 4 +- ...smos_db_database_account_offline_region.py | 2 +- ...osmos_db_database_account_online_region.py | 2 +- .../cosmos_db_database_account_patch.py | 8 +- ...smos_db_database_account_regenerate_key.py | 2 +- ..._db_database_account_region_get_metrics.py | 2 +- ...smos_db_database_get_metric_definitions.py | 2 +- .../cosmos_db_database_get_metrics.py | 2 +- .../cosmos_db_database_get_usages.py | 2 +- ...mos_db_graph_api_compute_service_create.py | 2 +- ...mos_db_graph_api_compute_service_delete.py | 2 +- ...cosmos_db_graph_api_compute_service_get.py | 2 +- .../cosmos_db_graph_resource_create_update.py | 48 + .../cosmos_db_graph_resource_delete.py | 42 + .../cosmos_db_graph_resource_get.py | 43 + .../cosmos_db_graph_resource_list.py | 43 + ...osmos_db_gremlin_database_create_update.py | 2 +- .../cosmos_db_gremlin_database_delete.py | 2 +- .../cosmos_db_gremlin_database_get.py | 2 +- .../cosmos_db_gremlin_database_list.py | 2 +- ...b_gremlin_database_migrate_to_autoscale.py | 2 +- ...n_database_migrate_to_manual_throughput.py | 2 +- ...smos_db_gremlin_database_throughput_get.py | 2 +- ...s_db_gremlin_database_throughput_update.py | 2 +- ...mos_db_gremlin_graph_backup_information.py | 2 +- .../cosmos_db_gremlin_graph_create_update.py | 2 +- .../cosmos_db_gremlin_graph_delete.py | 2 +- .../cosmos_db_gremlin_graph_get.py | 2 +- .../cosmos_db_gremlin_graph_list.py | 2 +- ...s_db_gremlin_graph_migrate_to_autoscale.py | 2 +- ...mlin_graph_migrate_to_manual_throughput.py | 2 +- .../cosmos_db_gremlin_graph_throughput_get.py | 2 +- ...smos_db_gremlin_graph_throughput_update.py | 2 +- .../cosmos_db_location_get.py | 2 +- .../cosmos_db_location_list.py | 2 +- .../cosmos_db_managed_cassandra_backup.py | 43 + ...osmos_db_managed_cassandra_backups_list.py | 43 + ...mos_db_managed_cassandra_cluster_create.py | 4 +- ...db_managed_cassandra_cluster_deallocate.py | 4 +- ...mos_db_managed_cassandra_cluster_delete.py | 2 +- ...cosmos_db_managed_cassandra_cluster_get.py | 2 +- ...assandra_cluster_list_by_resource_group.py | 2 +- ..._cassandra_cluster_list_by_subscription.py | 2 +- ...smos_db_managed_cassandra_cluster_patch.py | 2 +- ...smos_db_managed_cassandra_cluster_start.py | 4 +- .../cosmos_db_managed_cassandra_command.py | 6 +- ...smos_db_managed_cassandra_command_async.py | 43 + ...mos_db_managed_cassandra_command_result.py | 43 + ...db_managed_cassandra_data_center_create.py | 2 +- ...db_managed_cassandra_data_center_delete.py | 2 +- ...os_db_managed_cassandra_data_center_get.py | 2 +- ...s_db_managed_cassandra_data_center_list.py | 2 +- ..._db_managed_cassandra_data_center_patch.py | 2 +- ...osmos_db_managed_cassandra_list_command.py | 43 + .../cosmos_db_managed_cassandra_status.py | 4 +- ...terialized_views_builder_service_create.py | 2 +- ...terialized_views_builder_service_delete.py | 2 +- ..._materialized_views_builder_service_get.py | 2 +- ..._mongo_db_collection_backup_information.py | 2 +- .../cosmos_db_mongo_db_collection_delete.py | 2 +- .../cosmos_db_mongo_db_collection_get.py | 2 +- .../cosmos_db_mongo_db_collection_list.py | 2 +- ...ongo_db_collection_migrate_to_autoscale.py | 2 +- ...collection_migrate_to_manual_throughput.py | 2 +- ..._db_mongo_db_collection_partition_merge.py | 45 + ...o_db_collection_redistribute_throughput.py | 56 + ...ection_retrieve_throughput_distribution.py | 47 + ...s_db_mongo_db_collection_throughput_get.py | 2 +- ...b_mongo_db_collection_throughput_update.py | 2 +- .../cosmos_db_mongo_db_database_delete.py | 2 +- .../cosmos_db_mongo_db_database_get.py | 2 +- .../cosmos_db_mongo_db_database_list.py | 2 +- ..._mongo_db_database_migrate_to_autoscale.py | 2 +- ...b_database_migrate_to_manual_throughput.py | 2 +- ...os_db_mongo_db_database_partition_merge.py | 44 + ...ngo_db_database_redistribute_throughput.py | 55 + ...tabase_retrieve_throughput_distribution.py | 46 + ...mos_db_mongo_db_database_throughput_get.py | 2 +- ..._db_mongo_db_database_throughput_update.py | 2 +- ..._mongo_db_role_definition_create_update.py | 2 +- ...smos_db_mongo_db_role_definition_delete.py | 2 +- .../cosmos_db_mongo_db_role_definition_get.py | 2 +- ...cosmos_db_mongo_db_role_definition_list.py | 2 +- ..._mongo_db_user_definition_create_update.py | 2 +- ...smos_db_mongo_db_user_definition_delete.py | 2 +- .../cosmos_db_mongo_db_user_definition_get.py | 2 +- ...cosmos_db_mongo_db_user_definition_list.py | 2 +- .../cosmos_db_notebook_workspace_delete.py | 2 +- .../cosmos_db_notebook_workspace_get.py | 2 +- .../cosmos_db_notebook_workspace_list.py | 2 +- ...notebook_workspace_list_connection_info.py | 2 +- ...otebook_workspace_regenerate_auth_token.py | 2 +- .../cosmos_db_notebook_workspace_start.py | 2 +- .../cosmos_db_operations_list.py | 2 +- .../cosmos_db_percentile_get_metrics.py | 2 +- ...db_percentile_source_target_get_metrics.py | 2 +- ...cosmos_db_percentile_target_get_metrics.py | 2 +- ...s_db_private_endpoint_connection_delete.py | 2 +- ...smos_db_private_endpoint_connection_get.py | 2 +- ...db_private_endpoint_connection_list_get.py | 2 +- ...s_db_private_endpoint_connection_update.py | 2 +- .../cosmos_db_private_link_resource_get.py | 2 +- ...osmos_db_private_link_resource_list_get.py | 2 +- ...cosmos_db_region_collection_get_metrics.py | 2 +- ...smos_db_restorable_database_account_get.py | 2 +- ...mos_db_restorable_database_account_list.py | 2 +- ...rable_database_account_no_location_list.py | 2 +- ...mos_db_restorable_gremlin_database_list.py | 2 +- ...cosmos_db_restorable_gremlin_graph_list.py | 2 +- ...mos_db_restorable_gremlin_resource_list.py | 2 +- ...s_db_restorable_mongodb_collection_list.py | 2 +- ...mos_db_restorable_mongodb_database_list.py | 2 +- ...mos_db_restorable_mongodb_resource_list.py | 2 +- ...cosmos_db_restorable_sql_container_list.py | 2 +- .../cosmos_db_restorable_sql_database_list.py | 2 +- .../cosmos_db_restorable_sql_resource_list.py | 2 +- .../cosmos_db_restorable_table_list.py | 2 +- ...osmos_db_restorable_table_resource_list.py | 2 +- ..._restore_database_account_create_update.py | 4 +- .../cosmos_db_services_list.py | 2 +- ...sql_client_encryption_key_create_update.py | 4 +- ...cosmos_db_sql_client_encryption_key_get.py | 2 +- ...smos_db_sql_client_encryption_keys_list.py | 2 +- ...mos_db_sql_container_backup_information.py | 2 +- .../cosmos_db_sql_container_create_update.py | 2 +- .../cosmos_db_sql_container_delete.py | 2 +- .../cosmos_db_sql_container_get.py | 2 +- .../cosmos_db_sql_container_list.py | 2 +- ...s_db_sql_container_migrate_to_autoscale.py | 2 +- ..._container_migrate_to_manual_throughput.py | 2 +- ...cosmos_db_sql_container_partition_merge.py | 45 + ...b_sql_container_redistribute_throughput.py | 56 + .../cosmos_db_sql_container_restore.py | 60 + ...tainer_retrieve_throughput_distribution.py | 47 + .../cosmos_db_sql_container_throughput_get.py | 2 +- ...smos_db_sql_container_throughput_update.py | 2 +- .../cosmos_db_sql_database_create_update.py | 2 +- .../cosmos_db_sql_database_delete.py | 2 +- .../cosmos_db_sql_database_get.py | 2 +- .../cosmos_db_sql_database_list.py | 2 +- ...os_db_sql_database_migrate_to_autoscale.py | 2 +- ...l_database_migrate_to_manual_throughput.py | 2 +- .../cosmos_db_sql_database_partition_merge.py | 44 + ...db_sql_database_redistribute_throughput.py | 55 + .../cosmos_db_sql_database_restore.py | 59 + ...tabase_retrieve_throughput_distribution.py | 46 + .../cosmos_db_sql_database_throughput_get.py | 2 +- ...osmos_db_sql_database_throughput_update.py | 2 +- ..._db_sql_materialized_view_create_update.py | 73 + ...os_db_sql_role_assignment_create_update.py | 2 +- .../cosmos_db_sql_role_assignment_delete.py | 2 +- .../cosmos_db_sql_role_assignment_get.py | 2 +- .../cosmos_db_sql_role_assignment_list.py | 2 +- ...os_db_sql_role_definition_create_update.py | 2 +- .../cosmos_db_sql_role_definition_delete.py | 2 +- .../cosmos_db_sql_role_definition_get.py | 2 +- .../cosmos_db_sql_role_definition_list.py | 2 +- ...s_db_sql_stored_procedure_create_update.py | 2 +- .../cosmos_db_sql_stored_procedure_delete.py | 2 +- .../cosmos_db_sql_stored_procedure_get.py | 2 +- .../cosmos_db_sql_stored_procedure_list.py | 2 +- .../cosmos_db_sql_trigger_create_update.py | 2 +- .../cosmos_db_sql_trigger_delete.py | 2 +- .../cosmos_db_sql_trigger_get.py | 2 +- .../cosmos_db_sql_trigger_list.py | 2 +- ...sql_user_defined_function_create_update.py | 2 +- ...mos_db_sql_user_defined_function_delete.py | 2 +- ...cosmos_db_sql_user_defined_function_get.py | 2 +- ...osmos_db_sql_user_defined_function_list.py | 2 +- .../cosmos_db_table_backup_information.py | 2 +- .../cosmos_db_table_create_update.py | 2 +- .../cosmos_db_table_delete.py | 2 +- .../generated_samples/cosmos_db_table_get.py | 2 +- .../generated_samples/cosmos_db_table_list.py | 2 +- .../cosmos_db_table_migrate_to_autoscale.py | 2 +- ...s_db_table_migrate_to_manual_throughput.py | 2 +- .../cosmos_db_table_throughput_get.py | 2 +- .../cosmos_db_table_throughput_update.py | 2 +- .../cosmos_dbp_key_range_id_get_metrics.py | 2 +- ...mos_dbp_key_range_id_region_get_metrics.py | 2 +- .../cosmos_db_data_transfer_job_cancel.py | 43 + .../cosmos_db_data_transfer_job_complete.py | 43 + .../cosmos_db_data_transfer_job_create.py | 53 + .../cosmos_db_data_transfer_job_feed.py | 43 + .../cosmos_db_data_transfer_job_get.py | 43 + .../cosmos_db_data_transfer_job_pause.py | 43 + .../cosmos_db_data_transfer_job_resume.py | 43 + ...rk_security_perimeter_configuration_get.py | 43 + ...k_security_perimeter_configuration_list.py | 43 + ...urity_perimeter_configuration_reconcile.py | 42 + ...db_sql_dedicated_gateway_service_create.py | 2 +- ...db_sql_dedicated_gateway_service_delete.py | 2 +- ...os_db_sql_dedicated_gateway_service_get.py | 2 +- ..._db_table_role_assignment_create_update.py | 50 + .../cosmos_db_table_role_assignment_delete.py | 42 + .../cosmos_db_table_role_assignment_get.py | 43 + .../cosmos_db_table_role_assignment_list.py | 43 + ..._db_table_role_definition_create_update.py | 62 + .../cosmos_db_table_role_definition_delete.py | 42 + .../cosmos_db_table_role_definition_get.py | 43 + .../cosmos_db_table_role_definition_list.py | 43 + ...osmos_db_throughput_pool_account_create.py | 49 + ...osmos_db_throughput_pool_account_delete.py | 42 + .../cosmos_db_throughput_pool_account_get.py | 43 + ...cosmos_db_throughput_pool_accounts_list.py | 43 + .../cosmos_db_throughput_pool_create.py | 43 + .../cosmos_db_throughput_pool_delete.py | 41 + .../cosmos_db_throughput_pool_get.py | 42 + .../cosmos_db_throughput_pool_list.py | 42 + .../cosmos_db_throughput_pool_update.py | 42 + .../generated_tests/conftest.py | 2 +- ...anagement_cassandra_clusters_operations.py | 115 +- ...ent_cassandra_clusters_operations_async.py | 123 +- ...ement_cassandra_data_centers_operations.py | 20 +- ...cassandra_data_centers_operations_async.py | 20 +- ...nagement_cassandra_resources_operations.py | 242 +- ...nt_cassandra_resources_operations_async.py | 252 +- ...os_db_management_chaos_fault_operations.py | 12 +- ...management_chaos_fault_operations_async.py | 12 +- ...mos_db_management_collection_operations.py | 12 +- ..._management_collection_operations_async.py | 12 +- ...agement_collection_partition_operations.py | 8 +- ...t_collection_partition_operations_async.py | 8 +- ..._collection_partition_region_operations.py | 4 +- ...ction_partition_region_operations_async.py | 4 +- ...management_collection_region_operations.py | 4 +- ...ment_collection_region_operations_async.py | 4 +- ...anagement_data_transfer_jobs_operations.py | 28 +- ...ent_data_transfer_jobs_operations_async.py | 28 +- ...ment_database_account_region_operations.py | 4 +- ...atabase_account_region_operations_async.py | 4 +- ...management_database_accounts_operations.py | 83 +- ...ment_database_accounts_operations_async.py | 83 +- ...osmos_db_management_database_operations.py | 12 +- ...db_management_database_operations_async.py | 12 +- ...b_management_graph_resources_operations.py | 16 +- ...gement_graph_resources_operations_async.py | 16 +- ...management_gremlin_resources_operations.py | 94 +- ...ment_gremlin_resources_operations_async.py | 94 +- ...smos_db_management_locations_operations.py | 8 +- ...b_management_locations_operations_async.py | 8 +- ...anagement_mongo_db_resources_operations.py | 273 +- ...ent_mongo_db_resources_operations_async.py | 285 +- ...ity_perimeter_configurations_operations.py | 12 +- ...rimeter_configurations_operations_async.py | 12 +- ...nagement_notebook_workspaces_operations.py | 28 +- ...nt_notebook_workspaces_operations_async.py | 28 +- .../test_cosmos_db_management_operations.py | 4 +- ...t_cosmos_db_management_operations_async.py | 4 +- ...ement_partition_key_range_id_operations.py | 4 +- ...partition_key_range_id_operations_async.py | 4 +- ...artition_key_range_id_region_operations.py | 4 +- ...on_key_range_id_region_operations_async.py | 4 +- ...mos_db_management_percentile_operations.py | 4 +- ..._management_percentile_operations_async.py | 4 +- ...ent_percentile_source_target_operations.py | 4 +- ...rcentile_source_target_operations_async.py | 4 +- ...management_percentile_target_operations.py | 4 +- ...ment_percentile_target_operations_async.py | 4 +- ...private_endpoint_connections_operations.py | 24 +- ...e_endpoint_connections_operations_async.py | 24 +- ...ement_private_link_resources_operations.py | 8 +- ...private_link_resources_operations_async.py | 8 +- ...restorable_database_accounts_operations.py | 12 +- ...able_database_accounts_operations_async.py | 12 +- ...restorable_gremlin_databases_operations.py | 4 +- ...able_gremlin_databases_operations_async.py | 4 +- ...nt_restorable_gremlin_graphs_operations.py | 4 +- ...torable_gremlin_graphs_operations_async.py | 4 +- ...restorable_gremlin_resources_operations.py | 4 +- ...able_gremlin_resources_operations_async.py | 4 +- ...storable_mongodb_collections_operations.py | 4 +- ...le_mongodb_collections_operations_async.py | 4 +- ...restorable_mongodb_databases_operations.py | 4 +- ...able_mongodb_databases_operations_async.py | 4 +- ...restorable_mongodb_resources_operations.py | 4 +- ...able_mongodb_resources_operations_async.py | 4 +- ...nt_restorable_sql_containers_operations.py | 4 +- ...torable_sql_containers_operations_async.py | 4 +- ...ent_restorable_sql_databases_operations.py | 4 +- ...storable_sql_databases_operations_async.py | 4 +- ...ent_restorable_sql_resources_operations.py | 4 +- ...storable_sql_resources_operations_async.py | 4 +- ...t_restorable_table_resources_operations.py | 4 +- ...orable_table_resources_operations_async.py | 4 +- ...management_restorable_tables_operations.py | 4 +- ...ment_restorable_tables_operations_async.py | 4 +- ...cosmos_db_management_service_operations.py | 16 +- ..._db_management_service_operations_async.py | 16 +- ..._db_management_sql_resources_operations.py | 384 +- ...nagement_sql_resources_operations_async.py | 408 +- ...b_management_table_resources_operations.py | 184 +- ...gement_table_resources_operations_async.py | 192 +- ...ment_throughput_pool_account_operations.py | 12 +- ...hroughput_pool_account_operations_async.py | 12 +- ...ent_throughput_pool_accounts_operations.py | 4 +- ...roughput_pool_accounts_operations_async.py | 4 +- ...b_management_throughput_pool_operations.py | 16 +- ...gement_throughput_pool_operations_async.py | 16 +- ..._management_throughput_pools_operations.py | 8 +- ...ement_throughput_pools_operations_async.py | 8 +- .../azure-mgmt-cosmosdb/sdk_packaging.toml | 2 +- sdk/cosmos/azure-mgmt-cosmosdb/setup.py | 10 +- .../azure-mgmt-cosmosdb/tests/conftest.py | 2 +- ...assandra_clusters_operations_async_test.py | 36 + ...ment_cassandra_clusters_operations_test.py | 35 + ...agement_locations_operations_async_test.py | 27 + ...db_management_locations_operations_test.py | 26 + ...database_accounts_operations_async_test.py | 27 + ...rable_database_accounts_operations_test.py | 26 + ..._throughput_pools_operations_async_test.py | 36 + ...gement_throughput_pools_operations_test.py | 35 + 467 files changed, 35594 insertions(+), 7133 deletions(-) create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_chaos_fault_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_network_security_perimeter_configurations_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_account_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_accounts_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pools_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_chaos_fault_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_network_security_perimeter_configurations_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_account_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_accounts_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pools_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_enable_disable.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_create_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_result.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_list_command.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_partition_merge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_partition_merge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_materialized_view_create_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_cancel.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_complete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_feed.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_pause.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_resume.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_reconcile.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_create_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_create_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_accounts_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_update.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_async_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_async_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_async_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_async_test.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_test.py diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md index 38b7e657c472..41f5a326b8a0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md @@ -1,5 +1,48 @@ # Release History +## 10.0.0b5 (2024-12-23) + +### Features Added + + - Model `CommandPostBody` added property `readwrite` + - Model `ErrorResponse` added property `error` + - Model `ErrorResponseAutoGenerated` added property `code` + - Model `ErrorResponseAutoGenerated` added property `message` + - Model `IndexingPolicy` added property `vector_indexes` + - Model `RestorableSqlContainerPropertiesResourceContainer` added property `vector_embedding_policy` + - Model `SqlContainerGetPropertiesResource` added property `vector_embedding_policy` + - Model `SqlContainerResource` added property `vector_embedding_policy` + - Model `ThroughputSettingsGetPropertiesResource` added property `throughput_buckets` + - Model `ThroughputSettingsResource` added property `throughput_buckets` + - Added model `CommandAsyncPostBody` + - Added enum `DistanceFunction` + - Added model `PermissionAutoGenerated` + - Added model `TableRoleAssignmentListResult` + - Added model `TableRoleAssignmentResource` + - Added model `TableRoleDefinitionListResult` + - Added model `TableRoleDefinitionResource` + - Added model `ThroughputBucketResource` + - Added enum `VectorDataType` + - Added model `VectorEmbedding` + - Added model `VectorEmbeddingPolicy` + - Added model `VectorIndex` + - Added enum `VectorIndexType` + - Operation group `TableResourcesOperations` added method `begin_create_update_table_role_assignment` + - Operation group `TableResourcesOperations` added method `begin_create_update_table_role_definition` + - Operation group `TableResourcesOperations` added method `begin_delete_table_role_assignment` + - Operation group `TableResourcesOperations` added method `begin_delete_table_role_definition` + - Operation group `TableResourcesOperations` added method `get_table_role_assignment` + - Operation group `TableResourcesOperations` added method `get_table_role_definition` + - Operation group `TableResourcesOperations` added method `list_table_role_assignments` + - Operation group `TableResourcesOperations` added method `list_table_role_definitions` + +### Breaking Changes + + - Model `CommandPostBody` deleted or renamed its instance variable `read_write` + - Model `ErrorResponse` deleted or renamed its instance variable `code` + - Model `ErrorResponse` deleted or renamed its instance variable `message` + - Model `ErrorResponseAutoGenerated` deleted or renamed its instance variable `error` + ## 9.7.0 (2024-11-18) ### Features Added diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json index 590f97a36455..334ec5daeaa6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json +++ b/sdk/cosmos/azure-mgmt-cosmosdb/_meta.json @@ -1,11 +1,11 @@ { - "commit": "00d50cba07376c494f3b50647b847cd4ba348a04", + "commit": "4aad50a36767f7c36673f2c7982bb4055dbf5ed4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.26.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "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 2ffb9868aed3..16e98aef3eab 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cosmos_db_management_client import CosmosDBManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "CosmosDBManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _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 5296303fdec7..70669f246f16 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for CosmosDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -26,15 +25,15 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-11-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-11-15") + api_version: str = kwargs.pop("api_version", "2024-12-01-preview") 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 06c53aa6016b..00dac0e6125b 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 @@ -22,16 +22,20 @@ CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, + ChaosFaultOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, + DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, + GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, + NetworkSecurityPerimeterConfigurationsOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, @@ -56,16 +60,21 @@ ServiceOperations, SqlResourcesOperations, TableResourcesOperations, + ThroughputPoolAccountOperations, + ThroughputPoolAccountsOperations, + ThroughputPoolOperations, + ThroughputPoolsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Azure Cosmos DB Database Service Resource Provider REST API. +class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes + """Azure Cosmos DB Chaos Fault REST API. + :ivar chaos_fault: ChaosFaultOperations operations + :vartype chaos_fault: azure.mgmt.cosmosdb.operations.ChaosFaultOperations :ivar database_accounts: DatabaseAccountsOperations operations :vartype database_accounts: azure.mgmt.cosmosdb.operations.DatabaseAccountsOperations :ivar operations: Operations operations @@ -96,6 +105,8 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :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 @@ -108,10 +119,16 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :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 :vartype cassandra_data_centers: azure.mgmt.cosmosdb.operations.CassandraDataCentersOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.cosmosdb.operations.NetworkSecurityPerimeterConfigurationsOperations :ivar notebook_workspaces: NotebookWorkspacesOperations operations :vartype notebook_workspaces: azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations @@ -156,14 +173,24 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.cosmosdb.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.operations.ServiceOperations + :ivar throughput_pools: ThroughputPoolsOperations operations + :vartype throughput_pools: azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations + :ivar throughput_pool: ThroughputPoolOperations operations + :vartype throughput_pool: azure.mgmt.cosmosdb.operations.ThroughputPoolOperations + :ivar throughput_pool_accounts: ThroughputPoolAccountsOperations operations + :vartype throughput_pool_accounts: + azure.mgmt.cosmosdb.operations.ThroughputPoolAccountsOperations + :ivar throughput_pool_account: ThroughputPoolAccountOperations operations + :vartype throughput_pool_account: + azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :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 "2024-11-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-12-01-preview". 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. @@ -203,6 +230,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.chaos_fault = ChaosFaultOperations(self._client, self._config, self._serialize, self._deserialize) self.database_accounts = DatabaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -234,6 +262,7 @@ def __init__( 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 @@ -246,12 +275,18 @@ def __init__( 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.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.notebook_workspaces = NotebookWorkspacesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -298,6 +333,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pools = ThroughputPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool = ThroughputPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pool_accounts = ThroughputPoolAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_account = ThroughputPoolAccountOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py index 8139854b97bb..ce17d1798ce7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -184,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -206,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -235,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer(object): # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1363,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1403,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1416,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,14 +1673,21 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + ] + const = [ + k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: @@ -1596,7 +1697,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1706,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1729,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1753,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1777,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,11 +1788,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1720,11 +1828,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,6 +1839,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1743,24 +1851,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1875,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1889,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1901,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1912,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,6 +1930,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1834,6 +1943,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1849,8 +1959,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,6 +1976,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1877,6 +1989,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1887,14 +2000,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,6 +2023,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1924,6 +2038,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1939,14 +2054,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1976,8 +2091,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,6 +2099,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1996,5 +2111,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj 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 516e05b5a40d..369c45b5ae2e 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 = "9.7.0" +VERSION = "10.0.0b5" 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 0ec156d96fb5..c848cc8a4177 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 @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cosmos_db_management_client import CosmosDBManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cosmos_db_management_client import CosmosDBManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "CosmosDBManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _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 3c7bec439c0a..8dc5dcb05ae1 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 @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for CosmosDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -26,15 +25,15 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-11-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-11-15") + api_version: str = kwargs.pop("api_version", "2024-12-01-preview") 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 6499683d864e..87aab6650797 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 @@ -22,16 +22,20 @@ CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, + ChaosFaultOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, + DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, + GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, + NetworkSecurityPerimeterConfigurationsOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, @@ -56,16 +60,21 @@ ServiceOperations, SqlResourcesOperations, TableResourcesOperations, + ThroughputPoolAccountOperations, + ThroughputPoolAccountsOperations, + ThroughputPoolOperations, + ThroughputPoolsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Azure Cosmos DB Database Service Resource Provider REST API. +class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes + """Azure Cosmos DB Chaos Fault REST API. + :ivar chaos_fault: ChaosFaultOperations operations + :vartype chaos_fault: azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations :ivar database_accounts: DatabaseAccountsOperations operations :vartype database_accounts: azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations :ivar operations: Operations operations @@ -97,6 +106,8 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :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 @@ -109,11 +120,17 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke :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 :vartype cassandra_data_centers: azure.mgmt.cosmosdb.aio.operations.CassandraDataCentersOperations + :ivar network_security_perimeter_configurations: + NetworkSecurityPerimeterConfigurationsOperations operations + :vartype network_security_perimeter_configurations: + azure.mgmt.cosmosdb.aio.operations.NetworkSecurityPerimeterConfigurationsOperations :ivar notebook_workspaces: NotebookWorkspacesOperations operations :vartype notebook_workspaces: azure.mgmt.cosmosdb.aio.operations.NotebookWorkspacesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations @@ -159,14 +176,24 @@ class CosmosDBManagementClient: # pylint: disable=client-accepts-api-version-ke azure.mgmt.cosmosdb.aio.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.aio.operations.ServiceOperations + :ivar throughput_pools: ThroughputPoolsOperations operations + :vartype throughput_pools: azure.mgmt.cosmosdb.aio.operations.ThroughputPoolsOperations + :ivar throughput_pool: ThroughputPoolOperations operations + :vartype throughput_pool: azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations + :ivar throughput_pool_accounts: ThroughputPoolAccountsOperations operations + :vartype throughput_pool_accounts: + azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountsOperations + :ivar throughput_pool_account: ThroughputPoolAccountOperations operations + :vartype throughput_pool_account: + azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :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 "2024-11-15". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-12-01-preview". 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. @@ -206,6 +233,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False + self.chaos_fault = ChaosFaultOperations(self._client, self._config, self._serialize, self._deserialize) self.database_accounts = DatabaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -237,6 +265,7 @@ def __init__( 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 @@ -249,12 +278,18 @@ def __init__( 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.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.notebook_workspaces = NotebookWorkspacesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -301,6 +336,16 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pools = ThroughputPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool = ThroughputPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pool_accounts = ThroughputPoolAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_account = ThroughputPoolAccountOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any 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 0a347515778b..2654ee4c1eb6 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 @@ -5,50 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._database_accounts_operations import DatabaseAccountsOperations -from ._operations import Operations -from ._database_operations import DatabaseOperations -from ._collection_operations import CollectionOperations -from ._collection_region_operations import CollectionRegionOperations -from ._database_account_region_operations import DatabaseAccountRegionOperations -from ._percentile_source_target_operations import PercentileSourceTargetOperations -from ._percentile_target_operations import PercentileTargetOperations -from ._percentile_operations import PercentileOperations -from ._collection_partition_region_operations import CollectionPartitionRegionOperations -from ._collection_partition_operations import CollectionPartitionOperations -from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations -from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._sql_resources_operations import SqlResourcesOperations -from ._mongo_db_resources_operations import MongoDBResourcesOperations -from ._table_resources_operations import TableResourcesOperations -from ._cassandra_resources_operations import CassandraResourcesOperations -from ._gremlin_resources_operations import GremlinResourcesOperations -from ._locations_operations import LocationsOperations -from ._cassandra_clusters_operations import CassandraClustersOperations -from ._cassandra_data_centers_operations import CassandraDataCentersOperations -from ._notebook_workspaces_operations import NotebookWorkspacesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._restorable_database_accounts_operations import RestorableDatabaseAccountsOperations -from ._restorable_sql_databases_operations import RestorableSqlDatabasesOperations -from ._restorable_sql_containers_operations import RestorableSqlContainersOperations -from ._restorable_sql_resources_operations import RestorableSqlResourcesOperations -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._chaos_fault_operations import ChaosFaultOperations # type: ignore +from ._database_accounts_operations import DatabaseAccountsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._database_operations import DatabaseOperations # type: ignore +from ._collection_operations import CollectionOperations # type: ignore +from ._collection_region_operations import CollectionRegionOperations # type: ignore +from ._database_account_region_operations import DatabaseAccountRegionOperations # type: ignore +from ._percentile_source_target_operations import PercentileSourceTargetOperations # type: ignore +from ._percentile_target_operations import PercentileTargetOperations # type: ignore +from ._percentile_operations import PercentileOperations # type: ignore +from ._collection_partition_region_operations import CollectionPartitionRegionOperations # type: ignore +from ._collection_partition_operations import CollectionPartitionOperations # type: ignore +from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations # type: ignore +from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations # type: ignore +from ._graph_resources_operations import GraphResourcesOperations # type: ignore +from ._sql_resources_operations import SqlResourcesOperations # type: ignore +from ._mongo_db_resources_operations import MongoDBResourcesOperations # type: ignore +from ._table_resources_operations import TableResourcesOperations # type: ignore +from ._cassandra_resources_operations import CassandraResourcesOperations # type: ignore +from ._gremlin_resources_operations import GremlinResourcesOperations # type: ignore +from ._locations_operations import LocationsOperations # type: ignore +from ._data_transfer_jobs_operations import DataTransferJobsOperations # type: ignore +from ._cassandra_clusters_operations import CassandraClustersOperations # type: ignore +from ._cassandra_data_centers_operations import CassandraDataCentersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._notebook_workspaces_operations import NotebookWorkspacesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._restorable_database_accounts_operations import RestorableDatabaseAccountsOperations # type: ignore +from ._restorable_sql_databases_operations import RestorableSqlDatabasesOperations # type: ignore +from ._restorable_sql_containers_operations import RestorableSqlContainersOperations # type: ignore +from ._restorable_sql_resources_operations import RestorableSqlResourcesOperations # type: ignore +from ._restorable_mongodb_databases_operations import RestorableMongodbDatabasesOperations # type: ignore +from ._restorable_mongodb_collections_operations import RestorableMongodbCollectionsOperations # type: ignore +from ._restorable_mongodb_resources_operations import RestorableMongodbResourcesOperations # type: ignore +from ._restorable_gremlin_databases_operations import RestorableGremlinDatabasesOperations # type: ignore +from ._restorable_gremlin_graphs_operations import RestorableGremlinGraphsOperations # type: ignore +from ._restorable_gremlin_resources_operations import RestorableGremlinResourcesOperations # type: ignore +from ._restorable_tables_operations import RestorableTablesOperations # type: ignore +from ._restorable_table_resources_operations import RestorableTableResourcesOperations # type: ignore +from ._service_operations import ServiceOperations # type: ignore +from ._throughput_pools_operations import ThroughputPoolsOperations # type: ignore +from ._throughput_pool_operations import ThroughputPoolOperations # type: ignore +from ._throughput_pool_accounts_operations import ThroughputPoolAccountsOperations # type: ignore +from ._throughput_pool_account_operations import ThroughputPoolAccountOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ChaosFaultOperations", "DatabaseAccountsOperations", "Operations", "DatabaseOperations", @@ -62,14 +77,17 @@ "CollectionPartitionOperations", "PartitionKeyRangeIdOperations", "PartitionKeyRangeIdRegionOperations", + "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", "LocationsOperations", + "DataTransferJobsOperations", "CassandraClustersOperations", "CassandraDataCentersOperations", + "NetworkSecurityPerimeterConfigurationsOperations", "NotebookWorkspacesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", @@ -86,6 +104,10 @@ "RestorableTablesOperations", "RestorableTableResourcesOperations", "ServiceOperations", + "ThroughputPoolsOperations", + "ThroughputPoolOperations", + "ThroughputPoolAccountsOperations", + "ThroughputPoolAccountOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 8c695f20a17f..21099125d46c 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,10 +36,15 @@ build_create_update_request, build_deallocate_request, build_delete_request, + build_get_backup_request, + build_get_command_async_request, build_get_request, + build_invoke_command_async_request, build_invoke_command_request, + build_list_backups_request, build_list_by_resource_group_request, build_list_by_subscription_request, + build_list_command_request, build_start_request, build_status_request, build_update_request, @@ -48,12 +53,12 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CassandraClustersOperations: +class CassandraClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -86,7 +91,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ClusterR api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +170,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +244,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +287,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) return deserialized # type: ignore async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,7 +394,7 @@ async def _create_update_initial( body: Union[_models.ClusterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +591,7 @@ async def _update_initial( body: Union[_models.ClusterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -778,7 +783,7 @@ async def _invoke_command_initial( body: Union[_models.CommandPostBody, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -963,10 +968,498 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _deallocate_initial( + async def _invoke_command_async_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CommandAsyncPostBody") + + _request = build_invoke_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: _models.CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CommandPublicResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CommandPublicResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Is either a CommandAsyncPostBody type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CommandPublicResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._invoke_command_async_initial( + 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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommandPublicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CommandPublicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CommandPublicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_command( self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CommandPublicResource"]: + """List all commands currently running on ring info. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of either CommandPublicResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCommands] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_command_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ListCommands", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get_command_async( + self, resource_group_name: str, cluster_name: str, command_id: str, **kwargs: Any + ) -> _models.CommandPublicResource: + """Get details about a specified command that was run asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param command_id: Managed Cassandra cluster command id. Required. + :type command_id: str + :return: CommandPublicResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CommandPublicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) + + _request = build_get_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("CommandPublicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_backups( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.BackupResource"]: + """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. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of either BackupResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListBackups] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_backups_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @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. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param backup_id: Id of a restorable backup of a Cassandra cluster. Required. + :type backup_id: str + :return: BackupResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.BackupResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackupResource] = kwargs.pop("cls", None) + + _request = build_get_backup_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + backup_id=backup_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _deallocate_initial( + self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,6 +1477,7 @@ async def _deallocate_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, + x_ms_force_deallocate=x_ms_force_deallocate, api_version=api_version, headers=_headers, params=_params, @@ -1015,7 +1509,7 @@ async def _deallocate_initial( @distributed_trace_async async def begin_deallocate( - self, resource_group_name: str, cluster_name: str, **kwargs: Any + self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do @@ -1026,6 +1520,10 @@ async def begin_deallocate( :type resource_group_name: str :param cluster_name: Managed Cassandra cluster name. Required. :type cluster_name: str + :param x_ms_force_deallocate: Force to deallocate a cluster of Cluster Type Production. Force + to deallocate a cluster of Cluster Type Production might cause data loss. Default value is + None. + :type x_ms_force_deallocate: str :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: @@ -1042,6 +1540,7 @@ async def begin_deallocate( raw_result = await self._deallocate_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, + x_ms_force_deallocate=x_ms_force_deallocate, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1071,7 +1570,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,7 +1687,7 @@ async def status( :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 093aa15cfd59..8797e6f21015 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -43,7 +42,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListDataCenters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +212,7 @@ async def get( async def _delete_initial( self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +326,7 @@ async def _create_update_initial( body: Union[_models.DataCenterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +533,7 @@ async def _update_initial( body: Union[_models.DataCenterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 ad400dc181b7..4d8e45f7abc4 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,26 +35,34 @@ from ...operations._cassandra_resources_operations import ( build_create_update_cassandra_keyspace_request, build_create_update_cassandra_table_request, + build_create_update_cassandra_view_request, build_delete_cassandra_keyspace_request, build_delete_cassandra_table_request, + build_delete_cassandra_view_request, 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, build_migrate_cassandra_keyspace_to_manual_throughput_request, build_migrate_cassandra_table_to_autoscale_request, build_migrate_cassandra_table_to_manual_throughput_request, + build_migrate_cassandra_view_to_autoscale_request, + build_migrate_cassandra_view_to_manual_throughput_request, build_update_cassandra_keyspace_throughput_request, build_update_cassandra_table_throughput_request, + build_update_cassandra_view_throughput_request, ) if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +109,7 @@ def list_cassandra_keyspaces( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CassandraKeyspaceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +189,7 @@ async def get_cassandra_keyspace( :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -232,7 +240,7 @@ async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -448,7 +456,7 @@ def get_long_running_output(pipeline_response): async def _delete_cassandra_keyspace_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +587,7 @@ async def get_cassandra_keyspace_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -630,7 +638,7 @@ async def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,7 +852,7 @@ def get_long_running_output(pipeline_response): async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -966,7 +974,7 @@ def get_long_running_output(pipeline_response): async def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1118,7 @@ def list_cassandra_tables( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CassandraTableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1192,7 +1200,7 @@ async def get_cassandra_table( :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1245,7 +1253,7 @@ async def _create_update_cassandra_table_initial( create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1472,7 +1480,7 @@ def get_long_running_output(pipeline_response): async def _delete_cassandra_table_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1609,7 +1617,7 @@ async def get_cassandra_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1662,7 +1670,7 @@ async def _update_cassandra_table_throughput_initial( # pylint: disable=name-to update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1887,7 +1895,7 @@ def get_long_running_output(pipeline_response): async def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2013,7 +2021,7 @@ def get_long_running_output(pipeline_response): async def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2135,3 +2143,1049 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace + def list_cassandra_views( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> AsyncIterable["_models.CassandraViewGetResults"]: + """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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An iterator like instance of either CassandraViewGetResults or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CassandraViewListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_cassandra_views_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :return: CassandraViewGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) + + _request = build_get_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_cassandra_view_parameters, (IOBase, bytes)): + _content = create_update_cassandra_view_parameters + else: + _json = self._serialize.body(create_update_cassandra_view_parameters, "CassandraViewCreateUpdateParameters") + + _request = build_create_update_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Required. + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Required. + :type create_update_cassandra_view_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Is either a CassandraViewCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CassandraViewGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CassandraViewGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CassandraViewGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_cassandra_view_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_cassandra_view( + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + + _request = build_get_cassandra_view_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + + _request = build_update_cassandra_view_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_update_cassandra_view_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Required. + :type update_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_cassandra_view_to_autoscale_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_cassandra_view_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_cassandra_view_to_autoscale( # pylint: disable=name-too-long + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_cassandra_view_to_manual_throughput_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_cassandra_view_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_cassandra_view_to_manual_throughput( # pylint: disable=name-too-long + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_chaos_fault_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_chaos_fault_operations.py new file mode 100644 index 000000000000..e881ab58ea8b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_chaos_fault_operations.py @@ -0,0 +1,413 @@ +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._chaos_fault_operations import build_enable_disable_request, build_get_request, build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ChaosFaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`chaos_fault` attribute. + """ + + models = _models + + 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, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ChaosFaultResource"]: + """List Chaos Faults for CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either ChaosFaultResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ChaosFaultListResponse] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ChaosFaultListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _enable_disable_initial( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(chaos_fault_request, (IOBase, bytes)): + _content = chaos_fault_request + else: + _json = self._serialize.body(chaos_fault_request, "ChaosFaultResource") + + _request = build_enable_disable_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: _models.ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Required. + :type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Required. + :type chaos_fault_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Is either a + ChaosFaultResource type or a IO[bytes] type. Required. + :type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._enable_disable_initial( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + chaos_fault_request=chaos_fault_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ChaosFaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ChaosFaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, chaos_fault: str, **kwargs: Any + ) -> _models.ChaosFaultResource: + """Get Chaos Fault for a CosmosdB account for a particular Chaos Fault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :return: ChaosFaultResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ChaosFaultResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 1e58e81d93e8..337ac17565a8 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,7 +34,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +94,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -195,7 +194,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -285,7 +284,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 d6146c5c07b4..789187667cfb 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +90,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +190,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionUsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 e74c836fb53f..b1811d26d2f9 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +93,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 2047546baa8b..f08147a1e2e5 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +93,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 new file mode 100644 index 000000000000..3e983c29cdcf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_data_transfer_jobs_operations.py @@ -0,0 +1,589 @@ +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, 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 +from ...operations._data_transfer_jobs_operations import ( + build_cancel_request, + build_complete_request, + build_create_request, + build_get_request, + build_list_by_database_account_request, + build_pause_request, + build_resume_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class DataTransferJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`data_transfer_jobs` attribute. + """ + + models = _models + + 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") + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: _models.CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: Union[_models.CreateJobRequest, IO[bytes]], + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Is either a CreateJobRequest type or a IO[bytes] type. Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO[bytes] + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _json = self._serialize.body(job_create_parameters, "CreateJobRequest") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_pause_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def complete( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Completes a Data Transfer Online Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_complete_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.DataTransferJobGetResults"]: + """Get a list of Data Transfer jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either DataTransferJobGetResults or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobFeedResults] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) 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 5c4d6917bf8d..5bdea50ba125 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +81,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 2007764906f4..958298855f21 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -56,7 +56,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +95,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +144,7 @@ async def _update_initial( update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +340,7 @@ async def _create_or_update_initial( create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -536,7 +536,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -650,7 +650,7 @@ async def _failover_priority_change_initial( failover_parameters: Union[_models.FailoverPolicies, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -860,7 +860,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.DatabaseAccountGetResult api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -941,7 +941,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1017,7 +1017,7 @@ async def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1074,7 +1074,7 @@ async def list_connection_strings( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1123,7 +1123,7 @@ async def _offline_region_initial( region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1173,7 +1173,7 @@ async def _offline_region_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1319,7 +1319,7 @@ async def _online_region_initial( region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1369,7 +1369,7 @@ async def _online_region_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1523,7 +1523,7 @@ async def get_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1580,7 +1580,7 @@ async def list_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1629,7 +1629,7 @@ async def _regenerate_key_initial( key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1827,7 +1827,7 @@ async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1889,7 +1889,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1977,7 +1977,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2061,7 +2061,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 7b1205f45266..c9980dac5aec 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -35,7 +34,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +86,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,7 +182,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +269,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 new file mode 100644 index 000000000000..13424097d980 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_graph_resources_operations.py @@ -0,0 +1,543 @@ +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._graph_resources_operations import ( + build_create_update_graph_request, + build_delete_graph_resource_request, + build_get_graph_request, + build_list_graphs_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GraphResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`graph_resources` attribute. + """ + + models = _models + + 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_graphs( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.GraphResourceGetResults"]: + """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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either GraphResourceGetResults or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GraphResourcesListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_graphs_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :return: GraphResourceGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) + + _request = build_get_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_graph_initial( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_graph_parameters, (IOBase, bytes)): + _content = create_update_graph_parameters + else: + _json = self._serialize.body(create_update_graph_parameters, "GraphResourceCreateUpdateParameters") + + _request = build_create_update_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. + Required. + :type create_update_graph_parameters: + ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. + Required. + :type create_update_graph_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. Is + either a GraphResourceCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_graph_parameters: + ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GraphResourceGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GraphResourceGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GraphResourceGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_graph_resource_initial( + self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_graph_resource_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_graph_resource( + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 8763dd96ee72..568dc03a0ab1 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -55,7 +55,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -102,7 +102,7 @@ def list_gremlin_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GremlinDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,7 +182,7 @@ async def get_gremlin_database( :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -233,7 +233,7 @@ async def _create_update_gremlin_database_initial( create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +449,7 @@ def get_long_running_output(pipeline_response): async def _delete_gremlin_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,7 +580,7 @@ async def get_gremlin_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -631,7 +631,7 @@ async def _update_gremlin_database_throughput_initial( # pylint: disable=name-t update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -845,7 +845,7 @@ def get_long_running_output(pipeline_response): async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -967,7 +967,7 @@ def get_long_running_output(pipeline_response): async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1111,7 +1111,7 @@ def list_gremlin_graphs( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GremlinGraphListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1193,7 +1193,7 @@ async def get_gremlin_graph( :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1246,7 +1246,7 @@ async def _create_update_gremlin_graph_initial( create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1468,7 +1468,7 @@ def get_long_running_output(pipeline_response): async def _delete_gremlin_graph_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1605,7 +1605,7 @@ async def get_gremlin_graph_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1658,7 +1658,7 @@ async def _update_gremlin_graph_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1883,7 +1883,7 @@ def get_long_running_output(pipeline_response): async def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2009,7 +2009,7 @@ def get_long_running_output(pipeline_response): async def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2141,7 +2141,7 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 dfcc88306b67..4059595296a0 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.LocationGetResult"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +140,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 8bf04def918b..2cfe3f822db6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -47,6 +47,7 @@ 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, build_list_mongo_db_collections_request, build_list_mongo_db_databases_request, build_list_mongo_role_definitions_request, @@ -55,6 +56,11 @@ build_migrate_mongo_db_collection_to_manual_throughput_request, build_migrate_mongo_db_database_to_autoscale_request, build_migrate_mongo_db_database_to_manual_throughput_request, + build_mongo_db_container_redistribute_throughput_request, + build_mongo_db_container_retrieve_throughput_distribution_request, + build_mongo_db_database_partition_merge_request, + build_mongo_db_database_redistribute_throughput_request, + build_mongo_db_database_retrieve_throughput_distribution_request, build_retrieve_continuous_backup_information_request, build_update_mongo_db_collection_throughput_request, build_update_mongo_db_database_throughput_request, @@ -63,7 +69,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -110,7 +116,7 @@ def list_mongo_db_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoDBDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +196,7 @@ async def get_mongo_db_database( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,7 +247,7 @@ async def _create_update_mongo_db_database_initial( create_update_mongo_db_database_parameters: Union[_models.MongoDBDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -457,7 +463,7 @@ def get_long_running_output(pipeline_response): async def _delete_mongo_db_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +594,7 @@ async def get_mongo_db_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -639,7 +645,7 @@ async def _update_mongo_db_database_throughput_initial( # pylint: disable=name- update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -853,7 +859,7 @@ def get_long_running_output(pipeline_response): async def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -975,7 +981,7 @@ def get_long_running_output(pipeline_response): async def _migrate_mongo_db_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1094,6 +1100,912 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + async def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_mongo_db_database_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Is either a RetrieveThroughputParameters type or + a IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._mongo_db_database_retrieve_throughput_distribution_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _mongo_db_database_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_mongo_db_database_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Is either a RedistributeThroughputParameters type + or a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._mongo_db_database_redistribute_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _mongo_db_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_mongo_db_container_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Is either a RetrieveThroughputParameters type + or a IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_mongo_db_container_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Is either a RedistributeThroughputParameters type + or a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + @distributed_trace def list_mongo_db_collections( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any @@ -1119,7 +2031,142 @@ def list_mongo_db_collections( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoDBCollectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_mongo_db_collections_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get_mongo_db_collection( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :return: MongoDBCollectionGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + + _request = build_get_mongo_db_collection_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("MongoDBCollectionGetResults", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1127,66 +2174,152 @@ def list_mongo_db_collections( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_list_mongo_db_collections_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_collection_parameters + else: + _json = self._serialize.body( + create_update_mongo_db_collection_parameters, "MongoDBCollectionCreateUpdateParameters" + ) - async def extract_data(pipeline_response): - deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + _request = build_create_update_mongo_db_collection_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def get_next(next_link=None): - _request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore + + @overload + async def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Required. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Required. + :type create_update_mongo_db_collection_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get_mongo_db_collection( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> _models.MongoDBCollectionGetResults: - """Gets the MongoDB collection under an existing Azure Cosmos DB database account. + async def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> 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. Required. @@ -1197,11 +2330,70 @@ async def get_mongo_db_collection( :type database_name: str :param collection_name: Cosmos DB collection name. Required. :type collection_name: str - :return: MongoDBCollectionGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] + type. Required. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_update_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MongoDBCollectionGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_mongo_db_collection_initial( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1213,9 +2405,9 @@ async def get_mongo_db_collection( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_get_mongo_db_collection_request( + _request = build_delete_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1227,34 +2419,106 @@ async def get_mongo_db_collection( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long + @distributed_trace_async + async def begin_delete_mongo_db_collection( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_mongo_db_collection_initial( + 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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _mongo_db_database_partition_merge_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + merge_parameters: Union[_models.MergeParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1272,18 +2536,15 @@ async def _create_update_mongo_db_collection_initial( # pylint: disable=name-to content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_collection_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _json = self._serialize.body( - create_update_mongo_db_collection_parameters, "MongoDBCollectionCreateUpdateParameters" - ) + _json = self._serialize.body(merge_parameters, "MergeParameters") - _request = build_create_update_mongo_db_collection_request( + _request = build_mongo_db_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1325,18 +2586,17 @@ async def _create_update_mongo_db_collection_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - async def begin_create_update_mongo_db_collection( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1345,35 +2605,30 @@ async def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionStorageInfoCollection or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_db_collection( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: IO[bytes], + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1382,32 +2637,28 @@ async def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Required. - :type create_update_mongo_db_collection_parameters: IO[bytes] + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionStorageInfoCollection or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_mongo_db_collection( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + merge_parameters: Union[_models.MergeParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1416,17 +2667,13 @@ async def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MongoDBCollectionGetResults or the - result of cls(response) + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionStorageInfoCollection or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1434,17 +2681,16 @@ async def begin_create_update_mongo_db_collection( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_mongo_db_collection_initial( + raw_result = await self._mongo_db_database_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + merge_parameters=merge_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1456,32 +2702,40 @@ async def begin_create_update_mongo_db_collection( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.MongoDBCollectionGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_mongo_db_collection_initial( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + async def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1489,19 +2743,31 @@ async def _delete_mongo_db_collection_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_mongo_db_collection_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_list_mongo_db_collection_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -1515,7 +2781,7 @@ async def _delete_mongo_db_collection_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1537,11 +2803,87 @@ async def _delete_mongo_db_collection_initial( return deserialized # type: ignore + @overload + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + @distributed_trace_async - async def begin_delete_mongo_db_collection( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB Collection. + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **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. Required. @@ -1552,25 +2894,33 @@ async def begin_delete_mongo_db_collection( :type database_name: str :param collection_name: Cosmos DB collection name. Required. :type collection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_mongo_db_collection_initial( + 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, headers=_headers, params=_params, @@ -1579,24 +2929,30 @@ async def begin_delete_mongo_db_collection( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get_mongo_db_collection_throughput( @@ -1618,7 +2974,7 @@ async def get_mongo_db_collection_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1671,7 +3027,7 @@ async def _update_mongo_db_collection_throughput_initial( # pylint: disable=nam update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1896,7 +3252,7 @@ def get_long_running_output(pipeline_response): async def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2022,7 +3378,7 @@ def get_long_running_output(pipeline_response): async def _migrate_mongo_db_collection_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2163,7 +3519,7 @@ async def get_mongo_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2216,7 +3572,7 @@ async def _create_update_mongo_role_definition_initial( # pylint: disable=name- ], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2427,7 +3783,7 @@ def get_long_running_output(pipeline_response): async def _delete_mongo_role_definition_initial( self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2556,7 +3912,7 @@ def list_mongo_role_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoRoleDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2636,7 +3992,7 @@ async def get_mongo_user_definition( :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2689,7 +4045,7 @@ async def _create_update_mongo_user_definition_initial( # pylint: disable=name- ], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2900,7 +4256,7 @@ def get_long_running_output(pipeline_response): async def _delete_mongo_user_definition_initial( self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3029,7 +4385,7 @@ def list_mongo_user_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoUserDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3100,7 +4456,7 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..f3ce8502ccbd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_network_security_perimeter_configurations_operations.py @@ -0,0 +1,340 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._network_security_perimeter_configurations_operations import ( + build_get_request, + build_list_request, + build_reconcile_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + models = _models + + 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, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: + """Gets list of effective Network Security Perimeter Configuration for cosmos db account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets effective Network Security Perimeter Configuration for association. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param network_security_perimeter_configuration_name: The name for Network Security Perimeter + configuration. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _reconcile_initial( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_reconcile_request( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reconcile( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Refreshes any information about the association. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param network_security_perimeter_configuration_name: The name for Network Security Perimeter + configuration. Required. + :type network_security_perimeter_configuration_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reconcile_initial( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 bbd7e6ab0731..e710fb09b15b 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -45,7 +44,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +89,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotebookWorkspaceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +145,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -175,7 +174,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -209,7 +208,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response) @@ -227,7 +226,7 @@ async def _create_or_update_initial( notebook_create_update_parameters: Union[_models.NotebookWorkspaceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +277,7 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -439,7 +438,7 @@ async def _delete_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -478,7 +477,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -573,7 +572,7 @@ async def list_connection_info( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +606,7 @@ async def list_connection_info( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response.http_response) @@ -624,7 +623,7 @@ async def _regenerate_auth_token_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -663,7 +662,7 @@ async def _regenerate_auth_token_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -743,7 +742,7 @@ async def _start_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +781,7 @@ async def _start_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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 374941add85d..454ff9b22a53 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 e5719f865a4c..7b708a21049e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +92,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 81cab31b89d3..efe4e647ca77 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +96,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 9d20844c2176..c0ab7a5cccf9 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +80,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 7703bb570111..8a2f01721801 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +92,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 a3b1ae14db50..a8afbba0b3aa 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +83,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 972d2bd2c7d7..65cdd3d4b3b0 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +88,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -168,7 +167,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +218,7 @@ async def _create_or_update_initial( parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,7 +269,7 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -421,7 +420,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -460,7 +459,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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 e89692eb682a..fba7227dd9b1 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -32,7 +31,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +77,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +156,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 74d32712b83d..4854d17fd89e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,7 +82,7 @@ def list_by_location( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +160,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.RestorableDatabaseAccoun api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +236,7 @@ async def get_by_location( :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index e20776bddcbc..73ac71916407 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 9727d2e9c266..a3f6ddd0b047 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +92,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinGraphsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index bed6e396aa7d..ad7bc3c5415b 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +91,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 53fbdd05a929..94995b047f4e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +92,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbCollectionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 e8696dcf1c04..7ccea0c0a507 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 3bd82fca524a..9bca57823a5c 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +91,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 38f893922e0a..ad5143641566 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +91,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlContainersListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 bfb7c3f659ca..533f026a9006 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,7 +80,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 185894260213..47e36f069944 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +91,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 45f0907202c1..40ad7f2df711 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableTableResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 868a6a90b922..b1c25e8e9fcc 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableTablesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 b48c44726384..98728bc99167 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,7 +86,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -157,7 +156,7 @@ async def _create_initial( create_update_parameters: Union[_models.ServiceResourceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,17 +209,10 @@ async def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("azure-AsyncOperation") - ) - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @@ -379,7 +371,7 @@ async def get( :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -425,7 +417,7 @@ async def get( async def _delete_initial( self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 67cafa788b06..d3a8229dad47 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -59,6 +59,7 @@ 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, build_list_sql_containers_request, build_list_sql_databases_request, build_list_sql_role_assignments_request, @@ -71,6 +72,11 @@ build_migrate_sql_database_to_autoscale_request, build_migrate_sql_database_to_manual_throughput_request, build_retrieve_continuous_backup_information_request, + build_sql_container_redistribute_throughput_request, + build_sql_container_retrieve_throughput_distribution_request, + build_sql_database_partition_merge_request, + build_sql_database_redistribute_throughput_request, + build_sql_database_retrieve_throughput_distribution_request, build_update_sql_container_throughput_request, build_update_sql_database_throughput_request, ) @@ -78,7 +84,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -125,7 +131,7 @@ def list_sql_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +211,7 @@ async def get_sql_database( :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -256,7 +262,7 @@ async def _create_update_sql_database_initial( create_update_sql_database_parameters: Union[_models.SqlDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -466,7 +472,7 @@ def get_long_running_output(pipeline_response): async def _delete_sql_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -597,7 +603,7 @@ async def get_sql_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -648,7 +654,7 @@ async def _update_sql_database_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -862,7 +868,7 @@ def get_long_running_output(pipeline_response): async def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -984,7 +990,7 @@ def get_long_running_output(pipeline_response): async def _migrate_sql_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1104,10 +1110,10 @@ def get_long_running_output(pipeline_response): ) @distributed_trace - def list_sql_containers( + def list_client_encryption_keys( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.SqlContainerGetResults"]: - """Lists the SQL container under an existing Azure Cosmos DB database account. + ) -> AsyncIterable["_models.ClientEncryptionKeyGetResults"]: + """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. Required. @@ -1116,19 +1122,19 @@ def list_sql_containers( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An iterator like instance of either SqlContainerGetResults or the result of + :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1139,7 +1145,7 @@ def list_sql_containers( def prepare_request(next_link=None): if not next_link: - _request = build_list_sql_containers_request( + _request = build_list_client_encryption_keys_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1168,7 +1174,7 @@ def prepare_request(next_link=None): return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("SqlContainerListResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -1192,10 +1198,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @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. + async 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. Required. @@ -1204,13 +1215,13 @@ async def get_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :return: SqlContainerGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :return: ClientEncryptionKeyGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1222,13 +1233,13 @@ async def get_sql_container( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - _request = build_get_sql_container_request( + _request = build_get_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -1247,23 +1258,25 @@ async def get_sql_container( 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.http_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_sql_container_initial( + async def _create_update_client_encryption_key_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1281,16 +1294,18 @@ async def _create_update_sql_container_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): - _content = create_update_sql_container_parameters + if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): + _content = create_update_client_encryption_key_parameters else: - _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") + _json = self._serialize.body( + create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" + ) - _request = build_create_update_sql_container_request( + _request = build_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -1332,18 +1347,19 @@ async def _create_update_sql_container_initial( return deserialized # type: ignore @overload - async def begin_create_update_sql_container( + async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1352,34 +1368,36 @@ async def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :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] + :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] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_container( + async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: IO[bytes], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1388,31 +1406,35 @@ async def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: IO[bytes] + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :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] + :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] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_container( + async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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). :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -1421,15 +1443,17 @@ async def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Is either a SqlContainerCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO[bytes] - :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] + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Is either a ClientEncryptionKeyCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] + :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] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1437,17 +1461,17 @@ async def begin_create_update_sql_container( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_sql_container_initial( + raw_result = await self._create_update_client_encryption_key_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, + 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, @@ -1459,7 +1483,7 @@ async def begin_create_update_sql_container( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1471,80 +1495,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlContainerGetResults].from_continuation_token( + return AsyncLROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.SqlContainerGetResults]( + return AsyncLROPoller[_models.ClientEncryptionKeyGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_container_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_sql_container_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("azure-AsyncOperation") - ) - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_sql_container( - 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. + @distributed_trace + def list_sql_containers( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlContainerGetResults"]: + """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. Required. @@ -1553,60 +1518,86 @@ async def begin_delete_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An iterator like instance of either SqlContainerGetResults or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_sql_containers_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + 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) @distributed_trace_async - async def get_sql_container_throughput( + async def get_sql_container( 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. + ) -> _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. Required. @@ -1617,11 +1608,11 @@ async def get_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :return: SqlContainerGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1633,9 +1624,9 @@ async def get_sql_container_throughput( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - _request = build_get_sql_container_throughput_request( + _request = build_get_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1658,23 +1649,23 @@ async def get_sql_container_throughput( 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.http_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_sql_container_throughput_initial( + async def _create_update_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1692,12 +1683,12 @@ async def _update_sql_container_throughput_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): + _content = create_update_sql_container_parameters else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") - _request = build_update_sql_container_throughput_request( + _request = build_create_update_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1743,18 +1734,18 @@ async def _update_sql_container_throughput_initial( return deserialized # type: ignore @overload - async def begin_update_sql_container_throughput( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -1765,33 +1756,32 @@ async def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :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 SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_sql_container_throughput( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: IO[bytes], + create_update_sql_container_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -1802,30 +1792,29 @@ async def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: IO[bytes] + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :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 SqlContainerGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_sql_container_throughput( + async def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -1836,15 +1825,13 @@ async def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] - :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] + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Is either a SqlContainerCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO[bytes] + :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: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -1852,17 +1839,17 @@ async def begin_update_sql_container_throughput( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._update_sql_container_throughput_initial( + 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, - update_throughput_parameters=update_throughput_parameters, + create_update_sql_container_parameters=create_update_sql_container_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1874,7 +1861,7 @@ async def begin_update_sql_container_throughput( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1886,20 +1873,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlContainerGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.SqlContainerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-long + async def _delete_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1913,7 +1900,7 @@ async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-t api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_migrate_sql_container_to_autoscale_request( + _request = build_delete_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1933,7 +1920,7 @@ async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-t response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -1956,10 +1943,10 @@ async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-t return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_sql_container_to_autoscale( + async def begin_delete_sql_container( 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. Required. @@ -1970,22 +1957,20 @@ async def begin_migrate_sql_container_to_autoscale( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :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: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_sql_container_to_autoscale_initial( + raw_result = await self._delete_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -1999,11 +1984,9 @@ async def begin_migrate_sql_container_to_autoscale( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -2012,20 +1995,23 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ThroughputSettingsGetResults]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + async def _sql_database_partition_merge_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2033,19 +2019,30 @@ async def _migrate_sql_container_to_manual_throughput_initial( # pylint: disabl } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_migrate_sql_container_to_manual_throughput_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_sql_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -2081,42 +2078,1562 @@ async def _migrate_sql_container_to_manual_throughput_initial( # pylint: disabl return deserialized # type: ignore - @distributed_trace_async - async def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-too-long - 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 autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str + @overload + async def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._sql_database_partition_merge_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + merge_parameters=merge_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _list_sql_container_partition_merge_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_list_sql_container_partition_merge_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_list_sql_container_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.MergeParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + + _request = build_get_sql_container_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + + _request = build_update_sql_container_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_update_sql_container_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_sql_container_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_sql_container_to_autoscale( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._migrate_sql_container_to_autoscale_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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_sql_container_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-too-long + 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 autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._migrate_sql_container_to_manual_throughput_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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _sql_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_sql_database_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Is either a RetrieveThroughputParameters type or a + IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._sql_database_retrieve_throughput_distribution_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _sql_database_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_sql_database_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Is either a RedistributeThroughputParameters type or a + IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._sql_database_redistribute_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _sql_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_sql_container_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :return: An instance of AsyncLROPoller that returns either ThroughputSettingsGetResults or the - result of cls(response) + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Is either a RetrieveThroughputParameters type or a + IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionThroughputInfoResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._migrate_sql_container_to_manual_throughput_initial( + raw_result = await self._sql_container_retrieve_throughput_distribution_initial( 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, @@ -2126,196 +3643,40 @@ async def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=n kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def list_client_encryption_keys( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClientEncryptionKeyGetResults"]: - """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. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - 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( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async 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) # type: ignore - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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) - - @distributed_trace_async - async 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. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :return: ClientEncryptionKeyGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - - _request = build_get_client_encryption_key_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - client_encryption_key_name=client_encryption_key_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_update_client_encryption_key_initial( # pylint: disable=name-too-long + async def _sql_container_redistribute_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[ - _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] - ], + container_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2333,18 +3694,16 @@ async def _create_update_client_encryption_key_initial( # pylint: disable=name- content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _json = self._serialize.body( - create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" - ) + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - _request = build_create_update_client_encryption_key_request( + _request = build_sql_container_redistribute_throughput_request( 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, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2386,19 +3745,18 @@ async def _create_update_client_encryption_key_initial( # pylint: disable=name- return deserialized # type: ignore @overload - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long 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, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **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.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2407,36 +3765,35 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionThroughputInfoResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], + container_name: str, + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **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.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2445,35 +3802,32 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionThroughputInfoResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[ - _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] - ], + container_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], **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.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2482,17 +3836,17 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Is either a ClientEncryptionKeyCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Is either a RedistributeThroughputParameters type or + a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + PhysicalPartitionThroughputInfoResult or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2500,17 +3854,17 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_update_client_encryption_key_initial( + raw_result = await self._sql_container_redistribute_throughput_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, + container_name=container_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2522,25 +3876,27 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_token( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ClientEncryptionKeyGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -2571,7 +3927,7 @@ def list_sql_stored_procedures( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlStoredProcedureListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2662,7 +4018,7 @@ async def get_sql_stored_procedure( :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2719,7 +4075,7 @@ async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-t ], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2965,7 +4321,7 @@ async def _delete_sql_stored_procedure_initial( stored_procedure_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3119,7 +4475,7 @@ def list_sql_user_defined_functions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlUserDefinedFunctionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3210,7 +4566,7 @@ async def get_sql_user_defined_function( :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3267,7 +4623,7 @@ async def _create_update_sql_user_defined_function_initial( # pylint: disable=n ], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3513,7 +4869,7 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too user_defined_function_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3667,7 +5023,7 @@ def list_sql_triggers( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlTriggerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3758,7 +5114,7 @@ async def get_sql_trigger( :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3813,7 +5169,7 @@ async def _create_update_sql_trigger_initial( create_update_sql_trigger_parameters: Union[_models.SqlTriggerCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4051,7 +5407,7 @@ async def _delete_sql_trigger_initial( trigger_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4195,7 +5551,7 @@ async def get_sql_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4246,7 +5602,7 @@ async def _create_update_sql_role_definition_initial( # pylint: disable=name-to create_update_sql_role_definition_parameters: Union[_models.SqlRoleDefinitionCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4455,7 +5811,7 @@ def get_long_running_output(pipeline_response): async def _delete_sql_role_definition_initial( self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4584,7 +5940,7 @@ def list_sql_role_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlRoleDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4663,7 +6019,7 @@ async def get_sql_role_assignment( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4714,7 +6070,7 @@ async def _create_update_sql_role_assignment_initial( # pylint: disable=name-to create_update_sql_role_assignment_parameters: Union[_models.SqlRoleAssignmentCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4923,7 +6279,7 @@ def get_long_running_output(pipeline_response): async def _delete_sql_role_assignment_initial( self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5052,7 +6408,7 @@ def list_sql_role_assignments( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlRoleAssignmentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5123,7 +6479,7 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 f1f8f4a797cc..384c66e2ca66 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -34,9 +34,17 @@ from ... import models as _models from ...operations._table_resources_operations import ( build_create_update_table_request, + build_create_update_table_role_assignment_request, + build_create_update_table_role_definition_request, build_delete_table_request, + build_delete_table_role_assignment_request, + build_delete_table_role_definition_request, build_get_table_request, + build_get_table_role_assignment_request, + build_get_table_role_definition_request, build_get_table_throughput_request, + build_list_table_role_assignments_request, + build_list_table_role_definitions_request, build_list_tables_request, build_migrate_table_to_autoscale_request, build_migrate_table_to_manual_throughput_request, @@ -47,12 +55,12 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class TableResourcesOperations: +class TableResourcesOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -92,7 +100,7 @@ def list_tables( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +179,7 @@ async def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +230,7 @@ async def _create_update_table_initial( create_update_table_parameters: Union[_models.TableCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +439,7 @@ def get_long_running_output(pipeline_response): async def _delete_table_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,7 +570,7 @@ async def get_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -613,7 +621,7 @@ async def _update_table_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -827,7 +835,7 @@ def get_long_running_output(pipeline_response): async def _migrate_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -949,7 +957,7 @@ def get_long_running_output(pipeline_response): async def _migrate_table_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1076,7 +1084,7 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,3 +1281,973 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[_models.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace_async + async def get_table_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.TableRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Table Role Definition with the given + Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: TableRoleDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + + _request = build_get_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TableRoleDefinitionResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_table_role_definition_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: Union[_models.TableRoleDefinitionResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): + _content = create_update_table_role_definition_parameters + else: + _json = self._serialize.body(create_update_table_role_definition_parameters, "TableRoleDefinitionResource") + + _request = build_create_update_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: _models.TableRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_table_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TableRoleDefinitionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_table_role_definition_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TableRoleDefinitionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: Union[_models.TableRoleDefinitionResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a TableRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_table_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either TableRoleDefinitionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_update_table_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + create_update_table_role_definition_parameters=create_update_table_role_definition_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TableRoleDefinitionResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.TableRoleDefinitionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.TableRoleDefinitionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_table_role_definition_initial( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_table_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_table_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_table_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TableRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Table Role Definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either TableRoleDefinitionResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleDefinitionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_table_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TableRoleDefinitionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get_table_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.TableRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Table Role Assignment with the given + Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: TableRoleAssignmentResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) + + _request = build_get_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TableRoleAssignmentResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_table_role_assignment_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[_models.TableRoleAssignmentResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_table_role_assignment_parameters + else: + _json = self._serialize.body(create_update_table_role_assignment_parameters, "TableRoleAssignmentResource") + + _request = build_create_update_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TableRoleAssignmentResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_table_role_assignment_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TableRoleAssignmentResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[_models.TableRoleAssignmentResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a TableRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either TableRoleAssignmentResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_update_table_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_table_role_assignment_parameters=create_update_table_role_assignment_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TableRoleAssignmentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.TableRoleAssignmentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.TableRoleAssignmentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_table_role_assignment_initial( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_table_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_table_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_table_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncIterable["_models.TableRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Table Role Assignments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either TableRoleAssignmentResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleAssignmentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_table_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TableRoleAssignmentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_account_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_account_operations.py new file mode 100644 index 000000000000..41e2799c5e6e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_account_operations.py @@ -0,0 +1,459 @@ +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._throughput_pool_account_operations import ( + build_create_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ThroughputPoolAccountOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`throughput_pool_account` attribute. + """ + + models = _models + + 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( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> _models.ThroughputPoolAccountResource: + """Retrieves the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :return: ThroughputPoolAccountResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ThroughputPoolAccountResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ThroughputPoolAccountResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _models.ThroughputPoolAccountResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Is either a + ThroughputPoolAccountResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolAccountResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputPoolAccountResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputPoolAccountResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Removes an existing Azure Cosmos DB database account from a throughput pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_accounts_operations.py new file mode 100644 index 000000000000..16288dae2da8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_accounts_operations.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, 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 +from ...operations._throughput_pool_accounts_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ThroughputPoolAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`throughput_pool_accounts` attribute. + """ + + models = _models + + 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, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ThroughputPoolAccountResource"]: + """Lists all the Azure Cosmos DB accounts available under the subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: An iterator like instance of either ThroughputPoolAccountResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolAccountsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolAccountsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_operations.py new file mode 100644 index 000000000000..ec5b7d6995ea --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pool_operations.py @@ -0,0 +1,639 @@ +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._throughput_pool_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ThroughputPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`throughput_pool` attribute. + """ + + models = _models + + 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( + self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> _models.ThroughputPoolResource: + """Retrieves the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: ThroughputPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ThroughputPoolResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: _models.ThroughputPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Is either a + ThroughputPoolResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ThroughputPoolUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[_models.ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Default value is None. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Is either a + ThroughputPoolUpdate type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ThroughputPoolResource or the result + of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ThroughputPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ThroughputPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pools_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pools_operations.py new file mode 100644 index 000000000000..f48b17d2bf1f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_throughput_pools_operations.py @@ -0,0 +1,215 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, 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 +from ...operations._throughput_pools_operations import build_list_by_resource_group_request, build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ThroughputPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`throughput_pools` attribute. + """ + + models = _models + + 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.ThroughputPoolResource"]: + """Lists all the Azure Cosmos DB Throughput Pools available under the subscription. + + :return: An iterator like instance of either ThroughputPoolResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ThroughputPoolResource"]: + """List all the ThroughputPools in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ThroughputPoolResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) 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 ec1965a08595..9458f8878acd 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 @@ -5,345 +5,447 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import ARMProxyResource -from ._models_py3 import ARMResourceProperties -from ._models_py3 import AccountKeyMetadata -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 BackupInformation -from ._models_py3 import BackupPolicy -from ._models_py3 import BackupPolicyMigrationState -from ._models_py3 import Capability -from ._models_py3 import Capacity -from ._models_py3 import CassandraClusterDataCenterNodeItem -from ._models_py3 import CassandraClusterPublicStatus -from ._models_py3 import CassandraClusterPublicStatusDataCentersItem -from ._models_py3 import CassandraError -from ._models_py3 import CassandraKeyspaceCreateUpdateParameters -from ._models_py3 import CassandraKeyspaceGetPropertiesOptions -from ._models_py3 import CassandraKeyspaceGetPropertiesResource -from ._models_py3 import CassandraKeyspaceGetResults -from ._models_py3 import CassandraKeyspaceListResult -from ._models_py3 import CassandraKeyspaceResource -from ._models_py3 import CassandraPartitionKey -from ._models_py3 import CassandraSchema -from ._models_py3 import CassandraTableCreateUpdateParameters -from ._models_py3 import CassandraTableGetPropertiesOptions -from ._models_py3 import CassandraTableGetPropertiesResource -from ._models_py3 import CassandraTableGetResults -from ._models_py3 import CassandraTableListResult -from ._models_py3 import CassandraTableResource -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 -from ._models_py3 import Column -from ._models_py3 import CommandOutput -from ._models_py3 import CommandPostBody -from ._models_py3 import CompositePath -from ._models_py3 import ComputedProperty -from ._models_py3 import ConflictResolutionPolicy -from ._models_py3 import ConnectionError -from ._models_py3 import ConsistencyPolicy -from ._models_py3 import ContainerPartitionKey -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 CreateUpdateOptions -from ._models_py3 import DataCenterResource -from ._models_py3 import DataCenterResourceProperties -from ._models_py3 import DataTransferRegionalServiceResource -from ._models_py3 import DataTransferServiceResource -from ._models_py3 import DataTransferServiceResourceCreateUpdateProperties -from ._models_py3 import DataTransferServiceResourceProperties -from ._models_py3 import DatabaseAccountConnectionString -from ._models_py3 import DatabaseAccountCreateUpdateParameters -from ._models_py3 import DatabaseAccountGetResults -from ._models_py3 import DatabaseAccountKeysMetadata -from ._models_py3 import DatabaseAccountListConnectionStringsResult -from ._models_py3 import DatabaseAccountListKeysResult -from ._models_py3 import DatabaseAccountListReadOnlyKeysResult -from ._models_py3 import DatabaseAccountRegenerateKeyParameters -from ._models_py3 import DatabaseAccountUpdateParameters -from ._models_py3 import DatabaseAccountsListResult -from ._models_py3 import DatabaseRestoreResource -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ErrorResponseAutoGenerated -from ._models_py3 import ExcludedPath -from ._models_py3 import ExtendedResourceProperties -from ._models_py3 import FailoverPolicies -from ._models_py3 import FailoverPolicy -from ._models_py3 import GraphAPIComputeRegionalServiceResource -from ._models_py3 import GraphAPIComputeServiceResource -from ._models_py3 import GraphAPIComputeServiceResourceCreateUpdateProperties -from ._models_py3 import GraphAPIComputeServiceResourceProperties -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 -from ._models_py3 import GremlinGraphGetResults -from ._models_py3 import GremlinGraphListResult -from ._models_py3 import GremlinGraphResource -from ._models_py3 import IncludedPath -from ._models_py3 import Indexes -from ._models_py3 import IndexingPolicy -from ._models_py3 import IpAddressOrRange -from ._models_py3 import KeyWrapMetadata -from ._models_py3 import ListClusters -from ._models_py3 import ListDataCenters -from ._models_py3 import Location -from ._models_py3 import LocationGetResult -from ._models_py3 import LocationListResult -from ._models_py3 import LocationProperties -from ._models_py3 import ManagedCassandraARMResourceProperties -from ._models_py3 import ManagedCassandraManagedServiceIdentity -from ._models_py3 import ManagedCassandraReaperStatus -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import ManagedServiceIdentityUserAssignedIdentity -from ._models_py3 import MaterializedViewsBuilderRegionalServiceResource -from ._models_py3 import MaterializedViewsBuilderServiceResource -from ._models_py3 import MaterializedViewsBuilderServiceResourceCreateUpdateProperties -from ._models_py3 import MaterializedViewsBuilderServiceResourceProperties -from ._models_py3 import Metric -from ._models_py3 import MetricAvailability -from ._models_py3 import MetricDefinition -from ._models_py3 import MetricDefinitionsListResult -from ._models_py3 import MetricListResult -from ._models_py3 import MetricName -from ._models_py3 import MetricValue -from ._models_py3 import MongoDBCollectionCreateUpdateParameters -from ._models_py3 import MongoDBCollectionGetPropertiesOptions -from ._models_py3 import MongoDBCollectionGetPropertiesResource -from ._models_py3 import MongoDBCollectionGetResults -from ._models_py3 import MongoDBCollectionListResult -from ._models_py3 import MongoDBCollectionResource -from ._models_py3 import MongoDBDatabaseCreateUpdateParameters -from ._models_py3 import MongoDBDatabaseGetPropertiesOptions -from ._models_py3 import MongoDBDatabaseGetPropertiesResource -from ._models_py3 import MongoDBDatabaseGetResults -from ._models_py3 import MongoDBDatabaseListResult -from ._models_py3 import MongoDBDatabaseResource -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 -from ._models_py3 import NotebookWorkspaceListResult -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OptionsResource -from ._models_py3 import PartitionMetric -from ._models_py3 import PartitionMetricListResult -from ._models_py3 import PartitionUsage -from ._models_py3 import PartitionUsagesResult -from ._models_py3 import PercentileMetric -from ._models_py3 import PercentileMetricListResult -from ._models_py3 import PercentileMetricValue -from ._models_py3 import PeriodicModeBackupPolicy -from ._models_py3 import PeriodicModeProperties -from ._models_py3 import Permission -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 RegionForOnlineOffline -from ._models_py3 import RegionalServiceResource -from ._models_py3 import Resource -from ._models_py3 import ResourceRestoreParameters -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 RestorableGremlinResourcesGetResult -from ._models_py3 import RestorableGremlinResourcesListResult -from ._models_py3 import RestorableLocationResource -from ._models_py3 import RestorableMongodbCollectionGetResult -from ._models_py3 import RestorableMongodbCollectionPropertiesResource -from ._models_py3 import RestorableMongodbCollectionsListResult -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 -from ._models_py3 import RestorableSqlContainerPropertiesResourceContainer -from ._models_py3 import RestorableSqlContainersListResult -from ._models_py3 import RestorableSqlDatabaseGetResult -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 RestorableTableResourcesGetResult -from ._models_py3 import RestorableTableResourcesListResult -from ._models_py3 import RestorableTablesListResult -from ._models_py3 import RestoreParameters -from ._models_py3 import RestoreParametersBase -from ._models_py3 import Role -from ._models_py3 import SeedNode -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceCreateUpdateParameters -from ._models_py3 import ServiceResourceCreateUpdateProperties -from ._models_py3 import ServiceResourceListResult -from ._models_py3 import ServiceResourceProperties -from ._models_py3 import SpatialSpec -from ._models_py3 import SqlContainerCreateUpdateParameters -from ._models_py3 import SqlContainerGetPropertiesOptions -from ._models_py3 import SqlContainerGetPropertiesResource -from ._models_py3 import SqlContainerGetResults -from ._models_py3 import SqlContainerListResult -from ._models_py3 import SqlContainerResource -from ._models_py3 import SqlDatabaseCreateUpdateParameters -from ._models_py3 import SqlDatabaseGetPropertiesOptions -from ._models_py3 import SqlDatabaseGetPropertiesResource -from ._models_py3 import SqlDatabaseGetResults -from ._models_py3 import SqlDatabaseListResult -from ._models_py3 import SqlDatabaseResource -from ._models_py3 import SqlDedicatedGatewayRegionalServiceResource -from ._models_py3 import SqlDedicatedGatewayServiceResource -from ._models_py3 import SqlDedicatedGatewayServiceResourceCreateUpdateProperties -from ._models_py3 import SqlDedicatedGatewayServiceResourceProperties -from ._models_py3 import SqlRoleAssignmentCreateUpdateParameters -from ._models_py3 import SqlRoleAssignmentGetResults -from ._models_py3 import SqlRoleAssignmentListResult -from ._models_py3 import SqlRoleDefinitionCreateUpdateParameters -from ._models_py3 import SqlRoleDefinitionGetResults -from ._models_py3 import SqlRoleDefinitionListResult -from ._models_py3 import SqlStoredProcedureCreateUpdateParameters -from ._models_py3 import SqlStoredProcedureGetPropertiesResource -from ._models_py3 import SqlStoredProcedureGetResults -from ._models_py3 import SqlStoredProcedureListResult -from ._models_py3 import SqlStoredProcedureResource -from ._models_py3 import SqlTriggerCreateUpdateParameters -from ._models_py3 import SqlTriggerGetPropertiesResource -from ._models_py3 import SqlTriggerGetResults -from ._models_py3 import SqlTriggerListResult -from ._models_py3 import SqlTriggerResource -from ._models_py3 import SqlUserDefinedFunctionCreateUpdateParameters -from ._models_py3 import SqlUserDefinedFunctionGetPropertiesResource -from ._models_py3 import SqlUserDefinedFunctionGetResults -from ._models_py3 import SqlUserDefinedFunctionListResult -from ._models_py3 import SqlUserDefinedFunctionResource -from ._models_py3 import SystemData -from ._models_py3 import TableCreateUpdateParameters -from ._models_py3 import TableGetPropertiesOptions -from ._models_py3 import TableGetPropertiesResource -from ._models_py3 import TableGetResults -from ._models_py3 import TableListResult -from ._models_py3 import TableResource -from ._models_py3 import ThroughputPolicyResource -from ._models_py3 import ThroughputSettingsGetPropertiesResource -from ._models_py3 import ThroughputSettingsGetResults -from ._models_py3 import ThroughputSettingsResource -from ._models_py3 import ThroughputSettingsUpdateParameters -from ._models_py3 import UniqueKey -from ._models_py3 import UniqueKeyPolicy -from ._models_py3 import Usage -from ._models_py3 import UsagesResult -from ._models_py3 import VectorEmbedding -from ._models_py3 import VectorEmbeddingPolicy -from ._models_py3 import VectorIndex -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._cosmos_db_management_client_enums import AnalyticalStorageSchemaType -from ._cosmos_db_management_client_enums import ApiType -from ._cosmos_db_management_client_enums import AuthenticationMethod -from ._cosmos_db_management_client_enums import AzureConnectionType -from ._cosmos_db_management_client_enums import BackupPolicyMigrationStatus -from ._cosmos_db_management_client_enums import BackupPolicyType -from ._cosmos_db_management_client_enums import BackupStorageRedundancy -from ._cosmos_db_management_client_enums import CompositePathSortOrder -from ._cosmos_db_management_client_enums import ConflictResolutionMode -from ._cosmos_db_management_client_enums import ConnectionState -from ._cosmos_db_management_client_enums import ConnectorOffer -from ._cosmos_db_management_client_enums import ContinuousTier -from ._cosmos_db_management_client_enums import CreateMode -from ._cosmos_db_management_client_enums import CreatedByType -from ._cosmos_db_management_client_enums import DataType -from ._cosmos_db_management_client_enums import DatabaseAccountKind -from ._cosmos_db_management_client_enums import DedicatedGatewayType -from ._cosmos_db_management_client_enums import DefaultConsistencyLevel -from ._cosmos_db_management_client_enums import DistanceFunction -from ._cosmos_db_management_client_enums import IndexKind -from ._cosmos_db_management_client_enums import IndexingMode -from ._cosmos_db_management_client_enums import KeyKind -from ._cosmos_db_management_client_enums import Kind -from ._cosmos_db_management_client_enums import ManagedCassandraProvisioningState -from ._cosmos_db_management_client_enums import ManagedCassandraResourceIdentityType -from ._cosmos_db_management_client_enums import MinimalTlsVersion -from ._cosmos_db_management_client_enums import MongoRoleDefinitionType -from ._cosmos_db_management_client_enums import NetworkAclBypass -from ._cosmos_db_management_client_enums import NodeState -from ._cosmos_db_management_client_enums import NodeStatus -from ._cosmos_db_management_client_enums import NotebookWorkspaceName -from ._cosmos_db_management_client_enums import OperationType -from ._cosmos_db_management_client_enums import PartitionKind -from ._cosmos_db_management_client_enums import PrimaryAggregationType -from ._cosmos_db_management_client_enums import PublicNetworkAccess -from ._cosmos_db_management_client_enums import ResourceIdentityType -from ._cosmos_db_management_client_enums import RestoreMode -from ._cosmos_db_management_client_enums import RoleDefinitionType -from ._cosmos_db_management_client_enums import ServerVersion -from ._cosmos_db_management_client_enums import ServiceSize -from ._cosmos_db_management_client_enums import ServiceStatus -from ._cosmos_db_management_client_enums import ServiceType -from ._cosmos_db_management_client_enums import SpatialType -from ._cosmos_db_management_client_enums import Status -from ._cosmos_db_management_client_enums import TriggerOperation -from ._cosmos_db_management_client_enums import TriggerType -from ._cosmos_db_management_client_enums import Type -from ._cosmos_db_management_client_enums import UnitType -from ._cosmos_db_management_client_enums import VectorDataType -from ._cosmos_db_management_client_enums import VectorIndexType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ARMProxyResource, + ARMResourceProperties, + AccessRule, + AccessRuleProperties, + AccessRulePropertiesSubscriptionsItem, + AccountKeyMetadata, + AnalyticalStorageConfiguration, + ApiProperties, + AuthenticationMethodLdapProperties, + AutoUpgradePolicyResource, + AutoscaleSettings, + AutoscaleSettingsResource, + AzureBlobDataTransferDataSourceSink, + BackupInformation, + BackupPolicy, + BackupPolicyMigrationState, + BackupResource, + BackupSchedule, + BaseCosmosDataTransferDataSourceSink, + Capability, + Capacity, + CapacityModeChangeTransitionState, + CassandraClusterDataCenterNodeItem, + CassandraClusterPublicStatus, + CassandraClusterPublicStatusDataCentersItem, + CassandraError, + CassandraKeyspaceCreateUpdateParameters, + CassandraKeyspaceGetPropertiesOptions, + CassandraKeyspaceGetPropertiesResource, + CassandraKeyspaceGetResults, + CassandraKeyspaceListResult, + CassandraKeyspaceResource, + CassandraPartitionKey, + CassandraSchema, + CassandraTableCreateUpdateParameters, + CassandraTableGetPropertiesOptions, + CassandraTableGetPropertiesResource, + CassandraTableGetResults, + CassandraTableListResult, + CassandraTableResource, + CassandraViewCreateUpdateParameters, + CassandraViewGetPropertiesOptions, + CassandraViewGetPropertiesResource, + CassandraViewGetResults, + CassandraViewListResult, + CassandraViewResource, + Certificate, + ChaosFaultListResponse, + ChaosFaultResource, + ClientEncryptionIncludedPath, + ClientEncryptionKeyCreateUpdateParameters, + ClientEncryptionKeyGetPropertiesResource, + ClientEncryptionKeyGetResults, + ClientEncryptionKeyResource, + ClientEncryptionKeysListResult, + ClientEncryptionPolicy, + ClusterKey, + ClusterResource, + ClusterResourceProperties, + Column, + CommandAsyncPostBody, + CommandOutput, + CommandPostBody, + CommandPublicResource, + CompositePath, + ComputedProperty, + ConflictResolutionPolicy, + ConnectionError, + ConsistencyPolicy, + ContainerPartitionKey, + ContinuousBackupInformation, + ContinuousBackupRestoreLocation, + ContinuousModeBackupPolicy, + ContinuousModeProperties, + CorsPolicy, + CosmosCassandraDataTransferDataSourceSink, + CosmosMongoDataTransferDataSourceSink, + CosmosMongoVCoreDataTransferDataSourceSink, + CosmosSqlDataTransferDataSourceSink, + CreateJobRequest, + CreateUpdateOptions, + DataCenterResource, + DataCenterResourceProperties, + DataTransferDataSourceSink, + DataTransferJobFeedResults, + DataTransferJobGetResults, + DataTransferJobProperties, + DataTransferRegionalServiceResource, + DataTransferServiceResource, + DataTransferServiceResourceCreateUpdateProperties, + DataTransferServiceResourceProperties, + DatabaseAccountConnectionString, + DatabaseAccountCreateUpdateParameters, + DatabaseAccountGetResults, + DatabaseAccountKeysMetadata, + DatabaseAccountListConnectionStringsResult, + DatabaseAccountListKeysResult, + DatabaseAccountListReadOnlyKeysResult, + DatabaseAccountRegenerateKeyParameters, + DatabaseAccountUpdateParameters, + DatabaseAccountsListResult, + DatabaseRestoreResource, + DiagnosticLogSettings, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ErrorResponseAutoGenerated, + ExcludedPath, + ExtendedResourceProperties, + FailoverPolicies, + FailoverPolicy, + GraphAPIComputeRegionalServiceResource, + GraphAPIComputeServiceResource, + GraphAPIComputeServiceResourceCreateUpdateProperties, + GraphAPIComputeServiceResourceProperties, + GraphResource, + GraphResourceCreateUpdateParameters, + GraphResourceGetPropertiesOptions, + GraphResourceGetPropertiesResource, + GraphResourceGetResults, + GraphResourcesListResult, + GremlinDatabaseCreateUpdateParameters, + GremlinDatabaseGetPropertiesOptions, + GremlinDatabaseGetPropertiesResource, + GremlinDatabaseGetResults, + GremlinDatabaseListResult, + GremlinDatabaseResource, + GremlinDatabaseRestoreResource, + GremlinGraphCreateUpdateParameters, + GremlinGraphGetPropertiesOptions, + GremlinGraphGetPropertiesResource, + GremlinGraphGetResults, + GremlinGraphListResult, + GremlinGraphResource, + IncludedPath, + Indexes, + IndexingPolicy, + IpAddressOrRange, + KeyWrapMetadata, + ListBackups, + ListClusters, + ListCommands, + ListDataCenters, + Location, + LocationGetResult, + LocationListResult, + LocationProperties, + ManagedCassandraARMResourceProperties, + ManagedCassandraManagedServiceIdentity, + ManagedCassandraReaperStatus, + ManagedServiceIdentity, + ManagedServiceIdentityUserAssignedIdentity, + MaterializedViewDefinition, + MaterializedViewsBuilderRegionalServiceResource, + MaterializedViewsBuilderServiceResource, + MaterializedViewsBuilderServiceResourceCreateUpdateProperties, + MaterializedViewsBuilderServiceResourceProperties, + MergeParameters, + Metric, + MetricAvailability, + MetricDefinition, + MetricDefinitionsListResult, + MetricListResult, + MetricName, + MetricValue, + MongoDBCollectionCreateUpdateParameters, + MongoDBCollectionGetPropertiesOptions, + MongoDBCollectionGetPropertiesResource, + MongoDBCollectionGetResults, + MongoDBCollectionListResult, + MongoDBCollectionResource, + MongoDBDatabaseCreateUpdateParameters, + MongoDBDatabaseGetPropertiesOptions, + MongoDBDatabaseGetPropertiesResource, + MongoDBDatabaseGetResults, + MongoDBDatabaseListResult, + MongoDBDatabaseResource, + MongoIndex, + MongoIndexKeys, + MongoIndexOptions, + MongoRoleDefinitionCreateUpdateParameters, + MongoRoleDefinitionGetResults, + MongoRoleDefinitionListResult, + MongoUserDefinitionCreateUpdateParameters, + MongoUserDefinitionGetResults, + MongoUserDefinitionListResult, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationListResult, + NetworkSecurityPerimeterConfigurationProperties, + NetworkSecurityProfile, + NotebookWorkspace, + NotebookWorkspaceConnectionInfoResult, + NotebookWorkspaceCreateUpdateParameters, + NotebookWorkspaceListResult, + Operation, + OperationDisplay, + OperationListResult, + OptionsResource, + PartitionMetric, + PartitionMetricListResult, + PartitionUsage, + PartitionUsagesResult, + PercentileMetric, + PercentileMetricListResult, + PercentileMetricValue, + PeriodicModeBackupPolicy, + PeriodicModeProperties, + Permission, + PermissionAutoGenerated, + PhysicalPartitionId, + PhysicalPartitionStorageInfo, + PhysicalPartitionStorageInfoCollection, + PhysicalPartitionThroughputInfoProperties, + PhysicalPartitionThroughputInfoResource, + PhysicalPartitionThroughputInfoResult, + PhysicalPartitionThroughputInfoResultPropertiesResource, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateEndpointProperty, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionStateProperty, + Privilege, + PrivilegeResource, + ProvisioningIssue, + ProvisioningIssueProperties, + ProxyResource, + RedistributeThroughputParameters, + RedistributeThroughputPropertiesResource, + RegionForOnlineOffline, + RegionalServiceResource, + Resource, + ResourceAssociation, + ResourceRestoreParameters, + RestorableDatabaseAccountGetResult, + RestorableDatabaseAccountsListResult, + RestorableGremlinDatabaseGetResult, + RestorableGremlinDatabasePropertiesResource, + RestorableGremlinDatabasesListResult, + RestorableGremlinGraphGetResult, + RestorableGremlinGraphPropertiesResource, + RestorableGremlinGraphsListResult, + RestorableGremlinResourcesGetResult, + RestorableGremlinResourcesListResult, + RestorableLocationResource, + RestorableMongodbCollectionGetResult, + RestorableMongodbCollectionPropertiesResource, + RestorableMongodbCollectionsListResult, + RestorableMongodbDatabaseGetResult, + RestorableMongodbDatabasePropertiesResource, + RestorableMongodbDatabasesListResult, + RestorableMongodbResourcesGetResult, + RestorableMongodbResourcesListResult, + RestorableSqlContainerGetResult, + RestorableSqlContainerPropertiesResource, + RestorableSqlContainerPropertiesResourceContainer, + RestorableSqlContainersListResult, + RestorableSqlDatabaseGetResult, + RestorableSqlDatabasePropertiesResource, + RestorableSqlDatabasePropertiesResourceDatabase, + RestorableSqlDatabasesListResult, + RestorableSqlResourcesGetResult, + RestorableSqlResourcesListResult, + RestorableTableGetResult, + RestorableTablePropertiesResource, + RestorableTableResourcesGetResult, + RestorableTableResourcesListResult, + RestorableTablesListResult, + RestoreParameters, + RestoreParametersBase, + RetrieveThroughputParameters, + RetrieveThroughputPropertiesResource, + Role, + SeedNode, + ServiceResource, + ServiceResourceCreateUpdateParameters, + ServiceResourceCreateUpdateProperties, + ServiceResourceListResult, + ServiceResourceProperties, + SpatialSpec, + SqlContainerCreateUpdateParameters, + SqlContainerGetPropertiesOptions, + SqlContainerGetPropertiesResource, + SqlContainerGetResults, + SqlContainerListResult, + SqlContainerResource, + SqlDatabaseCreateUpdateParameters, + SqlDatabaseGetPropertiesOptions, + SqlDatabaseGetPropertiesResource, + SqlDatabaseGetResults, + SqlDatabaseListResult, + SqlDatabaseResource, + SqlDedicatedGatewayRegionalServiceResource, + SqlDedicatedGatewayServiceResource, + SqlDedicatedGatewayServiceResourceCreateUpdateProperties, + SqlDedicatedGatewayServiceResourceProperties, + SqlRoleAssignmentCreateUpdateParameters, + SqlRoleAssignmentGetResults, + SqlRoleAssignmentListResult, + SqlRoleDefinitionCreateUpdateParameters, + SqlRoleDefinitionGetResults, + SqlRoleDefinitionListResult, + SqlStoredProcedureCreateUpdateParameters, + SqlStoredProcedureGetPropertiesResource, + SqlStoredProcedureGetResults, + SqlStoredProcedureListResult, + SqlStoredProcedureResource, + SqlTriggerCreateUpdateParameters, + SqlTriggerGetPropertiesResource, + SqlTriggerGetResults, + SqlTriggerListResult, + SqlTriggerResource, + SqlUserDefinedFunctionCreateUpdateParameters, + SqlUserDefinedFunctionGetPropertiesResource, + SqlUserDefinedFunctionGetResults, + SqlUserDefinedFunctionListResult, + SqlUserDefinedFunctionResource, + SystemData, + TableCreateUpdateParameters, + TableGetPropertiesOptions, + TableGetPropertiesResource, + TableGetResults, + TableListResult, + TableResource, + TableRoleAssignmentListResult, + TableRoleAssignmentResource, + TableRoleDefinitionListResult, + TableRoleDefinitionResource, + ThroughputBucketResource, + ThroughputPolicyResource, + ThroughputPoolAccountCreateParameters, + ThroughputPoolAccountResource, + ThroughputPoolAccountsListResult, + ThroughputPoolResource, + ThroughputPoolUpdate, + ThroughputPoolsListResult, + ThroughputSettingsGetPropertiesResource, + ThroughputSettingsGetResults, + ThroughputSettingsResource, + ThroughputSettingsUpdateParameters, + TrackedResource, + UniqueKey, + UniqueKeyPolicy, + Usage, + UsagesResult, + VectorEmbedding, + VectorEmbeddingPolicy, + VectorIndex, + VirtualNetworkRule, +) + +from ._cosmos_db_management_client_enums import ( # type: ignore + AccessRuleDirection, + AnalyticalStorageSchemaType, + ApiType, + AuthenticationMethod, + AutoReplicate, + AzureConnectionType, + BackupPolicyMigrationStatus, + BackupPolicyType, + BackupState, + BackupStorageRedundancy, + CapacityMode, + CapacityModeTransitionStatus, + ClusterType, + CommandStatus, + CompositePathSortOrder, + ConflictResolutionMode, + ConnectionState, + ConnectorOffer, + ContinuousTier, + CreateMode, + CreatedByType, + DataTransferComponent, + DataTransferJobMode, + DataType, + DatabaseAccountKind, + DedicatedGatewayType, + DefaultConsistencyLevel, + DefaultPriorityLevel, + DistanceFunction, + EnableFullTextQuery, + IndexKind, + IndexingMode, + IssueType, + KeyKind, + Kind, + ManagedCassandraProvisioningState, + ManagedCassandraResourceIdentityType, + MinimalTlsVersion, + MongoRoleDefinitionType, + NetworkAclBypass, + NetworkSecurityPerimeterConfigurationProvisioningState, + NodeState, + NodeStatus, + NotebookWorkspaceName, + OperationType, + PartitionKind, + PrimaryAggregationType, + PublicNetworkAccess, + ResourceAssociationAccessMode, + ResourceIdentityType, + RestoreMode, + RoleDefinitionType, + ScheduledEventStrategy, + ServerVersion, + ServiceSize, + ServiceStatus, + ServiceType, + Severity, + SpatialType, + Status, + SupportedActions, + ThroughputPolicyType, + TriggerOperation, + TriggerType, + Type, + UnitType, + VectorDataType, + VectorIndexType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "ARMProxyResource", "ARMResourceProperties", + "AccessRule", + "AccessRuleProperties", + "AccessRulePropertiesSubscriptionsItem", "AccountKeyMetadata", "AnalyticalStorageConfiguration", "ApiProperties", @@ -351,11 +453,16 @@ "AutoUpgradePolicyResource", "AutoscaleSettings", "AutoscaleSettingsResource", + "AzureBlobDataTransferDataSourceSink", "BackupInformation", "BackupPolicy", "BackupPolicyMigrationState", + "BackupResource", + "BackupSchedule", + "BaseCosmosDataTransferDataSourceSink", "Capability", "Capacity", + "CapacityModeChangeTransitionState", "CassandraClusterDataCenterNodeItem", "CassandraClusterPublicStatus", "CassandraClusterPublicStatusDataCentersItem", @@ -374,7 +481,15 @@ "CassandraTableGetResults", "CassandraTableListResult", "CassandraTableResource", + "CassandraViewCreateUpdateParameters", + "CassandraViewGetPropertiesOptions", + "CassandraViewGetPropertiesResource", + "CassandraViewGetResults", + "CassandraViewListResult", + "CassandraViewResource", "Certificate", + "ChaosFaultListResponse", + "ChaosFaultResource", "ClientEncryptionIncludedPath", "ClientEncryptionKeyCreateUpdateParameters", "ClientEncryptionKeyGetPropertiesResource", @@ -386,8 +501,10 @@ "ClusterResource", "ClusterResourceProperties", "Column", + "CommandAsyncPostBody", "CommandOutput", "CommandPostBody", + "CommandPublicResource", "CompositePath", "ComputedProperty", "ConflictResolutionPolicy", @@ -399,9 +516,18 @@ "ContinuousModeBackupPolicy", "ContinuousModeProperties", "CorsPolicy", + "CosmosCassandraDataTransferDataSourceSink", + "CosmosMongoDataTransferDataSourceSink", + "CosmosMongoVCoreDataTransferDataSourceSink", + "CosmosSqlDataTransferDataSourceSink", + "CreateJobRequest", "CreateUpdateOptions", "DataCenterResource", "DataCenterResourceProperties", + "DataTransferDataSourceSink", + "DataTransferJobFeedResults", + "DataTransferJobGetResults", + "DataTransferJobProperties", "DataTransferRegionalServiceResource", "DataTransferServiceResource", "DataTransferServiceResourceCreateUpdateProperties", @@ -417,6 +543,7 @@ "DatabaseAccountUpdateParameters", "DatabaseAccountsListResult", "DatabaseRestoreResource", + "DiagnosticLogSettings", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -429,6 +556,12 @@ "GraphAPIComputeServiceResource", "GraphAPIComputeServiceResourceCreateUpdateProperties", "GraphAPIComputeServiceResourceProperties", + "GraphResource", + "GraphResourceCreateUpdateParameters", + "GraphResourceGetPropertiesOptions", + "GraphResourceGetPropertiesResource", + "GraphResourceGetResults", + "GraphResourcesListResult", "GremlinDatabaseCreateUpdateParameters", "GremlinDatabaseGetPropertiesOptions", "GremlinDatabaseGetPropertiesResource", @@ -447,7 +580,9 @@ "IndexingPolicy", "IpAddressOrRange", "KeyWrapMetadata", + "ListBackups", "ListClusters", + "ListCommands", "ListDataCenters", "Location", "LocationGetResult", @@ -458,10 +593,12 @@ "ManagedCassandraReaperStatus", "ManagedServiceIdentity", "ManagedServiceIdentityUserAssignedIdentity", + "MaterializedViewDefinition", "MaterializedViewsBuilderRegionalServiceResource", "MaterializedViewsBuilderServiceResource", "MaterializedViewsBuilderServiceResourceCreateUpdateProperties", "MaterializedViewsBuilderServiceResourceProperties", + "MergeParameters", "Metric", "MetricAvailability", "MetricDefinition", @@ -490,6 +627,11 @@ "MongoUserDefinitionCreateUpdateParameters", "MongoUserDefinitionGetResults", "MongoUserDefinitionListResult", + "NetworkSecurityPerimeter", + "NetworkSecurityPerimeterConfiguration", + "NetworkSecurityPerimeterConfigurationListResult", + "NetworkSecurityPerimeterConfigurationProperties", + "NetworkSecurityProfile", "NotebookWorkspace", "NotebookWorkspaceConnectionInfoResult", "NotebookWorkspaceCreateUpdateParameters", @@ -508,6 +650,14 @@ "PeriodicModeBackupPolicy", "PeriodicModeProperties", "Permission", + "PermissionAutoGenerated", + "PhysicalPartitionId", + "PhysicalPartitionStorageInfo", + "PhysicalPartitionStorageInfoCollection", + "PhysicalPartitionThroughputInfoProperties", + "PhysicalPartitionThroughputInfoResource", + "PhysicalPartitionThroughputInfoResult", + "PhysicalPartitionThroughputInfoResultPropertiesResource", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", "PrivateEndpointProperty", @@ -516,10 +666,15 @@ "PrivateLinkServiceConnectionStateProperty", "Privilege", "PrivilegeResource", + "ProvisioningIssue", + "ProvisioningIssueProperties", "ProxyResource", + "RedistributeThroughputParameters", + "RedistributeThroughputPropertiesResource", "RegionForOnlineOffline", "RegionalServiceResource", "Resource", + "ResourceAssociation", "ResourceRestoreParameters", "RestorableDatabaseAccountGetResult", "RestorableDatabaseAccountsListResult", @@ -557,6 +712,8 @@ "RestorableTablesListResult", "RestoreParameters", "RestoreParametersBase", + "RetrieveThroughputParameters", + "RetrieveThroughputPropertiesResource", "Role", "SeedNode", "ServiceResource", @@ -609,11 +766,23 @@ "TableGetResults", "TableListResult", "TableResource", + "TableRoleAssignmentListResult", + "TableRoleAssignmentResource", + "TableRoleDefinitionListResult", + "TableRoleDefinitionResource", + "ThroughputBucketResource", "ThroughputPolicyResource", + "ThroughputPoolAccountCreateParameters", + "ThroughputPoolAccountResource", + "ThroughputPoolAccountsListResult", + "ThroughputPoolResource", + "ThroughputPoolUpdate", + "ThroughputPoolsListResult", "ThroughputSettingsGetPropertiesResource", "ThroughputSettingsGetResults", "ThroughputSettingsResource", "ThroughputSettingsUpdateParameters", + "TrackedResource", "UniqueKey", "UniqueKeyPolicy", "Usage", @@ -622,13 +791,20 @@ "VectorEmbeddingPolicy", "VectorIndex", "VirtualNetworkRule", + "AccessRuleDirection", "AnalyticalStorageSchemaType", "ApiType", "AuthenticationMethod", + "AutoReplicate", "AzureConnectionType", "BackupPolicyMigrationStatus", "BackupPolicyType", + "BackupState", "BackupStorageRedundancy", + "CapacityMode", + "CapacityModeTransitionStatus", + "ClusterType", + "CommandStatus", "CompositePathSortOrder", "ConflictResolutionMode", "ConnectionState", @@ -636,13 +812,18 @@ "ContinuousTier", "CreateMode", "CreatedByType", + "DataTransferComponent", + "DataTransferJobMode", "DataType", "DatabaseAccountKind", "DedicatedGatewayType", "DefaultConsistencyLevel", + "DefaultPriorityLevel", "DistanceFunction", + "EnableFullTextQuery", "IndexKind", "IndexingMode", + "IssueType", "KeyKind", "Kind", "ManagedCassandraProvisioningState", @@ -650,6 +831,7 @@ "MinimalTlsVersion", "MongoRoleDefinitionType", "NetworkAclBypass", + "NetworkSecurityPerimeterConfigurationProvisioningState", "NodeState", "NodeStatus", "NotebookWorkspaceName", @@ -657,15 +839,20 @@ "PartitionKind", "PrimaryAggregationType", "PublicNetworkAccess", + "ResourceAssociationAccessMode", "ResourceIdentityType", "RestoreMode", "RoleDefinitionType", + "ScheduledEventStrategy", "ServerVersion", "ServiceSize", "ServiceStatus", "ServiceType", + "Severity", "SpatialType", "Status", + "SupportedActions", + "ThroughputPolicyType", "TriggerOperation", "TriggerType", "Type", @@ -673,5 +860,5 @@ "VectorDataType", "VectorIndexType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 6e70c1ff4084..6ff671c725ba 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 @@ -10,6 +10,15 @@ from azure.core import CaseInsensitiveEnumMeta +class AccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction of Access Rule.""" + + INBOUND = "Inbound" + """Applies to inbound network traffic to the secured resources.""" + OUTBOUND = "Outbound" + """Applies to outbound network traffic from the secured resources""" + + class AnalyticalStorageSchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the types of schema for analytical storage.""" @@ -39,6 +48,14 @@ class AuthenticationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): LDAP = "Ldap" +class AutoReplicate(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The form of AutoReplicate that is being used by this cluster.""" + + NONE = "None" + SYSTEM_KEYSPACES = "SystemKeyspaces" + ALL_KEYSPACES = "AllKeyspaces" + + class AzureConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """How to connect to the azure services needed for running the cluster.""" @@ -62,6 +79,15 @@ class BackupPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTINUOUS = "Continuous" +class BackupState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the backup.""" + + INITIATED = "Initiated" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate type of backup storage redundancy.""" @@ -70,6 +96,42 @@ class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZONE = "Zone" +class CapacityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the capacity mode of the account.""" + + NONE = "None" + PROVISIONED = "Provisioned" + SERVERLESS = "Serverless" + + +class CapacityModeTransitionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The transition status of capacity mode.""" + + INVALID = "Invalid" + INITIALIZED = "Initialized" + IN_PROGRESS = "InProgress" + COMPLETED = "Completed" + FAILED = "Failed" + + +class ClusterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the cluster. If set to Production, some operations might not be permitted on cluster.""" + + PRODUCTION = "Production" + NON_PRODUCTION = "NonProduction" + + +class CommandStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the command.""" + + DONE = "Done" + RUNNING = "Running" + ENQUEUE = "Enqueue" + PROCESSING = "Processing" + FINISHED = "Finished" + FAILED = "Failed" + + class CompositePathSortOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sort order for composite paths.""" @@ -132,6 +194,23 @@ class DatabaseAccountKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): PARSE = "Parse" +class DataTransferComponent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataTransferComponent.""" + + COSMOS_DB_CASSANDRA = "CosmosDBCassandra" + COSMOS_DB_MONGO = "CosmosDBMongo" + COSMOS_DB_MONGO_V_CORE = "CosmosDBMongoVCore" + COSMOS_DB_SQL = "CosmosDBSql" + AZURE_BLOB_STORAGE = "AzureBlobStorage" + + +class DataTransferJobMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mode of job execution.""" + + OFFLINE = "Offline" + ONLINE = "Online" + + class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The datatype for which the indexing behavior is applied to.""" @@ -160,6 +239,13 @@ class DefaultConsistencyLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONSISTENT_PREFIX = "ConsistentPrefix" +class DefaultPriorityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to indicate default priorityLevel of requests.""" + + HIGH = "High" + LOW = "Low" + + class DistanceFunction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The distance function to use for distance calculation in between vectors.""" @@ -168,6 +254,14 @@ class DistanceFunction(str, Enum, metaclass=CaseInsensitiveEnumMeta): DOTPRODUCT = "dotproduct" +class EnableFullTextQuery(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describe the level of detail with which queries are to be logged.""" + + NONE = "None" + TRUE = "True" + FALSE = "False" + + class IndexingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the indexing mode.""" @@ -184,6 +278,22 @@ class IndexKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): SPATIAL = "Spatial" +class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of issue.""" + + UNKNOWN = "Unknown" + """Unknown issue type""" + CONFIGURATION_PROPAGATION_FAILURE = "ConfigurationPropagationFailure" + """An error occurred while applying the network security perimeter (NSP) configuration.""" + MISSING_PERIMETER_CONFIGURATION = "MissingPerimeterConfiguration" + """A network connectivity issue is happening on the resource which could be addressed either by + adding new resources to the network security perimeter (NSP) or by modifying access rules.""" + MISSING_IDENTITY_CONFIGURATION = "MissingIdentityConfiguration" + """An managed identity hasn't been associated with the resource. The resource will still be able + to validate inbound traffic from the network security perimeter (NSP) or matching inbound + access rules, but it won't be able to perform outbound access as a member of the NSP.""" + + class KeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The access key to regenerate.""" @@ -221,8 +331,8 @@ class ManagedCassandraResourceIdentityType(str, Enum, metaclass=CaseInsensitiveE class MinimalTlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the minimum allowed Tls version. The default value is Tls 1.2. Cassandra and Mongo - APIs only work with Tls 1.2. + """Indicates the minimum allowed Tls version. The default is Tls 1.0, except for Cassandra and + Mongo API's, which only work with Tls 1.2. """ TLS = "Tls" @@ -244,6 +354,20 @@ class NetworkAclBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_SERVICES = "AzureServices" +class NetworkSecurityPerimeterConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of a network security perimeter configuration that is being created or + updated. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + ACCEPTED = "Accepted" + FAILED = "Failed" + CANCELED = "Canceled" + + class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of the node in Cassandra ring.""" @@ -306,6 +430,17 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): SECURED_BY_PERIMETER = "SecuredByPerimeter" +class ResourceAssociationAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Access mode of the resource association.""" + + ENFORCED = "Enforced" + """Enforced access mode - traffic to the resource that failed access checks is blocked""" + LEARNING = "Learning" + """Learning access mode - traffic to the resource is enabled for analysis but not blocked""" + AUDIT = "Audit" + """Audit access mode - traffic to the resource that fails access checks is logged but not blocked""" + + 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 @@ -331,6 +466,14 @@ class RoleDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM_ROLE = "CustomRole" +class ScheduledEventStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """How the nodes in the cluster react to scheduled events.""" + + IGNORE = "Ignore" + STOP_ANY = "StopAny" + STOP_BY_RACK = "StopByRack" + + class ServerVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the version of the MongoDB account.""" @@ -371,6 +514,13 @@ class ServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MATERIALIZED_VIEWS_BUILDER = "MaterializedViewsBuilder" +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of the issue.""" + + WARNING = "Warning" + ERROR = "Error" + + class SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the spatial type of index.""" @@ -388,6 +538,25 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): INTERNALLY_READY = "InternallyReady" ONLINE = "Online" DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + UPDATING = "Updating" + + +class SupportedActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether what action to take for the Chaos Fault.""" + + ENABLE = "Enable" + DISABLE = "Disable" + + +class ThroughputPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ThroughputPolicy to apply for throughput redistribution.""" + + NONE = "none" + EQUAL = "equal" + CUSTOM = "custom" class TriggerOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 100541c73721..5cd554b3e43d 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 @@ -1,5 +1,5 @@ -# coding=utf-8 # 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. @@ -8,13 +8,139 @@ # -------------------------------------------------------------------------- import datetime +import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore + if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object + + +class AccessRule(_serialization.Model): + """Access rule in a network security perimeter configuration profile. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: Properties of Access Rule. + :vartype properties: ~azure.mgmt.cosmosdb.models.AccessRuleProperties + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "AccessRuleProperties"}, + } + + def __init__( + self, *, name: Optional[str] = None, properties: Optional["_models.AccessRuleProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Name of the access rule. + :paramtype name: str + :keyword properties: Properties of Access Rule. + :paramtype properties: ~azure.mgmt.cosmosdb.models.AccessRuleProperties + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + + +class AccessRuleProperties(_serialization.Model): + """Properties of Access Rule. + + :ivar direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.cosmosdb.models.AccessRuleDirection + :ivar address_prefixes: Address prefixes in the CIDR format for inbound rules. + :vartype address_prefixes: list[str] + :ivar subscriptions: Subscriptions for inbound rules. + :vartype subscriptions: list[~azure.mgmt.cosmosdb.models.AccessRulePropertiesSubscriptionsItem] + :ivar network_security_perimeters: Network security perimeters for inbound rules. + :vartype network_security_perimeters: + list[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter] + :ivar fully_qualified_domain_names: Fully qualified domain names (FQDN) for outbound rules. + :vartype fully_qualified_domain_names: list[str] + :ivar email_addresses: Email addresses for outbound rules. + :vartype email_addresses: list[str] + :ivar phone_numbers: Phone numbers for outbound rules. + :vartype phone_numbers: list[str] + """ + + _attribute_map = { + "direction": {"key": "direction", "type": "str"}, + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "subscriptions": {"key": "subscriptions", "type": "[AccessRulePropertiesSubscriptionsItem]"}, + "network_security_perimeters": {"key": "networkSecurityPerimeters", "type": "[NetworkSecurityPerimeter]"}, + "fully_qualified_domain_names": {"key": "fullyQualifiedDomainNames", "type": "[str]"}, + "email_addresses": {"key": "emailAddresses", "type": "[str]"}, + "phone_numbers": {"key": "phoneNumbers", "type": "[str]"}, + } + + def __init__( + self, + *, + direction: Optional[Union[str, "_models.AccessRuleDirection"]] = None, + address_prefixes: Optional[List[str]] = None, + subscriptions: Optional[List["_models.AccessRulePropertiesSubscriptionsItem"]] = None, + network_security_perimeters: Optional[List["_models.NetworkSecurityPerimeter"]] = None, + fully_qualified_domain_names: Optional[List[str]] = None, + email_addresses: Optional[List[str]] = None, + phone_numbers: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". + :paramtype direction: str or ~azure.mgmt.cosmosdb.models.AccessRuleDirection + :keyword address_prefixes: Address prefixes in the CIDR format for inbound rules. + :paramtype address_prefixes: list[str] + :keyword subscriptions: Subscriptions for inbound rules. + :paramtype subscriptions: + list[~azure.mgmt.cosmosdb.models.AccessRulePropertiesSubscriptionsItem] + :keyword network_security_perimeters: Network security perimeters for inbound rules. + :paramtype network_security_perimeters: + list[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter] + :keyword fully_qualified_domain_names: Fully qualified domain names (FQDN) for outbound rules. + :paramtype fully_qualified_domain_names: list[str] + :keyword email_addresses: Email addresses for outbound rules. + :paramtype email_addresses: list[str] + :keyword phone_numbers: Phone numbers for outbound rules. + :paramtype phone_numbers: list[str] + """ + super().__init__(**kwargs) + self.direction = direction + self.address_prefixes = address_prefixes + self.subscriptions = subscriptions + self.network_security_perimeters = network_security_perimeters + self.fully_qualified_domain_names = fully_qualified_domain_names + self.email_addresses = email_addresses + self.phone_numbers = phone_numbers + + +class AccessRulePropertiesSubscriptionsItem(_serialization.Model): + """Subscription identifiers. + + :ivar id: The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000'). + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000'). + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id class AccountKeyMetadata(_serialization.Model): @@ -142,6 +268,8 @@ class ARMResourceProperties(_serialization.Model): 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 = { @@ -156,9 +284,17 @@ class ARMResourceProperties(_serialization.Model): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, } - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: """ :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str @@ -169,6 +305,8 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s 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().__init__(**kwargs) self.id = None @@ -176,6 +314,7 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s self.type = None self.location = location self.tags = tags + self.identity = identity class AuthenticationMethodLdapProperties(_serialization.Model): @@ -350,6 +489,80 @@ def __init__( self.throughput_policy = throughput_policy +class DataTransferDataSourceSink(_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, BaseCosmosDataTransferDataSourceSink, + CosmosMongoVCoreDataTransferDataSourceSink + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :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", + "BaseCosmosDataTransferDataSourceSink": "BaseCosmosDataTransferDataSourceSink", + "CosmosDBMongoVCore": "CosmosMongoVCoreDataTransferDataSourceSink", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.component: Optional[str] = None + + +class AzureBlobDataTransferDataSourceSink(DataTransferDataSourceSink): + """An Azure Blob Storage data source/sink. + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :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: Any) -> None: + """ + :keyword container_name: Required. + :paramtype container_name: str + :keyword endpoint_url: + :paramtype endpoint_url: str + """ + super().__init__(**kwargs) + self.component: str = "AzureBlobStorage" + self.container_name = container_name + self.endpoint_url = endpoint_url + + class BackupInformation(_serialization.Model): """Backup information of a resource. @@ -456,6 +669,145 @@ def __init__( self.start_time = start_time +class BackupResource(_serialization.Model): + """A restorable backup of a Cassandra cluster. + + :ivar backup_id: The unique identifier of backup. + :vartype backup_id: str + :ivar backup_state: The current state of the backup. Known values are: "Initiated", + "InProgress", "Succeeded", and "Failed". + :vartype backup_state: str or ~azure.mgmt.cosmosdb.models.BackupState + :ivar backup_start_timestamp: The time at which the backup process begins. + :vartype backup_start_timestamp: ~datetime.datetime + :ivar backup_stop_timestamp: The time at which the backup process ends. + :vartype backup_stop_timestamp: ~datetime.datetime + :ivar backup_expiry_timestamp: The time at which the backup will expire. + :vartype backup_expiry_timestamp: ~datetime.datetime + """ + + _attribute_map = { + "backup_id": {"key": "backupId", "type": "str"}, + "backup_state": {"key": "backupState", "type": "str"}, + "backup_start_timestamp": {"key": "backupStartTimestamp", "type": "iso-8601"}, + "backup_stop_timestamp": {"key": "backupStopTimestamp", "type": "iso-8601"}, + "backup_expiry_timestamp": {"key": "backupExpiryTimestamp", "type": "iso-8601"}, + } + + def __init__( + self, + *, + backup_id: Optional[str] = None, + backup_state: Optional[Union[str, "_models.BackupState"]] = None, + backup_start_timestamp: Optional[datetime.datetime] = None, + backup_stop_timestamp: Optional[datetime.datetime] = None, + backup_expiry_timestamp: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword backup_id: The unique identifier of backup. + :paramtype backup_id: str + :keyword backup_state: The current state of the backup. Known values are: "Initiated", + "InProgress", "Succeeded", and "Failed". + :paramtype backup_state: str or ~azure.mgmt.cosmosdb.models.BackupState + :keyword backup_start_timestamp: The time at which the backup process begins. + :paramtype backup_start_timestamp: ~datetime.datetime + :keyword backup_stop_timestamp: The time at which the backup process ends. + :paramtype backup_stop_timestamp: ~datetime.datetime + :keyword backup_expiry_timestamp: The time at which the backup will expire. + :paramtype backup_expiry_timestamp: ~datetime.datetime + """ + super().__init__(**kwargs) + self.backup_id = backup_id + self.backup_state = backup_state + self.backup_start_timestamp = backup_start_timestamp + self.backup_stop_timestamp = backup_stop_timestamp + self.backup_expiry_timestamp = backup_expiry_timestamp + + +class BackupSchedule(_serialization.Model): + """BackupSchedule. + + :ivar schedule_name: The unique identifier of backup schedule. + :vartype schedule_name: str + :ivar cron_expression: The cron expression that defines when you want to back up your data. + :vartype cron_expression: str + :ivar retention_in_hours: The retention period (hours) of the backups. If you want to retain + data forever, set retention to 0. + :vartype retention_in_hours: int + """ + + _attribute_map = { + "schedule_name": {"key": "scheduleName", "type": "str"}, + "cron_expression": {"key": "cronExpression", "type": "str"}, + "retention_in_hours": {"key": "retentionInHours", "type": "int"}, + } + + def __init__( + self, + *, + schedule_name: Optional[str] = None, + cron_expression: Optional[str] = None, + retention_in_hours: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword schedule_name: The unique identifier of backup schedule. + :paramtype schedule_name: str + :keyword cron_expression: The cron expression that defines when you want to back up your data. + :paramtype cron_expression: str + :keyword retention_in_hours: The retention period (hours) of the backups. If you want to retain + data forever, set retention to 0. + :paramtype retention_in_hours: int + """ + super().__init__(**kwargs) + self.schedule_name = schedule_name + self.cron_expression = cron_expression + self.retention_in_hours = retention_in_hours + + +class BaseCosmosDataTransferDataSourceSink(DataTransferDataSourceSink): + """A base CosmosDB data source/sink. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CosmosCassandraDataTransferDataSourceSink, CosmosMongoDataTransferDataSourceSink, + CosmosSqlDataTransferDataSourceSink + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + :ivar remote_account_name: + :vartype remote_account_name: str + """ + + _validation = { + "component": {"required": True}, + } + + _attribute_map = { + "component": {"key": "component", "type": "str"}, + "remote_account_name": {"key": "remoteAccountName", "type": "str"}, + } + + _subtype_map = { + "component": { + "CosmosDBCassandra": "CosmosCassandraDataTransferDataSourceSink", + "CosmosDBMongo": "CosmosMongoDataTransferDataSourceSink", + "CosmosDBSql": "CosmosSqlDataTransferDataSourceSink", + } + } + + def __init__(self, *, remote_account_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword remote_account_name: + :paramtype remote_account_name: str + """ + super().__init__(**kwargs) + self.component: str = "BaseCosmosDataTransferDataSourceSink" + self.remote_account_name = remote_account_name + + class Capability(_serialization.Model): """Cosmos DB capability object. @@ -508,7 +860,78 @@ def __init__(self, *, total_throughput_limit: Optional[int] = None, **kwargs: An self.total_throughput_limit = total_throughput_limit -class CassandraClusterDataCenterNodeItem(_serialization.Model): # pylint: disable=too-many-instance-attributes +class CapacityModeChangeTransitionState(_serialization.Model): + """The transition state information related capacity mode change with update request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar capacity_mode_transition_status: The transition status of capacity mode. Known values + are: "Invalid", "Initialized", "InProgress", "Completed", and "Failed". + :vartype capacity_mode_transition_status: str or + ~azure.mgmt.cosmosdb.models.CapacityModeTransitionStatus + :ivar current_capacity_mode: Indicates the current capacity mode of the account. Known values + are: "None", "Provisioned", and "Serverless". + :vartype current_capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :ivar previous_capacity_mode: Indicates the previous capacity mode of the account before + successful transition. Known values are: "None", "Provisioned", and "Serverless". + :vartype previous_capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :ivar capacity_mode_transition_begin_timestamp: Begin time in UTC of the capacity mode change. + :vartype capacity_mode_transition_begin_timestamp: ~datetime.datetime + :ivar capacity_mode_transition_end_timestamp: End time in UTC of the capacity mode change. + :vartype capacity_mode_transition_end_timestamp: ~datetime.datetime + :ivar capacity_mode_last_successful_transition_end_timestamp: End time in UTC of the last + successful capacity mode change. + :vartype capacity_mode_last_successful_transition_end_timestamp: ~datetime.datetime + """ + + _validation = { + "capacity_mode_transition_begin_timestamp": {"readonly": True}, + "capacity_mode_transition_end_timestamp": {"readonly": True}, + "capacity_mode_last_successful_transition_end_timestamp": {"readonly": True}, + } + + _attribute_map = { + "capacity_mode_transition_status": {"key": "capacityModeTransitionStatus", "type": "str"}, + "current_capacity_mode": {"key": "currentCapacityMode", "type": "str"}, + "previous_capacity_mode": {"key": "previousCapacityMode", "type": "str"}, + "capacity_mode_transition_begin_timestamp": {"key": "capacityModeTransitionBeginTimestamp", "type": "iso-8601"}, + "capacity_mode_transition_end_timestamp": {"key": "capacityModeTransitionEndTimestamp", "type": "iso-8601"}, + "capacity_mode_last_successful_transition_end_timestamp": { + "key": "capacityModeLastSuccessfulTransitionEndTimestamp", + "type": "iso-8601", + }, + } + + def __init__( + self, + *, + capacity_mode_transition_status: Optional[Union[str, "_models.CapacityModeTransitionStatus"]] = None, + current_capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = None, + previous_capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword capacity_mode_transition_status: The transition status of capacity mode. Known values + are: "Invalid", "Initialized", "InProgress", "Completed", and "Failed". + :paramtype capacity_mode_transition_status: str or + ~azure.mgmt.cosmosdb.models.CapacityModeTransitionStatus + :keyword current_capacity_mode: Indicates the current capacity mode of the account. Known + values are: "None", "Provisioned", and "Serverless". + :paramtype current_capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :keyword previous_capacity_mode: Indicates the previous capacity mode of the account before + successful transition. Known values are: "None", "Provisioned", and "Serverless". + :paramtype previous_capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + """ + super().__init__(**kwargs) + self.capacity_mode_transition_status = capacity_mode_transition_status + self.current_capacity_mode = current_capacity_mode + self.previous_capacity_mode = previous_capacity_mode + self.capacity_mode_transition_begin_timestamp = None + self.capacity_mode_transition_end_timestamp = None + self.capacity_mode_last_successful_transition_end_timestamp = None + + +class CassandraClusterDataCenterNodeItem(_serialization.Model): """CassandraClusterDataCenterNodeItem. :ivar address: The node's IP address. @@ -549,6 +972,8 @@ class CassandraClusterDataCenterNodeItem(_serialization.Model): # pylint: disab :vartype memory_total_kb: int :ivar cpu_usage: A float representing the current system-wide CPU utilization as a percentage. :vartype cpu_usage: float + :ivar is_latest_model: If node has been updated to latest model. + :vartype is_latest_model: bool """ _attribute_map = { @@ -569,6 +994,7 @@ class CassandraClusterDataCenterNodeItem(_serialization.Model): # pylint: disab "memory_free_kb": {"key": "memoryFreeKB", "type": "int"}, "memory_total_kb": {"key": "memoryTotalKB", "type": "int"}, "cpu_usage": {"key": "cpuUsage", "type": "float"}, + "is_latest_model": {"key": "isLatestModel", "type": "bool"}, } def __init__( @@ -591,6 +1017,7 @@ def __init__( memory_free_kb: Optional[int] = None, memory_total_kb: Optional[int] = None, cpu_usage: Optional[float] = None, + is_latest_model: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -634,6 +1061,8 @@ def __init__( :keyword cpu_usage: A float representing the current system-wide CPU utilization as a percentage. :paramtype cpu_usage: float + :keyword is_latest_model: If node has been updated to latest model. + :paramtype is_latest_model: bool """ super().__init__(**kwargs) self.address = address @@ -653,6 +1082,7 @@ def __init__( self.memory_free_kb = memory_free_kb self.memory_total_kb = memory_total_kb self.cpu_usage = cpu_usage + self.is_latest_model = is_latest_model class CassandraClusterPublicStatus(_serialization.Model): @@ -821,6 +1251,8 @@ class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a Cassandra keyspace. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -841,6 +1273,7 @@ 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"}, } @@ -851,6 +1284,7 @@ def __init__( resource: "_models.CassandraKeyspaceResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -864,13 +1298,15 @@ def __init__( 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: The standard JSON format of a Cassandra keyspace. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -1045,6 +1481,8 @@ class CassandraKeyspaceGetResults(ARMResourceProperties): 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: @@ -1063,6 +1501,7 @@ 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"}, } @@ -1072,6 +1511,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.CassandraKeyspaceGetPropertiesResource"] = None, options: Optional["_models.CassandraKeyspaceGetPropertiesOptions"] = None, **kwargs: Any @@ -1086,12 +1526,14 @@ def __init__( 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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -1200,6 +1642,8 @@ class CassandraTableCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a Cassandra table. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -1220,6 +1664,7 @@ 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"}, } @@ -1230,6 +1675,7 @@ def __init__( resource: "_models.CassandraTableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -1243,13 +1689,15 @@ def __init__( 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: The standard JSON format of a Cassandra table. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -1409,6 +1857,8 @@ class CassandraTableGetResults(ARMResourceProperties): 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: @@ -1427,6 +1877,7 @@ 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"}, } @@ -1436,6 +1887,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.CassandraTableGetPropertiesResource"] = None, options: Optional["_models.CassandraTableGetPropertiesOptions"] = None, **kwargs: Any @@ -1450,12 +1902,14 @@ def __init__( 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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -1483,170 +1937,139 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class Certificate(_serialization.Model): - """Certificate. +class CassandraViewCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra view. - :ivar pem: PEM formatted public key. - :vartype pem: 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 server. + + :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: 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: The standard JSON format of a Cassandra view. Required. + :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 """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "resource": {"required": True}, + } + _attribute_map = { - "pem": {"key": "pem", "type": "str"}, - } - - def __init__(self, *, pem: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword pem: PEM formatted public key. - :paramtype pem: str - """ - super().__init__(**kwargs) - self.pem = pem - - -class ClientEncryptionIncludedPath(_serialization.Model): - """. - - All required parameters must be populated in order to send to server. - - :ivar path: Path that needs to be encrypted. Required. - :vartype path: str - :ivar client_encryption_key_id: The identifier of the Client Encryption Key to be used to - encrypt the path. Required. - :vartype client_encryption_key_id: str - :ivar encryption_type: The type of encryption to be performed. Eg - Deterministic, Randomized. - Required. - :vartype encryption_type: str - :ivar encryption_algorithm: The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. Required. - :vartype encryption_algorithm: str - """ - - _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"}, + "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": "CassandraViewResource"}, + "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } def __init__( self, *, - path: str, - client_encryption_key_id: str, - encryption_type: str, - encryption_algorithm: str, + resource: "_models.CassandraViewResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: """ - :keyword path: Path that needs to be encrypted. Required. - :paramtype path: str - :keyword client_encryption_key_id: The identifier of the Client Encryption Key to be used to - encrypt the path. Required. - :paramtype client_encryption_key_id: str - :keyword encryption_type: The type of encryption to be performed. Eg - Deterministic, - Randomized. Required. - :paramtype encryption_type: str - :keyword encryption_algorithm: The encryption algorithm which will be used. Eg - - AEAD_AES_256_CBC_HMAC_SHA256. Required. - :paramtype encryption_algorithm: str + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a Cassandra view. Required. + :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 """ - super().__init__(**kwargs) - self.path = path - self.client_encryption_key_id = client_encryption_key_id - self.encryption_type = encryption_type - self.encryption_algorithm = encryption_algorithm - + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options -class ClientEncryptionKeyCreateUpdateParameters(_serialization.Model): # pylint: disable=name-too-long - """Parameters to create and update ClientEncryptionKey. - All required parameters must be populated in order to send to server. +class CassandraViewGetPropertiesOptions(OptionsResource): + """CassandraViewGetPropertiesOptions. - :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource + :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 = { - "resource": {"required": True}, - } - - _attribute_map = { - "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyResource"}, - } - - def __init__(self, *, resource: "_models.ClientEncryptionKeyResource", **kwargs: Any) -> None: - """ - :keyword resource: The standard JSON format of a ClientEncryptionKey. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource - """ - super().__init__(**kwargs) - self.resource = resource +class CassandraViewResource(_serialization.Model): + """Cosmos DB Cassandra view resource object. -class ClientEncryptionKeyResource(_serialization.Model): - """Cosmos DB client encryption key resource object. + All required parameters must be populated in order to send to server. - :ivar id: Name of the ClientEncryptionKey. + :ivar id: Name of the Cosmos DB Cassandra view. Required. :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: bytes - :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 view_definition: View Definition of the Cosmos DB Cassandra view. Required. + :vartype view_definition: str """ + _validation = { + "id": {"required": True}, + "view_definition": {"required": True}, + } + _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"}, + "view_definition": {"key": "viewDefinition", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - encryption_algorithm: Optional[str] = None, - wrapped_data_encryption_key: Optional[bytes] = None, - key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, id: str, view_definition: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Name of the ClientEncryptionKey. + :keyword id: Name of the Cosmos DB Cassandra view. Required. :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: bytes - :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 + :keyword view_definition: View Definition of the Cosmos DB Cassandra view. Required. + :paramtype view_definition: str """ super().__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 + self.view_definition = view_definition -class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource, ExtendedResourceProperties): - """ClientEncryptionKeyGetPropertiesResource. +class CassandraViewGetPropertiesResource(CassandraViewResource, ExtendedResourceProperties): + """CassandraViewGetPropertiesResource. 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 server. + :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. @@ -1654,23 +2077,18 @@ class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource, Exte :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str - :ivar id: Name of the ClientEncryptionKey. + :ivar id: Name of the Cosmos DB Cassandra view. Required. :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: bytes - :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 view_definition: View Definition of the Cosmos DB Cassandra view. Required. + :vartype view_definition: str """ _validation = { "rid": {"readonly": True}, "ts": {"readonly": True}, "etag": {"readonly": True}, + "id": {"required": True}, + "view_definition": {"required": True}, } _attribute_map = { @@ -1678,62 +2096,50 @@ class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource, Exte "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "type": "str"}, "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"}, + "view_definition": {"key": "viewDefinition", "type": "str"}, } - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - encryption_algorithm: Optional[str] = None, - wrapped_data_encryption_key: Optional[bytes] = None, - key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, id: str, view_definition: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword id: Name of the ClientEncryptionKey. + :keyword id: Name of the Cosmos DB Cassandra view. Required. :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: bytes - :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 + :keyword view_definition: View Definition of the Cosmos DB Cassandra view. Required. + :paramtype view_definition: str """ - super().__init__( - id=id, - encryption_algorithm=encryption_algorithm, - wrapped_data_encryption_key=wrapped_data_encryption_key, - key_wrap_metadata=key_wrap_metadata, - **kwargs - ) + super().__init__(id=id, view_definition=view_definition, **kwargs) self.rid = None self.ts = None self.etag = None 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.view_definition = view_definition -class ClientEncryptionKeyGetResults(ARMProxyResource): - """Client Encryption Key. +class CassandraViewGetResults(ARMResourceProperties): + """An Azure Cosmos DB Cassandra view. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar 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.ClientEncryptionKeyGetPropertiesResource + :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions """ _validation = { @@ -1746,27 +2152,52 @@ class ClientEncryptionKeyGetResults(ARMProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyGetPropertiesResource"}, + "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"}, } def __init__( - self, *, resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, **kwargs: Any + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.CassandraViewGetPropertiesResource"] = None, + options: Optional["_models.CassandraViewGetPropertiesOptions"] = None, + **kwargs: Any ) -> None: """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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.ClientEncryptionKeyGetPropertiesResource + :paramtype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions """ - super().__init__(**kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource + self.options = options -class ClientEncryptionKeysListResult(_serialization.Model): - """The List operation response, that contains the client encryption keys and their properties. +class CassandraViewListResult(_serialization.Model): + """The List operation response, that contains the Cassandra views and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of client encryption keys and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :ivar value: List of Cassandra views and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] """ _validation = { @@ -1774,7 +2205,7 @@ class ClientEncryptionKeysListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[ClientEncryptionKeyGetResults]"}, + "value": {"key": "value", "type": "[CassandraViewGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -1783,860 +2214,1536 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class ClientEncryptionPolicy(_serialization.Model): - """Cosmos DB client encryption policy. +class Certificate(_serialization.Model): + """Certificate. - All required parameters must be populated in order to send to server. - - :ivar included_paths: Paths of the item that need encryption along with path-specific settings. - Required. - :vartype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :ivar policy_format_version: Version of the client encryption policy definition. Supported - versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. - :vartype policy_format_version: int - """ - - _validation = { - "included_paths": {"required": True}, - "policy_format_version": {"required": True, "maximum": 2, "minimum": 1}, - } + :ivar pem: PEM formatted public key. + :vartype pem: str + """ _attribute_map = { - "included_paths": {"key": "includedPaths", "type": "[ClientEncryptionIncludedPath]"}, - "policy_format_version": {"key": "policyFormatVersion", "type": "int"}, + "pem": {"key": "pem", "type": "str"}, } - def __init__( - self, *, included_paths: List["_models.ClientEncryptionIncludedPath"], policy_format_version: int, **kwargs: Any - ) -> None: + def __init__(self, *, pem: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword included_paths: Paths of the item that need encryption along with path-specific - settings. Required. - :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] - :keyword policy_format_version: Version of the client encryption policy definition. Supported - versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. - :paramtype policy_format_version: int + :keyword pem: PEM formatted public key. + :paramtype pem: str """ super().__init__(**kwargs) - self.included_paths = included_paths - self.policy_format_version = policy_format_version + self.pem = pem -class ClusterKey(_serialization.Model): - """Cosmos DB Cassandra table cluster key. +class ChaosFaultListResponse(_serialization.Model): + """Chaos Fault List Response. - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Chaos Faults. + :vartype value: list[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "order_by": {"key": "orderBy", "type": "str"}, + "value": {"key": "value", "type": "[ChaosFaultResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, order_by: Optional[str] = None, **kwargs: Any) -> None: - """ - :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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.order_by = order_by + self.value = None + self.next_link = None -class ManagedCassandraARMResourceProperties(_serialization.Model): - """The core properties of ARM resources. +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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": "ManagedCassandraManagedServiceIdentity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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 - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None - self.location = location - self.tags = tags - self.identity = identity + self.system_data = None -class ClusterResource(ManagedCassandraARMResourceProperties): - """Representation of a managed Cassandra cluster. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + """ + + +class ChaosFaultResource(ProxyResource): + """A request object to enable/disable the chaos fault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar action: Indicates whether what action to take for the Chaos Fault. Known values are: + "Enable" and "Disable". + :vartype action: str or ~azure.mgmt.cosmosdb.models.SupportedActions + :ivar region: Region of the account where the Chaos Fault is to be enabled/disabled. + :vartype region: str + :ivar database_name: Database name. + :vartype database_name: str + :ivar container_name: Container name. + :vartype container_name: str + :ivar provisioning_state: A provisioning state of the Chaos Fault. + :vartype provisioning_state: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"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": "ManagedCassandraManagedServiceIdentity"}, - "properties": {"key": "properties", "type": "ClusterResourceProperties"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "action": {"key": "properties.action", "type": "str"}, + "region": {"key": "properties.region", "type": "str"}, + "database_name": {"key": "properties.databaseName", "type": "str"}, + "container_name": {"key": "properties.containerName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, - properties: Optional["_models.ClusterResourceProperties"] = None, + action: Optional[Union[str, "_models.SupportedActions"]] = None, + region: Optional[str] = None, + database_name: Optional[str] = None, + container_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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 + :keyword action: Indicates whether what action to take for the Chaos Fault. Known values are: + "Enable" and "Disable". + :paramtype action: str or ~azure.mgmt.cosmosdb.models.SupportedActions + :keyword region: Region of the account where the Chaos Fault is to be enabled/disabled. + :paramtype region: str + :keyword database_name: Database name. + :paramtype database_name: str + :keyword container_name: Container name. + :paramtype container_name: str """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) - self.properties = properties + super().__init__(**kwargs) + self.action = action + self.region = region + self.database_name = database_name + self.container_name = container_name + self.provisioning_state = None -class ClusterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Properties of a managed Cassandra cluster. +class ClientEncryptionIncludedPath(_serialization.Model): + """. - 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 server. - :ivar provisioning_state: The status of the resource at the time the operation was called. - Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "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", and "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: (Deprecated) 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 - :ivar provision_error: Error related to resource provisioning. - :vartype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError - :ivar azure_connection_method: How to connect to the azure services needed for running the - cluster. Known values are: "None" and "VPN". - :vartype azure_connection_method: str or ~azure.mgmt.cosmosdb.models.AzureConnectionType - :ivar private_link_resource_id: If the Connection Method is VPN, this is the Id of the private - link resource that the datacenters need to connect to. - :vartype private_link_resource_id: str + :ivar path: Path that needs to be encrypted. Required. + :vartype path: str + :ivar client_encryption_key_id: The identifier of the Client Encryption Key to be used to + encrypt the path. Required. + :vartype client_encryption_key_id: str + :ivar encryption_type: The type of encryption to be performed. Eg - Deterministic, Randomized. + Required. + :vartype encryption_type: str + :ivar encryption_algorithm: The encryption algorithm which will be used. Eg - + AEAD_AES_256_CBC_HMAC_SHA256. Required. + :vartype encryption_algorithm: str """ _validation = { - "gossip_certificates": {"readonly": True}, - "seed_nodes": {"readonly": True}, - "private_link_resource_id": {"readonly": True}, + "path": {"required": True}, + "client_encryption_key_id": {"required": True}, + "encryption_type": {"required": True}, + "encryption_algorithm": {"required": 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"}, - "provision_error": {"key": "provisionError", "type": "CassandraError"}, - "azure_connection_method": {"key": "azureConnectionMethod", "type": "str"}, - "private_link_resource_id": {"key": "privateLinkResourceId", "type": "str"}, + "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"}, } def __init__( self, *, - 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, - provision_error: Optional["_models.CassandraError"] = None, - azure_connection_method: Optional[Union[str, "_models.AzureConnectionType"]] = None, + path: str, + client_encryption_key_id: str, + encryption_type: str, + encryption_algorithm: str, **kwargs: Any ) -> None: """ - :keyword provisioning_state: The status of the resource at the time the operation was called. - Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "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", and "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: (Deprecated) 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 - :keyword provision_error: Error related to resource provisioning. - :paramtype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError - :keyword azure_connection_method: How to connect to the azure services needed for running the - cluster. Known values are: "None" and "VPN". - :paramtype azure_connection_method: str or ~azure.mgmt.cosmosdb.models.AzureConnectionType + :keyword path: Path that needs to be encrypted. Required. + :paramtype path: str + :keyword client_encryption_key_id: The identifier of the Client Encryption Key to be used to + encrypt the path. Required. + :paramtype client_encryption_key_id: str + :keyword encryption_type: The type of encryption to be performed. Eg - Deterministic, + Randomized. Required. + :paramtype encryption_type: str + :keyword encryption_algorithm: The encryption algorithm which will be used. Eg - + AEAD_AES_256_CBC_HMAC_SHA256. Required. + :paramtype encryption_algorithm: str """ super().__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 - self.provision_error = provision_error - self.azure_connection_method = azure_connection_method - self.private_link_resource_id = None + self.path = path + self.client_encryption_key_id = client_encryption_key_id + self.encryption_type = encryption_type + self.encryption_algorithm = encryption_algorithm -class Column(_serialization.Model): - """Cosmos DB Cassandra table column. +class ClientEncryptionKeyCreateUpdateParameters(_serialization.Model): # pylint: disable=name-too-long + """Parameters to create and update ClientEncryptionKey. - :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 + All required parameters must be populated in order to send to server. + + :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource """ + _validation = { + "resource": {"required": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyResource"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, resource: "_models.ClientEncryptionKeyResource", **kwargs: Any) -> None: """ - :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 + :keyword resource: The standard JSON format of a ClientEncryptionKey. Required. + :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource """ super().__init__(**kwargs) - self.name = name - self.type = type + self.resource = resource -class CommandOutput(_serialization.Model): - """Response of /command api. +class ClientEncryptionKeyResource(_serialization.Model): + """Cosmos DB client encryption key resource object. - :ivar command_output: Output of the command. - :vartype command_output: str + :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: bytes + :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 """ _attribute_map = { - "command_output": {"key": "commandOutput", "type": "str"}, + "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"}, } - def __init__(self, *, command_output: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + encryption_algorithm: Optional[str] = None, + wrapped_data_encryption_key: Optional[bytes] = None, + key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, + **kwargs: Any + ) -> None: """ - :keyword command_output: Output of the command. - :paramtype command_output: str + :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: bytes + :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().__init__(**kwargs) - self.command_output = command_output + self.id = id + self.encryption_algorithm = encryption_algorithm + self.wrapped_data_encryption_key = wrapped_data_encryption_key + self.key_wrap_metadata = key_wrap_metadata -class CommandPostBody(_serialization.Model): - """Specification of which command to run where. +class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource, ExtendedResourceProperties): + """ClientEncryptionKeyGetPropertiesResource. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar command: The command which should be run. Required. - :vartype command: str - :ivar arguments: The arguments for the command to be run. - :vartype arguments: dict[str, str] - :ivar host: IP address of the cassandra host to run the command on. Required. - :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 + :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 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: bytes + :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 """ _validation = { - "command": {"required": True}, - "host": {"required": True}, + "rid": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": 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"}, + "rid": {"key": "_rid", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "type": "str"}, + "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"}, } def __init__( self, *, - command: str, - host: str, - arguments: Optional[Dict[str, str]] = None, - cassandra_stop_start: Optional[bool] = None, - readwrite: Optional[bool] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + encryption_algorithm: Optional[str] = None, + wrapped_data_encryption_key: Optional[bytes] = None, + key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = None, **kwargs: Any ) -> None: """ - :keyword command: The command which should be run. Required. - :paramtype command: str - :keyword arguments: The arguments for the command to be run. - :paramtype arguments: dict[str, str] - :keyword host: IP address of the cassandra host to run the command on. Required. - :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 + :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: bytes + :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().__init__(**kwargs) - self.command = command - self.arguments = arguments - self.host = host - self.cassandra_stop_start = cassandra_stop_start - self.readwrite = readwrite + super().__init__( + id=id, + encryption_algorithm=encryption_algorithm, + wrapped_data_encryption_key=wrapped_data_encryption_key, + key_wrap_metadata=key_wrap_metadata, + **kwargs + ) + self.rid = None + self.ts = None + self.etag = None + self.id = id + self.encryption_algorithm = encryption_algorithm + self.wrapped_data_encryption_key = wrapped_data_encryption_key + self.key_wrap_metadata = key_wrap_metadata -class CompositePath(_serialization.Model): - """CompositePath. +class ClientEncryptionKeyGetResults(ARMProxyResource): + """Client Encryption Key. - :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. Known values are: "ascending" and "descending". - :vartype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder + 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 """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + _attribute_map = { - "path": {"key": "path", "type": "str"}, - "order": {"key": "order", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "resource": {"key": "properties.resource", "type": "ClientEncryptionKeyGetPropertiesResource"}, } def __init__( - self, - *, - path: Optional[str] = None, - order: Optional[Union[str, "_models.CompositePathSortOrder"]] = None, - **kwargs: Any + self, *, resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, **kwargs: Any ) -> None: """ - :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. Known values are: "ascending" and "descending". - :paramtype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder + :keyword resource: + :paramtype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource """ super().__init__(**kwargs) - self.path = path - self.order = order + self.resource = resource -class ComputedProperty(_serialization.Model): - """The definition of a computed property. +class ClientEncryptionKeysListResult(_serialization.Model): + """The List operation response, that contains the client encryption keys and their properties. - :ivar name: The name of a computed property, for example - "cp_lowerName". - :vartype name: str - :ivar query: The query that evaluates the value for computed property, for example - "SELECT - VALUE LOWER(c.name) FROM c". - :vartype query: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of client encryption keys and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] """ + _validation = { + "value": {"readonly": True}, + } + _attribute_map = { - "name": {"key": "name", "type": "str"}, - "query": {"key": "query", "type": "str"}, + "value": {"key": "value", "type": "[ClientEncryptionKeyGetResults]"}, } - def __init__(self, *, name: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The name of a computed property, for example - "cp_lowerName". - :paramtype name: str - :keyword query: The query that evaluates the value for computed property, for example - "SELECT - VALUE LOWER(c.name) FROM c". - :paramtype query: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.query = query + self.value = None -class ConflictResolutionPolicy(_serialization.Model): - """The conflict resolution policy for the container. +class ClientEncryptionPolicy(_serialization.Model): + """Cosmos DB client encryption policy. - :ivar mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and - "Custom". - :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 + All required parameters must be populated in order to send to server. + + :ivar included_paths: Paths of the item that need encryption along with path-specific settings. + Required. + :vartype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] + :ivar policy_format_version: Version of the client encryption policy definition. Supported + versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. + :vartype policy_format_version: int """ + _validation = { + "included_paths": {"required": True}, + "policy_format_version": {"required": True, "maximum": 2, "minimum": 1}, + } + _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "conflict_resolution_path": {"key": "conflictResolutionPath", "type": "str"}, - "conflict_resolution_procedure": {"key": "conflictResolutionProcedure", "type": "str"}, + "included_paths": {"key": "includedPaths", "type": "[ClientEncryptionIncludedPath]"}, + "policy_format_version": {"key": "policyFormatVersion", "type": "int"}, } def __init__( - self, - *, - mode: Union[str, "_models.ConflictResolutionMode"] = "LastWriterWins", - conflict_resolution_path: Optional[str] = None, - conflict_resolution_procedure: Optional[str] = None, - **kwargs: Any + self, *, included_paths: List["_models.ClientEncryptionIncludedPath"], policy_format_version: int, **kwargs: Any ) -> None: """ - :keyword mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and - "Custom". - :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 + :keyword included_paths: Paths of the item that need encryption along with path-specific + settings. Required. + :paramtype included_paths: list[~azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath] + :keyword policy_format_version: Version of the client encryption policy definition. Supported + versions are 1 and 2. Version 2 supports id and partition key path encryption. Required. + :paramtype policy_format_version: int """ super().__init__(**kwargs) - self.mode = mode - self.conflict_resolution_path = conflict_resolution_path - self.conflict_resolution_procedure = conflict_resolution_procedure + self.included_paths = included_paths + self.policy_format_version = policy_format_version -class ConnectionError(_serialization.Model): - """ConnectionError. +class ClusterKey(_serialization.Model): + """Cosmos DB Cassandra table cluster key. - :ivar connection_state: The kind of connection error that occurred. Known values are: - "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", - "InternalOperatorToDataCenterCertificateError", and "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 + :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 = { - "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"}, + "name": {"key": "name", "type": "str"}, + "order_by": {"key": "orderBy", "type": "str"}, } - def __init__( - self, - *, - 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: Any - ) -> None: + def __init__(self, *, name: Optional[str] = None, order_by: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword connection_state: The kind of connection error that occurred. Known values are: - "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", - "InternalOperatorToDataCenterCertificateError", and "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 + :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().__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 + self.name = name + self.order_by = order_by -class ConsistencyPolicy(_serialization.Model): - """The consistency policy for the Cosmos DB database account. +class ManagedCassandraARMResourceProperties(_serialization.Model): + """The core properties of ARM resources. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar default_consistency_level: The default consistency level and configuration settings of - the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", - "Strong", and "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: int - :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 + :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: 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 """ _validation = { - "default_consistency_level": {"required": True}, - "max_staleness_prefix": {"maximum": 2147483647, "minimum": 1}, - "max_interval_in_seconds": {"maximum": 86400, "minimum": 5}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { - "default_consistency_level": {"key": "defaultConsistencyLevel", "type": "str"}, - "max_staleness_prefix": {"key": "maxStalenessPrefix", "type": "int"}, - "max_interval_in_seconds": {"key": "maxIntervalInSeconds", "type": "int"}, + "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"}, } def __init__( self, *, - default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], - max_staleness_prefix: Optional[int] = None, - max_interval_in_seconds: Optional[int] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, **kwargs: Any ) -> None: """ - :keyword default_consistency_level: The default consistency level and configuration settings of - the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", - "Strong", and "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: int - :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 + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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 """ super().__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 + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.identity = identity -class ContainerPartitionKey(_serialization.Model): - """The configuration of the partition key to be used for partitioning data into multiple - partitions. +class ClusterResource(ManagedCassandraARMResourceProperties): + """Representation of a managed Cassandra cluster. 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. Known values are: - "Hash", "Range", and "MultiHash". - :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 + :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: 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 = { - "version": {"maximum": 2, "minimum": 1}, - "system_key": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"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"}, + "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, *, - paths: Optional[List[str]] = None, - kind: Union[str, "_models.PartitionKind"] = "Hash", - version: Optional[int] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, + properties: Optional["_models.ClusterResourceProperties"] = None, **kwargs: Any ) -> None: """ - :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", and "MultiHash". - :paramtype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind - :keyword version: Indicates the version of the partition key definition. - :paramtype version: int - """ - super().__init__(**kwargs) - self.paths = paths - self.kind = kind - self.version = version - self.system_key = None - - -class ContinuousBackupInformation(_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: Any) -> None: - """ - :keyword latest_restorable_timestamp: The latest restorable timestamp for a resource. - :paramtype latest_restorable_timestamp: str - """ - super().__init__(**kwargs) - self.latest_restorable_timestamp = latest_restorable_timestamp - - -class ContinuousBackupRestoreLocation(_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: Any) -> None: - """ - :keyword location: The name of the continuous backup restore location. + :keyword location: The location of the resource group to which the resource belongs. :paramtype location: str + :keyword 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().__init__(**kwargs) - self.location = location + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.properties = properties -class ContinuousModeBackupPolicy(BackupPolicy): - """The object representing continuous mode backup policy. +class ClusterResourceProperties(_serialization.Model): + """Properties of a managed Cassandra cluster. - All required parameters must be populated in order to send to server. + 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. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "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", and "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 auto_replicate: The form of AutoReplicate that is being used by this cluster. Known + values are: "None", "SystemKeyspaces", and "AllKeyspaces". + :vartype auto_replicate: str or ~azure.mgmt.cosmosdb.models.AutoReplicate + :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 external_data_centers: List of the data center names for unmanaged data centers in this + cluster to be included in auto-replication. + :vartype external_data_centers: list[str] + :ivar hours_between_backups: (Deprecated) 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 + :ivar cluster_type: Type of the cluster. If set to Production, some operations might not be + permitted on cluster. Known values are: "Production" and "NonProduction". + :vartype cluster_type: str or ~azure.mgmt.cosmosdb.models.ClusterType + :ivar provision_error: Error related to resource provisioning. + :vartype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError + :ivar extensions: Extensions to be added or updated on cluster. + :vartype extensions: list[str] + :ivar backup_schedules: List of backup schedules that define when you want to back up your + data. + :vartype backup_schedules: list[~azure.mgmt.cosmosdb.models.BackupSchedule] + :ivar scheduled_event_strategy: How the nodes in the cluster react to scheduled events. Known + values are: "Ignore", "StopAny", and "StopByRack". + :vartype scheduled_event_strategy: str or ~azure.mgmt.cosmosdb.models.ScheduledEventStrategy + :ivar azure_connection_method: How to connect to the azure services needed for running the + cluster. Known values are: "None" and "VPN". + :vartype azure_connection_method: str or ~azure.mgmt.cosmosdb.models.AzureConnectionType + :ivar private_link_resource_id: If the Connection Method is Vpn, this is the Id of the private + link resource that the datacenters need to connect to. + :vartype private_link_resource_id: str + """ + + _validation = { + "gossip_certificates": {"readonly": True}, + "seed_nodes": {"readonly": True}, + "private_link_resource_id": {"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"}, + "auto_replicate": {"key": "autoReplicate", "type": "str"}, + "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]"}, + "external_data_centers": {"key": "externalDataCenters", "type": "[str]"}, + "hours_between_backups": {"key": "hoursBetweenBackups", "type": "int"}, + "deallocated": {"key": "deallocated", "type": "bool"}, + "cassandra_audit_logging_enabled": {"key": "cassandraAuditLoggingEnabled", "type": "bool"}, + "cluster_type": {"key": "clusterType", "type": "str"}, + "provision_error": {"key": "provisionError", "type": "CassandraError"}, + "extensions": {"key": "extensions", "type": "[str]"}, + "backup_schedules": {"key": "backupSchedules", "type": "[BackupSchedule]"}, + "scheduled_event_strategy": {"key": "scheduledEventStrategy", "type": "str"}, + "azure_connection_method": {"key": "azureConnectionMethod", "type": "str"}, + "private_link_resource_id": {"key": "privateLinkResourceId", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + 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, + auto_replicate: Optional[Union[str, "_models.AutoReplicate"]] = None, + client_certificates: Optional[List["_models.Certificate"]] = None, + external_gossip_certificates: Optional[List["_models.Certificate"]] = None, + external_seed_nodes: Optional[List["_models.SeedNode"]] = None, + external_data_centers: Optional[List[str]] = None, + hours_between_backups: Optional[int] = None, + deallocated: Optional[bool] = None, + cassandra_audit_logging_enabled: Optional[bool] = None, + cluster_type: Optional[Union[str, "_models.ClusterType"]] = None, + provision_error: Optional["_models.CassandraError"] = None, + extensions: Optional[List[str]] = None, + backup_schedules: Optional[List["_models.BackupSchedule"]] = None, + scheduled_event_strategy: Optional[Union[str, "_models.ScheduledEventStrategy"]] = None, + azure_connection_method: Optional[Union[str, "_models.AzureConnectionType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword provisioning_state: The status of the resource at the time the operation was called. + Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "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", and "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 auto_replicate: The form of AutoReplicate that is being used by this cluster. Known + values are: "None", "SystemKeyspaces", and "AllKeyspaces". + :paramtype auto_replicate: str or ~azure.mgmt.cosmosdb.models.AutoReplicate + :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 external_data_centers: List of the data center names for unmanaged data centers in + this cluster to be included in auto-replication. + :paramtype external_data_centers: list[str] + :keyword hours_between_backups: (Deprecated) 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 + :keyword cluster_type: Type of the cluster. If set to Production, some operations might not be + permitted on cluster. Known values are: "Production" and "NonProduction". + :paramtype cluster_type: str or ~azure.mgmt.cosmosdb.models.ClusterType + :keyword provision_error: Error related to resource provisioning. + :paramtype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError + :keyword extensions: Extensions to be added or updated on cluster. + :paramtype extensions: list[str] + :keyword backup_schedules: List of backup schedules that define when you want to back up your + data. + :paramtype backup_schedules: list[~azure.mgmt.cosmosdb.models.BackupSchedule] + :keyword scheduled_event_strategy: How the nodes in the cluster react to scheduled events. + Known values are: "Ignore", "StopAny", and "StopByRack". + :paramtype scheduled_event_strategy: str or ~azure.mgmt.cosmosdb.models.ScheduledEventStrategy + :keyword azure_connection_method: How to connect to the azure services needed for running the + cluster. Known values are: "None" and "VPN". + :paramtype azure_connection_method: str or ~azure.mgmt.cosmosdb.models.AzureConnectionType + """ + super().__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.auto_replicate = auto_replicate + 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.external_data_centers = external_data_centers + self.hours_between_backups = hours_between_backups + self.deallocated = deallocated + self.cassandra_audit_logging_enabled = cassandra_audit_logging_enabled + self.cluster_type = cluster_type + self.provision_error = provision_error + self.extensions = extensions + self.backup_schedules = backup_schedules + self.scheduled_event_strategy = scheduled_event_strategy + self.azure_connection_method = azure_connection_method + self.private_link_resource_id = None + + +class Column(_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: Any) -> None: + """ + :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().__init__(**kwargs) + self.name = name + self.type = type + + +class CommandAsyncPostBody(_serialization.Model): + """Specification of which command to run where. + + All required parameters must be populated in order to send to server. + + :ivar command: The command which should be run. Required. + :vartype command: str + :ivar arguments: The arguments for the command to be run. + :vartype arguments: JSON + :ivar host: IP address of the cassandra host to run the command on. Required. + :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 read_write: If true, allows the command to *write* to the cassandra directory, otherwise + read-only. + :vartype read_write: bool + """ + + _validation = { + "command": {"required": True}, + "host": {"required": True}, + } + + _attribute_map = { + "command": {"key": "command", "type": "str"}, + "arguments": {"key": "arguments", "type": "object"}, + "host": {"key": "host", "type": "str"}, + "cassandra_stop_start": {"key": "cassandra-stop-start", "type": "bool"}, + "read_write": {"key": "readWrite", "type": "bool"}, + } + + def __init__( + self, + *, + command: str, + host: str, + arguments: Optional[JSON] = None, + cassandra_stop_start: Optional[bool] = None, + read_write: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword command: The command which should be run. Required. + :paramtype command: str + :keyword arguments: The arguments for the command to be run. + :paramtype arguments: JSON + :keyword host: IP address of the cassandra host to run the command on. Required. + :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 read_write: If true, allows the command to *write* to the cassandra directory, + otherwise read-only. + :paramtype read_write: bool + """ + super().__init__(**kwargs) + self.command = command + self.arguments = arguments + self.host = host + self.cassandra_stop_start = cassandra_stop_start + self.read_write = read_write + + +class CommandOutput(_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: Any) -> None: + """ + :keyword command_output: Output of the command. + :paramtype command_output: str + """ + super().__init__(**kwargs) + self.command_output = command_output + + +class CommandPostBody(_serialization.Model): + """Specification of which command to run where. + + All required parameters must be populated in order to send to server. + + :ivar command: The command which should be run. Required. + :vartype command: str + :ivar arguments: The arguments for the command to be run. + :vartype arguments: dict[str, str] + :ivar host: IP address of the cassandra host to run the command on. Required. + :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: Any + ) -> None: + """ + :keyword command: The command which should be run. Required. + :paramtype command: str + :keyword arguments: The arguments for the command to be run. + :paramtype arguments: dict[str, str] + :keyword host: IP address of the cassandra host to run the command on. Required. + :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().__init__(**kwargs) + self.command = command + self.arguments = arguments + self.host = host + self.cassandra_stop_start = cassandra_stop_start + self.readwrite = readwrite + + +class CommandPublicResource(_serialization.Model): + """resource representing a command. + + :ivar command: The command which should be run. + :vartype command: str + :ivar command_id: The unique id of command. + :vartype command_id: str + :ivar arguments: The arguments for the command to be run. + :vartype arguments: JSON + :ivar host: IP address of the cassandra host to run the command on. + :vartype host: str + :ivar is_admin: Whether command has admin privileges. + :vartype is_admin: bool + :ivar cassandra_stop_start: If true, stops cassandra before executing the command and then + start it again. + :vartype cassandra_stop_start: bool + :ivar read_write: If true, allows the command to *write* to the cassandra directory, otherwise + read-only. + :vartype read_write: bool + :ivar result: Result output of the command. + :vartype result: str + :ivar status: Status of the command. Known values are: "Done", "Running", "Enqueue", + "Processing", "Finished", and "Failed". + :vartype status: str or ~azure.mgmt.cosmosdb.models.CommandStatus + :ivar output_file: The name of the file where the result is written. + :vartype output_file: str + """ + + _attribute_map = { + "command": {"key": "command", "type": "str"}, + "command_id": {"key": "commandId", "type": "str"}, + "arguments": {"key": "arguments", "type": "object"}, + "host": {"key": "host", "type": "str"}, + "is_admin": {"key": "isAdmin", "type": "bool"}, + "cassandra_stop_start": {"key": "cassandraStopStart", "type": "bool"}, + "read_write": {"key": "readWrite", "type": "bool"}, + "result": {"key": "result", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "output_file": {"key": "outputFile", "type": "str"}, + } + + def __init__( + self, + *, + command: Optional[str] = None, + command_id: Optional[str] = None, + arguments: Optional[JSON] = None, + host: Optional[str] = None, + is_admin: Optional[bool] = None, + cassandra_stop_start: Optional[bool] = None, + read_write: Optional[bool] = None, + result: Optional[str] = None, + status: Optional[Union[str, "_models.CommandStatus"]] = None, + output_file: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword command: The command which should be run. + :paramtype command: str + :keyword command_id: The unique id of command. + :paramtype command_id: str + :keyword arguments: The arguments for the command to be run. + :paramtype arguments: JSON + :keyword host: IP address of the cassandra host to run the command on. + :paramtype host: str + :keyword is_admin: Whether command has admin privileges. + :paramtype is_admin: bool + :keyword cassandra_stop_start: If true, stops cassandra before executing the command and then + start it again. + :paramtype cassandra_stop_start: bool + :keyword read_write: If true, allows the command to *write* to the cassandra directory, + otherwise read-only. + :paramtype read_write: bool + :keyword result: Result output of the command. + :paramtype result: str + :keyword status: Status of the command. Known values are: "Done", "Running", "Enqueue", + "Processing", "Finished", and "Failed". + :paramtype status: str or ~azure.mgmt.cosmosdb.models.CommandStatus + :keyword output_file: The name of the file where the result is written. + :paramtype output_file: str + """ + super().__init__(**kwargs) + self.command = command + self.command_id = command_id + self.arguments = arguments + self.host = host + self.is_admin = is_admin + self.cassandra_stop_start = cassandra_stop_start + self.read_write = read_write + self.result = result + self.status = status + self.output_file = output_file + + +class CompositePath(_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. Known values are: "ascending" and "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, "_models.CompositePathSortOrder"]] = None, + **kwargs: Any + ) -> None: + """ + :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. Known values are: "ascending" and "descending". + :paramtype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder + """ + super().__init__(**kwargs) + self.path = path + self.order = order + + +class ComputedProperty(_serialization.Model): + """The definition of a computed property. + + :ivar name: The name of a computed property, for example - "cp_lowerName". + :vartype name: str + :ivar query: The query that evaluates the value for computed property, for example - "SELECT + VALUE LOWER(c.name) FROM c". + :vartype query: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "query": {"key": "query", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, query: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: The name of a computed property, for example - "cp_lowerName". + :paramtype name: str + :keyword query: The query that evaluates the value for computed property, for example - "SELECT + VALUE LOWER(c.name) FROM c". + :paramtype query: str + """ + super().__init__(**kwargs) + self.name = name + self.query = query + + +class ConflictResolutionPolicy(_serialization.Model): + """The conflict resolution policy for the container. + + :ivar mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and + "Custom". + :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: Union[str, "_models.ConflictResolutionMode"] = "LastWriterWins", + conflict_resolution_path: Optional[str] = None, + conflict_resolution_procedure: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and + "Custom". + :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().__init__(**kwargs) + self.mode = mode + self.conflict_resolution_path = conflict_resolution_path + self.conflict_resolution_procedure = conflict_resolution_procedure + + +class ConnectionError(_serialization.Model): + """ConnectionError. + + :ivar connection_state: The kind of connection error that occurred. Known values are: + "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", + "InternalOperatorToDataCenterCertificateError", and "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, "_models.ConnectionState"]] = None, + i_p_from: Optional[str] = None, + i_p_to: Optional[str] = None, + port: Optional[int] = None, + exception: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword connection_state: The kind of connection error that occurred. Known values are: + "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", + "InternalOperatorToDataCenterCertificateError", and "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().__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(_serialization.Model): + """The consistency policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to server. + + :ivar default_consistency_level: The default consistency level and configuration settings of + the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", + "Strong", and "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: int + :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": "int"}, + "max_interval_in_seconds": {"key": "maxIntervalInSeconds", "type": "int"}, + } + + def __init__( + self, + *, + default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], + max_staleness_prefix: Optional[int] = None, + max_interval_in_seconds: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword default_consistency_level: The default consistency level and configuration settings of + the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", + "Strong", and "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: int + :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().__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(_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. Known values are: + "Hash", "Range", and "MultiHash". + :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: Union[str, "_models.PartitionKind"] = "Hash", + version: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :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", and "MultiHash". + :paramtype kind: str or ~azure.mgmt.cosmosdb.models.PartitionKind + :keyword version: Indicates the version of the partition key definition. + :paramtype version: int + """ + super().__init__(**kwargs) + self.paths = paths + self.kind = kind + self.version = version + self.system_key = None + + +class ContinuousBackupInformation(_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: Any) -> None: + """ + :keyword latest_restorable_timestamp: The latest restorable timestamp for a resource. + :paramtype latest_restorable_timestamp: str + """ + super().__init__(**kwargs) + self.latest_restorable_timestamp = latest_restorable_timestamp + + +class ContinuousBackupRestoreLocation(_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: Any) -> None: + """ + :keyword location: The name of the continuous backup restore location. + :paramtype location: str + """ + super().__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 server. :ivar type: Describes the mode of backups. Required. Known values are: "Periodic" and "Continuous". @@ -2680,8 +3787,8 @@ def __init__( class ContinuousModeProperties(_serialization.Model): """Configuration values for periodic mode backup. - :ivar tier: Enum to indicate type of Continuous backup mode. Known values are: - "Continuous7Days" and "Continuous30Days". + :ivar tier: Enum to indicate type of Continuos backup mode. Known values are: "Continuous7Days" + and "Continuous30Days". :vartype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier """ @@ -2691,7 +3798,7 @@ class ContinuousModeProperties(_serialization.Model): def __init__(self, *, tier: Optional[Union[str, "_models.ContinuousTier"]] = None, **kwargs: Any) -> None: """ - :keyword tier: Enum to indicate type of Continuous backup mode. Known values are: + :keyword tier: Enum to indicate type of Continuos backup mode. Known values are: "Continuous7Days" and "Continuous30Days". :paramtype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier """ @@ -2699,74 +3806,311 @@ def __init__(self, *, tier: Optional[Union[str, "_models.ContinuousTier"]] = Non self.tier = tier -class CorsPolicy(_serialization.Model): - """The CORS policy for the Cosmos DB database account. +class CorsPolicy(_serialization.Model): + """The CORS policy for the Cosmos DB database account. + + All required parameters must be populated in order to send to server. + + :ivar allowed_origins: The origin domains that are permitted to make a request against the + service via CORS. Required. + :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: int + """ + + _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": "int"}, + } + + 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: Any + ) -> None: + """ + :keyword allowed_origins: The origin domains that are permitted to make a request against the + service via CORS. Required. + :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: int + """ + super().__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(BaseCosmosDataTransferDataSourceSink): # pylint: disable=name-too-long + """A CosmosDB Cassandra API data source/sink. + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + :ivar remote_account_name: + :vartype remote_account_name: str + :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"}, + "remote_account_name": {"key": "remoteAccountName", "type": "str"}, + "keyspace_name": {"key": "keyspaceName", "type": "str"}, + "table_name": {"key": "tableName", "type": "str"}, + } + + def __init__( + self, *, keyspace_name: str, table_name: str, remote_account_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword remote_account_name: + :paramtype remote_account_name: str + :keyword keyspace_name: Required. + :paramtype keyspace_name: str + :keyword table_name: Required. + :paramtype table_name: str + """ + super().__init__(remote_account_name=remote_account_name, **kwargs) + self.component: str = "CosmosDBCassandra" + self.keyspace_name = keyspace_name + self.table_name = table_name + + +class CosmosMongoDataTransferDataSourceSink(BaseCosmosDataTransferDataSourceSink): + """A CosmosDB Mongo API data source/sink. + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + :ivar remote_account_name: + :vartype remote_account_name: str + :ivar database_name: Required. + :vartype database_name: str + :ivar collection_name: Required. + :vartype collection_name: str + """ + + _validation = { + "component": {"required": True}, + "database_name": {"required": True}, + "collection_name": {"required": True}, + } + + _attribute_map = { + "component": {"key": "component", "type": "str"}, + "remote_account_name": {"key": "remoteAccountName", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "collection_name": {"key": "collectionName", "type": "str"}, + } + + def __init__( + self, *, database_name: str, collection_name: str, remote_account_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword remote_account_name: + :paramtype remote_account_name: str + :keyword database_name: Required. + :paramtype database_name: str + :keyword collection_name: Required. + :paramtype collection_name: str + """ + super().__init__(remote_account_name=remote_account_name, **kwargs) + self.component: str = "CosmosDBMongo" + self.database_name = database_name + self.collection_name = collection_name + + +class CosmosMongoVCoreDataTransferDataSourceSink(DataTransferDataSourceSink): # pylint: disable=name-too-long + """A CosmosDB Mongo vCore API data source/sink. + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + :ivar database_name: Required. + :vartype database_name: str + :ivar collection_name: Required. + :vartype collection_name: str + :ivar host_name: + :vartype host_name: str + :ivar connection_string_key_vault_uri: + :vartype connection_string_key_vault_uri: str + """ + + _validation = { + "component": {"required": True}, + "database_name": {"required": True}, + "collection_name": {"required": True}, + } + + _attribute_map = { + "component": {"key": "component", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "collection_name": {"key": "collectionName", "type": "str"}, + "host_name": {"key": "hostName", "type": "str"}, + "connection_string_key_vault_uri": {"key": "connectionStringKeyVaultUri", "type": "str"}, + } + + def __init__( + self, + *, + database_name: str, + collection_name: str, + host_name: Optional[str] = None, + connection_string_key_vault_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword database_name: Required. + :paramtype database_name: str + :keyword collection_name: Required. + :paramtype collection_name: str + :keyword host_name: + :paramtype host_name: str + :keyword connection_string_key_vault_uri: + :paramtype connection_string_key_vault_uri: str + """ + super().__init__(**kwargs) + self.component: str = "CosmosDBMongoVCore" + self.database_name = database_name + self.collection_name = collection_name + self.host_name = host_name + self.connection_string_key_vault_uri = connection_string_key_vault_uri + + +class CosmosSqlDataTransferDataSourceSink(BaseCosmosDataTransferDataSourceSink): + """A CosmosDB No Sql API data source/sink. + + All required parameters must be populated in order to send to server. + + :ivar component: Known values are: "CosmosDBCassandra", "CosmosDBMongo", "CosmosDBMongoVCore", + "CosmosDBSql", and "AzureBlobStorage". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + :ivar remote_account_name: + :vartype remote_account_name: str + :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"}, + "remote_account_name": {"key": "remoteAccountName", "type": "str"}, + "database_name": {"key": "databaseName", "type": "str"}, + "container_name": {"key": "containerName", "type": "str"}, + } + + def __init__( + self, *, database_name: str, container_name: str, remote_account_name: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword remote_account_name: + :paramtype remote_account_name: str + :keyword database_name: Required. + :paramtype database_name: str + :keyword container_name: Required. + :paramtype container_name: str + """ + super().__init__(remote_account_name=remote_account_name, **kwargs) + self.component: str = "CosmosDBSql" + 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 server. - :ivar allowed_origins: The origin domains that are permitted to make a request against the - service via CORS. Required. - :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: int + :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: Data Transfer Create Job Properties. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties """ _validation = { - "allowed_origins": {"required": True}, - "max_age_in_seconds": {"maximum": 2147483647, "minimum": 1}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, } _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": "int"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "DataTransferJobProperties"}, } - 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: Any - ) -> None: + def __init__(self, *, properties: "_models.DataTransferJobProperties", **kwargs: Any) -> None: """ - :keyword allowed_origins: The origin domains that are permitted to make a request against the - service via CORS. Required. - :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: int + :keyword properties: Data Transfer Create Job Properties. Required. + :paramtype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties """ super().__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 + self.properties = properties class CreateUpdateOptions(_serialization.Model): @@ -2845,7 +4189,7 @@ def __init__(self, **kwargs: Any) -> None: self.type = None -class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: disable=too-many-instance-attributes +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. @@ -2867,11 +4211,11 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d 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. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :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 @@ -2936,6 +4280,9 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :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 @@ -2944,6 +4291,12 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity + :ivar capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :vartype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :vartype enable_materialized_views: bool :ivar keys_metadata: This property is ignored during the update/create operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. @@ -2951,18 +4304,24 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool - :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default value is Tls - 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on - the account. + :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :vartype enable_burst_capacity: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :vartype customer_managed_key_status: str + :ivar enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :vartype enable_priority_based_execution: bool + :ivar default_priority_level: Enum to indicate default Priority Level of request for Priority + Based Execution. Known values are: "High" and "Low". + :vartype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :vartype enable_per_region_per_partition_autoscale: bool """ @@ -2981,8 +4340,8 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d "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"}, + "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"}, @@ -3013,14 +4372,19 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): # pylint: d "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"}, + "capacity_mode": {"key": "properties.capacityMode", "type": "str"}, + "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, - "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "enable_burst_capacity": {"key": "properties.enableBurstCapacity", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "customer_managed_key_status": {"key": "properties.customerManagedKeyStatus", "type": "str"}, + "enable_priority_based_execution": {"key": "properties.enablePriorityBasedExecution", "type": "bool"}, + "default_priority_level": {"key": "properties.defaultPriorityLevel", "type": "str"}, "enable_per_region_per_partition_autoscale": { "key": "properties.enablePerRegionPerPartitionAutoscale", "type": "bool", @@ -3035,8 +4399,8 @@ def __init__( # pylint: disable=too-many-locals locations: List["_models.Location"], location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, consistency_policy: Optional["_models.ConsistencyPolicy"] = None, ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, @@ -3059,13 +4423,18 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, restore_parameters: Optional["_models.RestoreParameters"] = None, capacity: Optional["_models.Capacity"] = None, + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = None, + enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, enable_burst_capacity: Optional[bool] = None, + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, customer_managed_key_status: Optional[str] = None, + enable_priority_based_execution: Optional[bool] = None, + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = None, enable_per_region_per_partition_autoscale: Optional[bool] = None, **kwargs: Any ) -> None: @@ -3079,11 +4448,11 @@ def __init__( # pylint: disable=too-many-locals 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. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :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 @@ -3146,6 +4515,9 @@ def __init__( # pylint: disable=too-many-locals :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 @@ -3154,26 +4526,37 @@ def __init__( # pylint: disable=too-many-locals :keyword capacity: The object that represents all properties related to capacity enforcement on an account. :paramtype capacity: ~azure.mgmt.cosmosdb.models.Capacity + :keyword capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :paramtype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool - :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default value is - Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature - on the account. + :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :paramtype enable_burst_capacity: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :paramtype customer_managed_key_status: str + :keyword enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :paramtype enable_priority_based_execution: bool + :keyword default_priority_level: Enum to indicate default Priority Level of request for + Priority Based Execution. Known values are: "High" and "Low". + :paramtype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :keyword enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :paramtype enable_per_region_per_partition_autoscale: bool """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.kind = kind - self.identity = identity self.consistency_policy = consistency_policy self.locations = locations self.ip_rules = ip_rules @@ -3197,18 +4580,23 @@ def __init__( # pylint: disable=too-many-locals 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.capacity_mode = capacity_mode + self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge - self.minimal_tls_version = minimal_tls_version self.enable_burst_capacity = enable_burst_capacity + self.minimal_tls_version = minimal_tls_version self.customer_managed_key_status = customer_managed_key_status + self.enable_priority_based_execution = enable_priority_based_execution + self.default_priority_level = default_priority_level self.enable_per_region_per_partition_autoscale = enable_per_region_per_partition_autoscale -class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-many-instance-attributes +class DatabaseAccountGetResults(ARMResourceProperties): """An Azure Cosmos DB database account. Variables are only populated by the server, and will be ignored when sending a request. @@ -3228,20 +4616,14 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m 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. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :vartype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :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. + :ivar provisioning_state: The provisioning state of the resource. :vartype provisioning_state: str :ivar document_endpoint: The connection endpoint for the Cosmos DB database account. :vartype document_endpoint: str @@ -3324,30 +4706,49 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m :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 capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :vartype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :ivar capacity_mode_change_transition_state: The object that represents the migration state for + the CapacityMode of the Cosmos DB account. + :vartype capacity_mode_change_transition_state: + ~azure.mgmt.cosmosdb.models.CapacityModeChangeTransitionState + :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :vartype enable_materialized_views: bool :ivar keys_metadata: The object that represents the metadata for the Account Keys of the Cosmos DB account. :vartype keys_metadata: ~azure.mgmt.cosmosdb.models.DatabaseAccountKeysMetadata :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool - :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default value is Tls - 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on - the account. + :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :vartype enable_burst_capacity: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :vartype customer_managed_key_status: str + :ivar enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :vartype enable_priority_based_execution: bool + :ivar default_priority_level: Enum to indicate default Priority Level of request for Priority + Based Execution. Known values are: "High" and "Low". + :vartype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :vartype enable_per_region_per_partition_autoscale: bool """ @@ -3374,8 +4775,8 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m "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"}, + "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"}, @@ -3418,13 +4819,22 @@ class DatabaseAccountGetResults(ARMResourceProperties): # pylint: disable=too-m "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"}, + "capacity_mode": {"key": "properties.capacityMode", "type": "str"}, + "capacity_mode_change_transition_state": { + "key": "properties.capacityModeChangeTransitionState", + "type": "CapacityModeChangeTransitionState", + }, + "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, - "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "enable_burst_capacity": {"key": "properties.enableBurstCapacity", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "customer_managed_key_status": {"key": "properties.customerManagedKeyStatus", "type": "str"}, + "enable_priority_based_execution": {"key": "properties.enablePriorityBasedExecution", "type": "bool"}, + "default_priority_level": {"key": "properties.defaultPriorityLevel", "type": "str"}, "enable_per_region_per_partition_autoscale": { "key": "properties.enablePerRegionPerPartitionAutoscale", "type": "bool", @@ -3436,8 +4846,8 @@ def __init__( # pylint: disable=too-many-locals *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, ip_rules: Optional[List["_models.IpAddressOrRange"]] = None, is_virtual_network_filter_enabled: Optional[bool] = None, enable_automatic_failover: Optional[bool] = None, @@ -3461,12 +4871,18 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, capacity: Optional["_models.Capacity"] = None, + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = None, + capacity_mode_change_transition_state: Optional["_models.CapacityModeChangeTransitionState"] = None, + enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, enable_burst_capacity: Optional[bool] = None, + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, customer_managed_key_status: Optional[str] = None, + enable_priority_based_execution: Optional[bool] = None, + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = None, enable_per_region_per_partition_autoscale: Optional[bool] = None, **kwargs: Any ) -> None: @@ -3480,11 +4896,11 @@ def __init__( # pylint: disable=too-many-locals 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. Known values are: "GlobalDocumentDB", "MongoDB", and "Parse". :paramtype kind: str or ~azure.mgmt.cosmosdb.models.DatabaseAccountKind - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity :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 @@ -3546,32 +4962,50 @@ def __init__( # pylint: disable=too-many-locals :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 capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :paramtype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :keyword capacity_mode_change_transition_state: The object that represents the migration state + for the CapacityMode of the Cosmos DB account. + :paramtype capacity_mode_change_transition_state: + ~azure.mgmt.cosmosdb.models.CapacityModeChangeTransitionState + :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool - :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default value is - Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature - on the account. + :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :paramtype enable_burst_capacity: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :paramtype customer_managed_key_status: str + :keyword enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :paramtype enable_priority_based_execution: bool + :keyword default_priority_level: Enum to indicate default Priority Level of request for + Priority Based Execution. Known values are: "High" and "Low". + :paramtype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :keyword enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :paramtype enable_per_region_per_partition_autoscale: bool """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.kind = kind - self.identity = identity self.system_data = None self.provisioning_state = None self.document_endpoint = None @@ -3605,13 +5039,19 @@ def __init__( # pylint: disable=too-many-locals 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.capacity_mode = capacity_mode + self.capacity_mode_change_transition_state = capacity_mode_change_transition_state + self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge - self.minimal_tls_version = minimal_tls_version self.enable_burst_capacity = enable_burst_capacity + self.minimal_tls_version = minimal_tls_version self.customer_managed_key_status = customer_managed_key_status + self.enable_priority_based_execution = enable_priority_based_execution + self.default_priority_level = default_priority_level self.enable_per_region_per_partition_autoscale = enable_per_region_per_partition_autoscale @@ -3797,7 +5237,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DatabaseAccountUpdateParameters(_serialization.Model): """Parameters for patching Azure Cosmos DB database account properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -3871,30 +5311,45 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable= :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 capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :vartype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :ivar enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :vartype enable_materialized_views: bool :ivar keys_metadata: This property is ignored during the update operation, as the metadata is read-only. The object represents the metadata for the Account Keys of the Cosmos DB account. :vartype keys_metadata: ~azure.mgmt.cosmosdb.models.DatabaseAccountKeysMetadata :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :vartype enable_partition_merge: bool - :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default value is Tls - 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature on - the account. + :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :vartype enable_burst_capacity: bool + :ivar minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls 1.0, + except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: "Tls", + "Tls11", and "Tls12". + :vartype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :ivar customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :vartype customer_managed_key_status: str + :ivar enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :vartype enable_priority_based_execution: bool + :ivar default_priority_level: Enum to indicate default Priority Level of request for Priority + Based Execution. Known values are: "High" and "Low". + :vartype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :vartype enable_per_region_per_partition_autoscale: bool """ @@ -3934,13 +5389,18 @@ class DatabaseAccountUpdateParameters(_serialization.Model): # pylint: disable= "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"}, + "capacity_mode": {"key": "properties.capacityMode", "type": "str"}, + "enable_materialized_views": {"key": "properties.enableMaterializedViews", "type": "bool"}, "keys_metadata": {"key": "properties.keysMetadata", "type": "DatabaseAccountKeysMetadata"}, "enable_partition_merge": {"key": "properties.enablePartitionMerge", "type": "bool"}, - "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "enable_burst_capacity": {"key": "properties.enableBurstCapacity", "type": "bool"}, + "minimal_tls_version": {"key": "properties.minimalTlsVersion", "type": "str"}, "customer_managed_key_status": {"key": "properties.customerManagedKeyStatus", "type": "str"}, + "enable_priority_based_execution": {"key": "properties.enablePriorityBasedExecution", "type": "bool"}, + "default_priority_level": {"key": "properties.defaultPriorityLevel", "type": "str"}, "enable_per_region_per_partition_autoscale": { "key": "properties.enablePerRegionPerPartitionAutoscale", "type": "bool", @@ -3975,12 +5435,17 @@ def __init__( # pylint: disable=too-many-locals cors: Optional[List["_models.CorsPolicy"]] = None, network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, network_acl_bypass_resource_ids: Optional[List[str]] = None, + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = None, disable_local_auth: Optional[bool] = None, capacity: Optional["_models.Capacity"] = None, + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = None, + enable_materialized_views: Optional[bool] = None, enable_partition_merge: Optional[bool] = None, - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, enable_burst_capacity: Optional[bool] = None, + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = None, customer_managed_key_status: Optional[str] = None, + enable_priority_based_execution: Optional[bool] = None, + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = None, enable_per_region_per_partition_autoscale: Optional[bool] = None, **kwargs: Any ) -> None: @@ -4055,27 +5520,42 @@ def __init__( # pylint: disable=too-many-locals :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 capacity_mode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :paramtype capacity_mode: str or ~azure.mgmt.cosmosdb.models.CapacityMode + :keyword enable_materialized_views: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :paramtype enable_materialized_views: bool :keyword enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on the account. :paramtype enable_partition_merge: bool - :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default value is - Tls 1.2. Cassandra and Mongo APIs only work with Tls 1.2. Known values are: "Tls", "Tls11", and - "Tls12". - :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion - :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity feature - on the account. + :keyword enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + feature on the account. :paramtype enable_burst_capacity: bool + :keyword minimal_tls_version: Indicates the minimum allowed Tls version. The default is Tls + 1.0, except for Cassandra and Mongo API's, which only work with Tls 1.2. Known values are: + "Tls", "Tls11", and "Tls12". + :paramtype minimal_tls_version: str or ~azure.mgmt.cosmosdb.models.MinimalTlsVersion :keyword customer_managed_key_status: Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance. :paramtype customer_managed_key_status: str + :keyword enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + Execution Preview feature on the account. + :paramtype enable_priority_based_execution: bool + :keyword default_priority_level: Enum to indicate default Priority Level of request for + Priority Based Execution. Known values are: "High" and "Low". + :paramtype default_priority_level: str or ~azure.mgmt.cosmosdb.models.DefaultPriorityLevel :keyword enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - PerRegionPerPartitionAutoscale feature on the account. + Per-Region Per-partition autoscale Preview feature on the account. :paramtype enable_per_region_per_partition_autoscale: bool """ super().__init__(**kwargs) @@ -4104,13 +5584,18 @@ def __init__( # pylint: disable=too-many-locals 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.capacity_mode = capacity_mode + self.enable_materialized_views = enable_materialized_views self.keys_metadata = None self.enable_partition_merge = enable_partition_merge - self.minimal_tls_version = minimal_tls_version self.enable_burst_capacity = enable_burst_capacity + self.minimal_tls_version = minimal_tls_version self.customer_managed_key_status = customer_managed_key_status + self.enable_priority_based_execution = enable_priority_based_execution + self.default_priority_level = default_priority_level self.enable_per_region_per_partition_autoscale = enable_per_region_per_partition_autoscale @@ -4179,7 +5664,7 @@ def __init__(self, *, properties: Optional["_models.DataCenterResourceProperties self.properties = properties -class DataCenterResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DataCenterResourceProperties(_serialization.Model): """Properties of a managed Cassandra data center. Variables are only populated by the server, and will be ignored when sending a request. @@ -4353,6 +5838,224 @@ def __init__( self.private_endpoint_ip_address = private_endpoint_ip_address +class DataTransferJobFeedResults(_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: Any) -> None: + """ """ + super().__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: int + :ivar total_count: Total Count. + :vartype total_count: int + :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.ErrorResponseAutoGenerated + :ivar duration: Total Duration of Job. + :vartype duration: str + :ivar mode: Mode of job execution. Known values are: "Offline" and "Online". + :vartype mode: str or ~azure.mgmt.cosmosdb.models.DataTransferJobMode + """ + + _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}, + "duration": {"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": "int"}, + "total_count": {"key": "properties.totalCount", "type": "int"}, + "last_updated_utc_time": {"key": "properties.lastUpdatedUtcTime", "type": "iso-8601"}, + "worker_count": {"key": "properties.workerCount", "type": "int"}, + "error": {"key": "properties.error", "type": "ErrorResponseAutoGenerated"}, + "duration": {"key": "properties.duration", "type": "str"}, + "mode": {"key": "properties.mode", "type": "str"}, + } + + def __init__( + self, + *, + source: Optional["_models.DataTransferDataSourceSink"] = None, + destination: Optional["_models.DataTransferDataSourceSink"] = None, + worker_count: Optional[int] = None, + mode: Optional[Union[str, "_models.DataTransferJobMode"]] = None, + **kwargs: Any + ) -> None: + """ + :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 + :keyword mode: Mode of job execution. Known values are: "Offline" and "Online". + :paramtype mode: str or ~azure.mgmt.cosmosdb.models.DataTransferJobMode + """ + super().__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 + self.duration = None + self.mode = mode + + +class DataTransferJobProperties(_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 server. + + :ivar job_name: Job Name. + :vartype job_name: str + :ivar source: Source DataStore details. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink + :ivar destination: Destination DataStore details. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink + :ivar status: Job Status. + :vartype status: str + :ivar processed_count: Processed Count. + :vartype processed_count: int + :ivar total_count: Total Count. + :vartype total_count: int + :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.ErrorResponseAutoGenerated + :ivar duration: Total Duration of Job. + :vartype duration: str + :ivar mode: Mode of job execution. Known values are: "Offline" and "Online". + :vartype mode: str or ~azure.mgmt.cosmosdb.models.DataTransferJobMode + """ + + _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}, + "duration": {"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": "int"}, + "total_count": {"key": "totalCount", "type": "int"}, + "last_updated_utc_time": {"key": "lastUpdatedUtcTime", "type": "iso-8601"}, + "worker_count": {"key": "workerCount", "type": "int"}, + "error": {"key": "error", "type": "ErrorResponseAutoGenerated"}, + "duration": {"key": "duration", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + } + + def __init__( + self, + *, + source: "_models.DataTransferDataSourceSink", + destination: "_models.DataTransferDataSourceSink", + worker_count: Optional[int] = None, + mode: Optional[Union[str, "_models.DataTransferJobMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword source: Source DataStore details. Required. + :paramtype source: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink + :keyword destination: Destination DataStore details. Required. + :paramtype destination: ~azure.mgmt.cosmosdb.models.DataTransferDataSourceSink + :keyword worker_count: Worker count. + :paramtype worker_count: int + :keyword mode: Mode of job execution. Known values are: "Offline" and "Online". + :paramtype mode: str or ~azure.mgmt.cosmosdb.models.DataTransferJobMode + """ + super().__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 + self.duration = None + self.mode = mode + + class RegionalServiceResource(_serialization.Model): """Resource for a regional service location. @@ -4685,6 +6388,30 @@ def __init__( self.locations = None +class DiagnosticLogSettings(_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. + Known values are: "None", "True", and "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, "_models.EnableFullTextQuery"]] = None, **kwargs: Any + ) -> None: + """ + :keyword enable_full_text_query: Describe the level of detail with which queries are to be + logged. Known values are: "None", "True", and "False". + :paramtype enable_full_text_query: str or ~azure.mgmt.cosmosdb.models.EnableFullTextQuery + """ + super().__init__(**kwargs) + self.enable_full_text_query = enable_full_text_query + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -4749,14 +6476,35 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.cosmosdb.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.cosmosdb.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error -class ErrorResponse(_serialization.Model): +class ErrorResponseAutoGenerated(_serialization.Model): """Error Response. :ivar code: Error code. @@ -4782,27 +6530,6 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message -class ErrorResponseAutoGenerated(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.cosmosdb.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - class ExcludedPath(_serialization.Model): """ExcludedPath. @@ -5081,6 +6808,235 @@ def __init__( self.locations = None +class GraphResource(_serialization.Model): + """Cosmos DB Graph resource object. + + All required parameters must be populated in order to send to server. + + :ivar id: Name of the Cosmos DB Graph. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Name of the Cosmos DB Graph. Required. + :paramtype id: str + """ + super().__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 server. + + :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: 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: The standard JSON format of a Graph resource. Required. + :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: "_models.GraphResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a Graph resource. Required. + :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().__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 + """ + + +class GraphResourceGetPropertiesResource(GraphResource): + """GraphResourceGetPropertiesResource. + + All required parameters must be populated in order to send to server. + + :ivar id: Name of the Cosmos DB Graph. Required. + :vartype id: str + """ + + +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: 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["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.GraphResourceGetPropertiesResource"] = None, + options: Optional["_models.GraphResourceGetPropertiesOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options + + +class GraphResourcesListResult(_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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): """Parameters to create and update Cosmos DB Gremlin database. @@ -5103,6 +7059,8 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a Gremlin database. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -5123,6 +7081,7 @@ class GremlinDatabaseCreateUpdateParameters(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": "GremlinDatabaseResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -5133,6 +7092,7 @@ def __init__( resource: "_models.GremlinDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -5146,13 +7106,15 @@ def __init__( 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: The standard JSON format of a Gremlin database. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -5300,6 +7262,8 @@ class GremlinDatabaseGetResults(ARMResourceProperties): 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: @@ -5318,6 +7282,7 @@ class GremlinDatabaseGetResults(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": "GremlinDatabaseGetPropertiesResource"}, "options": {"key": "properties.options", "type": "GremlinDatabaseGetPropertiesOptions"}, } @@ -5327,6 +7292,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = None, options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = None, **kwargs: Any @@ -5341,12 +7307,14 @@ def __init__( 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.GremlinDatabaseGetPropertiesResource :keyword options: :paramtype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -5424,6 +7392,8 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a Gremlin graph. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -5444,6 +7414,7 @@ class GremlinGraphCreateUpdateParameters(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": "GremlinGraphResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -5454,6 +7425,7 @@ def __init__( resource: "_models.GremlinGraphResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -5467,13 +7439,15 @@ def __init__( 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: The standard JSON format of a Gremlin graph. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -5584,9 +7558,7 @@ def __init__( self.create_mode = create_mode -class GremlinGraphGetPropertiesResource( - GremlinGraphResource, ExtendedResourceProperties -): # pylint: disable=too-many-instance-attributes +class GremlinGraphGetPropertiesResource(GremlinGraphResource, ExtendedResourceProperties): """GremlinGraphGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -5730,6 +7702,8 @@ class GremlinGraphGetResults(ARMResourceProperties): 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: @@ -5748,6 +7722,7 @@ class GremlinGraphGetResults(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": "GremlinGraphGetPropertiesResource"}, "options": {"key": "properties.options", "type": "GremlinGraphGetPropertiesOptions"}, } @@ -5757,6 +7732,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.GremlinGraphGetPropertiesResource"] = None, options: Optional["_models.GremlinGraphGetPropertiesOptions"] = None, **kwargs: Any @@ -5771,12 +7747,14 @@ def __init__( 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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -6018,6 +7996,29 @@ def __init__( self.algorithm = algorithm +class ListBackups(_serialization.Model): + """List of restorable backups for a Cassandra cluster. + + 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] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[BackupResource]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + class ListClusters(_serialization.Model): """List of managed Cassandra clusters. @@ -6038,6 +8039,29 @@ def __init__(self, *, value: Optional[List["_models.ClusterResource"]] = None, * self.value = value +class ListCommands(_serialization.Model): + """List of commands for cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Container for array of commands. + :vartype value: list[~azure.mgmt.cosmosdb.models.CommandPublicResource] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[CommandPublicResource]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + class ListDataCenters(_serialization.Model): """List of managed Cassandra data centers and their properties. @@ -6074,13 +8098,7 @@ class Location(_serialization.Model): :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. + :ivar provisioning_state: The provisioning state of the resource. :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 @@ -6217,7 +8235,8 @@ class LocationProperties(_serialization.Model): have access in region for Availability Zones(Az). :vartype is_subscription_region_access_allowed_for_az: bool :ivar status: Enum to indicate current buildout status of the region. Known values are: - "Uninitialized", "Initializing", "InternallyReady", "Online", and "Deleting". + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". :vartype status: str or ~azure.mgmt.cosmosdb.models.Status """ @@ -6424,6 +8443,51 @@ def __init__(self, **kwargs: Any) -> None: self.client_id = None +class MaterializedViewDefinition(_serialization.Model): + """Materialized View definition for the container. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar source_collection_rid: An unique identifier for the source collection. This is a system + generated property. + :vartype source_collection_rid: str + :ivar source_collection_id: The name of the source container on which the Materialized View + will be created. Required. + :vartype source_collection_id: str + :ivar definition: The definition should be an SQL query which would be used to fetch data from + the source container to populate into the Materialized View container. Required. + :vartype definition: str + """ + + _validation = { + "source_collection_rid": {"readonly": True}, + "source_collection_id": {"required": True}, + "definition": {"required": True}, + } + + _attribute_map = { + "source_collection_rid": {"key": "sourceCollectionRid", "type": "str"}, + "source_collection_id": {"key": "sourceCollectionId", "type": "str"}, + "definition": {"key": "definition", "type": "str"}, + } + + def __init__(self, *, source_collection_id: str, definition: str, **kwargs: Any) -> None: + """ + :keyword source_collection_id: The name of the source container on which the Materialized View + will be created. Required. + :paramtype source_collection_id: str + :keyword definition: The definition should be an SQL query which would be used to fetch data + from the source container to populate into the Materialized View container. Required. + :paramtype definition: str + """ + super().__init__(**kwargs) + self.source_collection_rid = None + self.source_collection_id = source_collection_id + self.definition = definition + + class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long """Resource for a regional service location. @@ -6583,6 +8647,26 @@ def __init__( self.locations = None +class MergeParameters(_serialization.Model): + """The properties of an Azure Cosmos DB merge operations. + + :ivar is_dry_run: Specifies whether the operation is a real merge operation or a simulation. + :vartype is_dry_run: bool + """ + + _attribute_map = { + "is_dry_run": {"key": "isDryRun", "type": "bool"}, + } + + def __init__(self, *, is_dry_run: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_dry_run: Specifies whether the operation is a real merge operation or a simulation. + :paramtype is_dry_run: bool + """ + super().__init__(**kwargs) + self.is_dry_run = is_dry_run + + class Metric(_serialization.Model): """Metric data. @@ -6849,6 +8933,8 @@ class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a MongoDB collection. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -6869,6 +8955,7 @@ class MongoDBCollectionCreateUpdateParameters(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": "MongoDBCollectionResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -6879,6 +8966,7 @@ def __init__( resource: "_models.MongoDBCollectionResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -6892,13 +8980,15 @@ def __init__( 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: The standard JSON format of a MongoDB collection. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -7096,6 +9186,8 @@ class MongoDBCollectionGetResults(ARMResourceProperties): 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: @@ -7114,6 +9206,7 @@ class MongoDBCollectionGetResults(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": "MongoDBCollectionGetPropertiesResource"}, "options": {"key": "properties.options", "type": "MongoDBCollectionGetPropertiesOptions"}, } @@ -7123,6 +9216,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = None, options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = None, **kwargs: Any @@ -7137,12 +9231,14 @@ def __init__( 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 """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -7192,6 +9288,8 @@ class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a MongoDB database. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseResource :ivar options: A key-value pair of options to be applied for the request. This corresponds to @@ -7212,6 +9310,7 @@ class MongoDBDatabaseCreateUpdateParameters(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": "MongoDBDatabaseResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } @@ -7222,6 +9321,7 @@ def __init__( resource: "_models.MongoDBDatabaseResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -7235,13 +9335,15 @@ def __init__( 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: The standard JSON format of a MongoDB database. Required. :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -7389,6 +9491,8 @@ class MongoDBDatabaseGetResults(ARMResourceProperties): 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: @@ -7407,6 +9511,7 @@ class MongoDBDatabaseGetResults(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": "MongoDBDatabaseGetPropertiesResource"}, "options": {"key": "properties.options", "type": "MongoDBDatabaseGetPropertiesOptions"}, } @@ -7416,6 +9521,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = None, options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = None, **kwargs: Any @@ -7430,12 +9536,14 @@ def __init__( 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 """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options @@ -7801,80 +9909,309 @@ class MongoUserDefinitionGetResults(ARMProxyResource): """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "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"}, + "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"}, + } + + 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["_models.Role"]] = None, + mechanisms: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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().__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 + + +class MongoUserDefinitionListResult(_serialization.Model): + """The relevant User Definition. + + 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] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MongoUserDefinitionGetResults]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class NetworkSecurityPerimeter(_serialization.Model): + """Information about a network security perimeter (NSP). + + :ivar id: Fully qualified Azure resource ID of the NSP resource. + :vartype id: str + :ivar perimeter_guid: Universal unique ID (UUID) of the network security perimeter. + :vartype perimeter_guid: str + :ivar location: Location of the network security perimeter. + :vartype location: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "perimeter_guid": {"key": "perimeterGuid", "type": "str"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + perimeter_guid: Optional[str] = None, + location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified Azure resource ID of the NSP resource. + :paramtype id: str + :keyword perimeter_guid: Universal unique ID (UUID) of the network security perimeter. + :paramtype perimeter_guid: str + :keyword location: Location of the network security perimeter. + :paramtype location: str + """ + super().__init__(**kwargs) + self.id = id + self.perimeter_guid = perimeter_guid + self.location = location + + +class NetworkSecurityPerimeterConfiguration(ProxyResource): + """Network security perimeter (NSP) configuration resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Network security configuration properties. + :vartype properties: + ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "NetworkSecurityPerimeterConfigurationProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Network security configuration properties. + :paramtype properties: + ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class NetworkSecurityPerimeterConfigurationListResult(_serialization.Model): # pylint: disable=name-too-long + """Result of a list NSP (network security perimeter) configurations request. + + :ivar value: Array of network security perimeter results. + :vartype value: list[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.NetworkSecurityPerimeterConfiguration"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Array of network security perimeter results. + :paramtype value: list[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :keyword next_link: The link used to get the next page of results. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkSecurityPerimeterConfigurationProperties(_serialization.Model): # pylint: disable=name-too-long + """Network security configuration properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of a network security perimeter configuration that + is being created or updated. Known values are: "Succeeded", "Creating", "Updating", "Deleting", + "Accepted", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProvisioningState + :ivar provisioning_issues: List of provisioning issues, if any. + :vartype provisioning_issues: list[~azure.mgmt.cosmosdb.models.ProvisioningIssue] + :ivar network_security_perimeter: Information about a network security perimeter (NSP). + :vartype network_security_perimeter: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter + :ivar resource_association: Information about resource association. + :vartype resource_association: ~azure.mgmt.cosmosdb.models.ResourceAssociation + :ivar profile: Network security perimeter configuration profile. + :vartype profile: ~azure.mgmt.cosmosdb.models.NetworkSecurityProfile + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "provisioning_issues": {"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"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "provisioning_issues": {"key": "provisioningIssues", "type": "[ProvisioningIssue]"}, + "network_security_perimeter": {"key": "networkSecurityPerimeter", "type": "NetworkSecurityPerimeter"}, + "resource_association": {"key": "resourceAssociation", "type": "ResourceAssociation"}, + "profile": {"key": "profile", "type": "NetworkSecurityProfile"}, } 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["_models.Role"]] = None, - mechanisms: Optional[str] = None, + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, + resource_association: Optional["_models.ResourceAssociation"] = None, + profile: Optional["_models.NetworkSecurityProfile"] = None, **kwargs: Any ) -> None: """ - :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 + :keyword network_security_perimeter: Information about a network security perimeter (NSP). + :paramtype network_security_perimeter: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter + :keyword resource_association: Information about resource association. + :paramtype resource_association: ~azure.mgmt.cosmosdb.models.ResourceAssociation + :keyword profile: Network security perimeter configuration profile. + :paramtype profile: ~azure.mgmt.cosmosdb.models.NetworkSecurityProfile """ super().__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 - + self.provisioning_state = None + self.provisioning_issues = None + self.network_security_perimeter = network_security_perimeter + self.resource_association = resource_association + self.profile = profile -class MongoUserDefinitionListResult(_serialization.Model): - """The relevant User Definition. - Variables are only populated by the server, and will be ignored when sending a request. +class NetworkSecurityProfile(_serialization.Model): + """Network security perimeter configuration profile. - :ivar value: List of User Definition and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :ivar name: Name of the profile. + :vartype name: str + :ivar access_rules_version: Current access rules version. + :vartype access_rules_version: int + :ivar access_rules: List of Access Rules. + :vartype access_rules: list[~azure.mgmt.cosmosdb.models.AccessRule] + :ivar diagnostic_settings_version: Current diagnostic settings version. + :vartype diagnostic_settings_version: int + :ivar enabled_log_categories: List of log categories that are enabled. + :vartype enabled_log_categories: list[str] """ - _validation = { - "value": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[MongoUserDefinitionGetResults]"}, + "name": {"key": "name", "type": "str"}, + "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, + "access_rules": {"key": "accessRules", "type": "[AccessRule]"}, + "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "int"}, + "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[List["_models.AccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + enabled_log_categories: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the profile. + :paramtype name: str + :keyword access_rules_version: Current access rules version. + :paramtype access_rules_version: int + :keyword access_rules: List of Access Rules. + :paramtype access_rules: list[~azure.mgmt.cosmosdb.models.AccessRule] + :keyword diagnostic_settings_version: Current diagnostic settings version. + :paramtype diagnostic_settings_version: int + :keyword enabled_log_categories: List of log categories that are enabled. + :paramtype enabled_log_categories: list[str] + """ super().__init__(**kwargs) - self.value = None + self.name = name + self.access_rules_version = access_rules_version + self.access_rules = access_rules + self.diagnostic_settings_version = diagnostic_settings_version + self.enabled_log_categories = enabled_log_categories class NotebookWorkspace(ARMProxyResource): @@ -8350,7 +10687,7 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class PercentileMetricValue(MetricValue): # pylint: disable=too-many-instance-attributes +class PercentileMetricValue(MetricValue): """Represents percentile metrics values. Variables are only populated by the server, and will be ignored when sending a request. @@ -8443,126 +10780,324 @@ class PeriodicModeBackupPolicy(BackupPolicy): """ _validation = { - "type": {"required": True}, + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "migration_state": {"key": "migrationState", "type": "BackupPolicyMigrationState"}, + "periodic_mode_properties": {"key": "periodicModeProperties", "type": "PeriodicModeProperties"}, + } + + def __init__( + self, + *, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, + periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, + **kwargs: Any + ) -> None: + """ + :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().__init__(migration_state=migration_state, **kwargs) + self.type: str = "Periodic" + self.periodic_mode_properties = periodic_mode_properties + + +class PeriodicModeProperties(_serialization.Model): + """Configuration values for periodic mode backup. + + :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", and "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 = { + "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, + *, + 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: Any + ) -> None: + """ + :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", and "Zone". + :paramtype backup_storage_redundancy: str or + ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy + """ + super().__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 + + +class Permission(_serialization.Model): + """The set of data plane operations permitted through this Role Definition. + + :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] + """ + + _attribute_map = { + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, + } + + def __init__( + self, *, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, **kwargs: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.data_actions = data_actions + self.not_data_actions = not_data_actions + + +class PermissionAutoGenerated(_serialization.Model): + """The set of data plane operations permitted through this Role Definition. + + :ivar id: The id for the permission. + :vartype id: str + :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] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + data_actions: Optional[List[str]] = None, + not_data_actions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The id for the permission. + :paramtype id: str + :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().__init__(**kwargs) + self.id = id + self.data_actions = data_actions + self.not_data_actions = not_data_actions + + +class PhysicalPartitionId(_serialization.Model): + """PhysicalPartitionId object. + + All required parameters must be populated in order to send to server. + + :ivar id: Id of a physical partition. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Id of a physical partition. Required. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class PhysicalPartitionStorageInfo(_serialization.Model): + """The storage of a physical partition. + + 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 + """ + + _validation = { + "id": {"readonly": True}, + "storage_in_kb": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "storage_in_kb": {"key": "storageInKB", "type": "float"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.storage_in_kb = None + + +class PhysicalPartitionStorageInfoCollection(_serialization.Model): + """List of physical partitions and their properties returned by a merge operation. + + 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] + """ + + _validation = { + "physical_partition_storage_info_collection": {"readonly": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, - "migration_state": {"key": "migrationState", "type": "BackupPolicyMigrationState"}, - "periodic_mode_properties": {"key": "periodicModeProperties", "type": "PeriodicModeProperties"}, + "physical_partition_storage_info_collection": { + "key": "physicalPartitionStorageInfoCollection", + "type": "[PhysicalPartitionStorageInfo]", + }, } - def __init__( - self, - *, - migration_state: Optional["_models.BackupPolicyMigrationState"] = None, - periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(migration_state=migration_state, **kwargs) - self.type: str = "Periodic" - self.periodic_mode_properties = periodic_mode_properties + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.physical_partition_storage_info_collection = None -class PeriodicModeProperties(_serialization.Model): - """Configuration values for periodic mode backup. +class PhysicalPartitionThroughputInfoProperties(_serialization.Model): # pylint: disable=name-too-long + """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties 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. Known values are: - "Geo", "Local", and "Zone". - :vartype backup_storage_redundancy: str or ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy + :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. + :vartype physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ - _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"}, + "physical_partition_throughput_info": { + "key": "physicalPartitionThroughputInfo", + "type": "[PhysicalPartitionThroughputInfoResource]", + }, } def __init__( self, *, - backup_interval_in_minutes: Optional[int] = None, - backup_retention_interval_in_hours: Optional[int] = None, - backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None, + physical_partition_throughput_info: Optional[List["_models.PhysicalPartitionThroughputInfoResource"]] = None, **kwargs: Any ) -> None: """ - :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", and "Zone". - :paramtype backup_storage_redundancy: str or - ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy + :keyword physical_partition_throughput_info: Array of physical partition throughput info + objects. + :paramtype physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ super().__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 + self.physical_partition_throughput_info = physical_partition_throughput_info -class Permission(_serialization.Model): - """The set of data plane operations permitted through this Role Definition. +class PhysicalPartitionThroughputInfoResource(_serialization.Model): + """PhysicalPartitionThroughputInfo object. - :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] + All required parameters must be populated in order to send to server. + + :ivar id: Id of a physical partition. Required. + :vartype id: str + :ivar throughput: Throughput of a physical partition. + :vartype throughput: float """ + _validation = { + "id": {"required": True}, + } + _attribute_map = { - "data_actions": {"key": "dataActions", "type": "[str]"}, - "not_data_actions": {"key": "notDataActions", "type": "[str]"}, + "id": {"key": "id", "type": "str"}, + "throughput": {"key": "throughput", "type": "float"}, } def __init__( - self, *, data_actions: Optional[List[str]] = None, not_data_actions: Optional[List[str]] = None, **kwargs: Any + self, *, id: str, throughput: Optional[float] = None, **kwargs: Any # pylint: disable=redefined-builtin ) -> None: """ - :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 id: Id of a physical partition. Required. + :paramtype id: str + :keyword throughput: Throughput of a physical partition. + :paramtype throughput: float """ super().__init__(**kwargs) - self.data_actions = data_actions - self.not_data_actions = not_data_actions + self.id = id + self.throughput = throughput -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. +class PhysicalPartitionThroughputInfoResult(ARMResourceProperties): + """An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. 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}. # pylint: disable=line-too-long + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the resource. + :ivar name: The name of the ARM resource. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :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: 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 """ _validation = { @@ -8575,30 +11110,49 @@ class Resource(_serialization.Model): "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"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.PhysicalPartitionThroughputInfoResultPropertiesResource"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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 + """ + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - Variables are only populated by the server, and will be ignored when sending a request. +class PhysicalPartitionThroughputInfoResultPropertiesResource( + PhysicalPartitionThroughputInfoProperties +): # pylint: disable=name-too-long + """properties of physical partition throughput info. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :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 physical_partition_throughput_info: Array of physical partition throughput info objects. + :vartype physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ @@ -8607,14 +11161,17 @@ class PrivateEndpointConnection(ProxyResource): 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}. # pylint: disable=line-too-long + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData :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 @@ -8631,12 +11188,14 @@ class PrivateEndpointConnection(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointProperty"}, "private_link_service_connection_state": { "key": "properties.privateLinkServiceConnectionState", @@ -8816,62 +11375,279 @@ def __init__(self, *, status: Optional[str] = None, description: Optional[str] = self.actions_required = None -class Privilege(_serialization.Model): - """The set of data plane operations permitted through this Role Definition. +class Privilege(_serialization.Model): + """The set of data plane operations permitted through this Role Definition. + + :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] + """ + + _attribute_map = { + "resource": {"key": "resource", "type": "PrivilegeResource"}, + "actions": {"key": "actions", "type": "[str]"}, + } + + def __init__( + self, + *, + resource: Optional["_models.PrivilegeResource"] = None, + actions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :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] + """ + super().__init__(**kwargs) + self.resource = resource + self.actions = actions + + +class PrivilegeResource(_serialization.Model): + """An Azure Cosmos DB Mongo DB Resource. + + :ivar db: The database name the role is applied. + :vartype db: str + :ivar collection: The collection name the role is applied. + :vartype collection: str + """ + + _attribute_map = { + "db": {"key": "db", "type": "str"}, + "collection": {"key": "collection", "type": "str"}, + } + + def __init__(self, *, db: Optional[str] = None, collection: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword db: The database name the role is applied. + :paramtype db: str + :keyword collection: The collection name the role is applied. + :paramtype collection: str + """ + super().__init__(**kwargs) + self.db = db + self.collection = collection + + +class ProvisioningIssue(_serialization.Model): + """Describes a provisioning issue for a network security perimeter configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the issue. + :vartype name: str + :ivar properties: Details of a provisioning issue for a network security perimeter (NSP) + configuration. Resource providers should generate separate provisioning issue elements for each + separate issue detected, and include a meaningful and distinctive description, as well as any + appropriate suggestedResourceIds and suggestedAccessRules. + :vartype properties: ~azure.mgmt.cosmosdb.models.ProvisioningIssueProperties + """ + + _validation = { + "name": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "ProvisioningIssueProperties"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.properties = None + + +class ProvisioningIssueProperties(_serialization.Model): + """Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource + providers should generate separate provisioning issue elements for each separate issue + detected, and include a meaningful and distinctive description, as well as any appropriate + suggestedResourceIds and suggestedAccessRules. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar issue_type: Type of issue. Known values are: "Unknown", + "ConfigurationPropagationFailure", "MissingPerimeterConfiguration", and + "MissingIdentityConfiguration". + :vartype issue_type: str or ~azure.mgmt.cosmosdb.models.IssueType + :ivar severity: Severity of the issue. Known values are: "Warning" and "Error". + :vartype severity: str or ~azure.mgmt.cosmosdb.models.Severity + :ivar description: Description of the issue. + :vartype description: str + :ivar suggested_resource_ids: Fully qualified resource IDs of suggested resources that can be + associated to the network security perimeter (NSP) to remediate the issue. + :vartype suggested_resource_ids: list[str] + :ivar suggested_access_rules: Access rules that can be added to the network security profile + (NSP) to remediate the issue. + :vartype suggested_access_rules: list[~azure.mgmt.cosmosdb.models.AccessRule] + """ + + _validation = { + "issue_type": {"readonly": True}, + "severity": {"readonly": True}, + "description": {"readonly": True}, + "suggested_resource_ids": {"readonly": True}, + "suggested_access_rules": {"readonly": True}, + } + + _attribute_map = { + "issue_type": {"key": "issueType", "type": "str"}, + "severity": {"key": "severity", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "suggested_resource_ids": {"key": "suggestedResourceIds", "type": "[str]"}, + "suggested_access_rules": {"key": "suggestedAccessRules", "type": "[AccessRule]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.issue_type = None + self.severity = None + self.description = None + self.suggested_resource_ids = None + self.suggested_access_rules = None + + +class RedistributeThroughputParameters(ARMResourceProperties): + """Cosmos DB redistribute throughput parameters object. - :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] + 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 server. + + :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: 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: The standard JSON format of a resource throughput. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "resource": {"required": True}, + } + _attribute_map = { - "resource": {"key": "resource", "type": "PrivilegeResource"}, - "actions": {"key": "actions", "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}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "RedistributeThroughputPropertiesResource"}, } def __init__( self, *, - resource: Optional["_models.PrivilegeResource"] = None, - actions: Optional[List[str]] = None, + resource: "_models.RedistributeThroughputPropertiesResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, **kwargs: Any ) -> None: """ - :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 location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a resource throughput. Required. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource """ - super().__init__(**kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource - self.actions = actions -class PrivilegeResource(_serialization.Model): - """An Azure Cosmos DB Mongo DB Resource. +class RedistributeThroughputPropertiesResource(_serialization.Model): + """Resource to redistribute throughput for Azure Cosmos DB resource. - :ivar db: The database name the role is applied. - :vartype db: str - :ivar collection: The collection name the role is applied. - :vartype collection: str + All required parameters must be populated in order to send to server. + + :ivar throughput_policy: ThroughputPolicy to apply for throughput redistribution. Required. + Known values are: "none", "equal", and "custom". + :vartype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType + :ivar target_physical_partition_throughput_info: Array of + PhysicalPartitionThroughputInfoResource objects. Required. + :vartype target_physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :ivar source_physical_partition_throughput_info: Array of + PhysicalPartitionThroughputInfoResource objects. Required. + :vartype source_physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ + _validation = { + "throughput_policy": {"required": True}, + "target_physical_partition_throughput_info": {"required": True}, + "source_physical_partition_throughput_info": {"required": True}, + } + _attribute_map = { - "db": {"key": "db", "type": "str"}, - "collection": {"key": "collection", "type": "str"}, + "throughput_policy": {"key": "throughputPolicy", "type": "str"}, + "target_physical_partition_throughput_info": { + "key": "targetPhysicalPartitionThroughputInfo", + "type": "[PhysicalPartitionThroughputInfoResource]", + }, + "source_physical_partition_throughput_info": { + "key": "sourcePhysicalPartitionThroughputInfo", + "type": "[PhysicalPartitionThroughputInfoResource]", + }, } - def __init__(self, *, db: Optional[str] = None, collection: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + throughput_policy: Union[str, "_models.ThroughputPolicyType"], + target_physical_partition_throughput_info: List["_models.PhysicalPartitionThroughputInfoResource"], + source_physical_partition_throughput_info: List["_models.PhysicalPartitionThroughputInfoResource"], + **kwargs: Any + ) -> None: """ - :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 throughput_policy: ThroughputPolicy to apply for throughput redistribution. Required. + Known values are: "none", "equal", and "custom". + :paramtype throughput_policy: str or ~azure.mgmt.cosmosdb.models.ThroughputPolicyType + :keyword target_physical_partition_throughput_info: Array of + PhysicalPartitionThroughputInfoResource objects. Required. + :paramtype target_physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + :keyword source_physical_partition_throughput_info: Array of + PhysicalPartitionThroughputInfoResource objects. Required. + :paramtype source_physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ super().__init__(**kwargs) - self.db = db - self.collection = collection + 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 class RegionForOnlineOffline(_serialization.Model): @@ -8901,6 +11677,40 @@ def __init__(self, *, region: str, **kwargs: Any) -> None: self.region = region +class ResourceAssociation(_serialization.Model): + """Information about resource association. + + :ivar name: Name of the resource association. + :vartype name: str + :ivar access_mode: Access mode of the resource association. Known values are: "Enforced", + "Learning", and "Audit". + :vartype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "access_mode": {"key": "accessMode", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource association. + :paramtype name: str + :keyword access_mode: Access mode of the resource association. Known values are: "Enforced", + "Learning", and "Audit". + :paramtype access_mode: str or ~azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode + """ + super().__init__(**kwargs) + self.name = name + self.access_mode = access_mode + + class RestoreParametersBase(_serialization.Model): """Parameters to indicate the information about the restore. @@ -8979,12 +11789,12 @@ class RestorableDatabaseAccountGetResult(_serialization.Model): :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 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. Known values are: "MongoDB", "Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2". :vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType @@ -9008,8 +11818,8 @@ class RestorableDatabaseAccountGetResult(_serialization.Model): "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"}, "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]"}, } @@ -9020,8 +11830,8 @@ def __init__( location: Optional[str] = None, account_name: Optional[str] = None, creation_time: Optional[datetime.datetime] = None, - deletion_time: Optional[datetime.datetime] = None, oldest_restorable_time: Optional[datetime.datetime] = None, + deletion_time: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ @@ -9031,12 +11841,12 @@ def __init__( :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 :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 """ super().__init__(**kwargs) self.id = None @@ -9045,8 +11855,8 @@ def __init__( self.location = location self.account_name = account_name self.creation_time = creation_time - self.deletion_time = deletion_time self.oldest_restorable_time = oldest_restorable_time + self.deletion_time = deletion_time self.api_type = None self.restorable_locations = None @@ -9439,8 +12249,128 @@ class RestorableMongodbCollectionGetResult(_serialization.Model): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB MongoDB collection event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource + :ivar resource: The resource of an Azure Cosmos DB MongoDB collection event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource + """ + + _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": "RestorableMongodbCollectionPropertiesResource"}, + } + + def __init__( + self, *, resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, **kwargs: Any + ) -> None: + """ + :keyword resource: The resource of an Azure Cosmos DB MongoDB collection event. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource + """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.resource = resource + + +class RestorableMongodbCollectionPropertiesResource(_serialization.Model): # pylint: disable=name-too-long + """The resource of an Azure Cosmos DB MongoDB collection 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 collection event. Known values are: "Create", + "Replace", "Delete", "Recreate", and "SystemOperation". + :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType + :ivar can_undelete: A state of this collection to identify if this container is restorable in + same account. + :vartype can_undelete: str + :ivar can_undelete_reason: The reason why this collection can not be restored in same account. + :vartype can_undelete_reason: str + :ivar event_timestamp: The time when this collection event happened. + :vartype event_timestamp: str + :ivar owner_id: The name of this MongoDB collection. + :vartype owner_id: str + :ivar owner_resource_id: The resource ID of this MongoDB collection. + :vartype owner_resource_id: str + """ + + _validation = { + "rid": {"readonly": True}, + "operation_type": {"readonly": True}, + "can_undelete": {"readonly": True}, + "can_undelete_reason": {"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"}, + "can_undelete": {"key": "canUndelete", "type": "str"}, + "can_undelete_reason": {"key": "canUndeleteReason", "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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.rid = None + self.operation_type = None + self.can_undelete = None + self.can_undelete_reason = None + self.event_timestamp = None + self.owner_id = None + self.owner_resource_id = None + + +class RestorableMongodbCollectionsListResult(_serialization.Model): + """The List operation response, that contains the MongoDB collection events and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of MongoDB collection events and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RestorableMongodbCollectionGetResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class RestorableMongodbDatabaseGetResult(_serialization.Model): + """An Azure Cosmos DB MongoDB database event. + + 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 MongoDB database event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource """ _validation = { @@ -9453,15 +12383,15 @@ class RestorableMongodbCollectionGetResult(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "resource": {"key": "properties.resource", "type": "RestorableMongodbCollectionPropertiesResource"}, + "resource": {"key": "properties.resource", "type": "RestorableMongodbDatabasePropertiesResource"}, } def __init__( - self, *, resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, **kwargs: Any + self, *, resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, **kwargs: Any ) -> None: """ - :keyword resource: The resource of an Azure Cosmos DB MongoDB collection event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource + :keyword resource: The resource of an Azure Cosmos DB MongoDB database event. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource """ super().__init__(**kwargs) self.id = None @@ -9470,26 +12400,26 @@ def __init__( self.resource = resource -class RestorableMongodbCollectionPropertiesResource(_serialization.Model): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB collection event. +class RestorableMongodbDatabasePropertiesResource(_serialization.Model): # pylint: disable=name-too-long + """The resource of an Azure Cosmos DB MongoDB database 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 collection event. Known values are: "Create", + :ivar operation_type: The operation type of this database event. Known values are: "Create", "Replace", "Delete", "Recreate", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar can_undelete: A state of this collection to identify if this container is restorable in - same account. + :ivar can_undelete: A state of this database to identify if this database is restorable in same + account. :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this collection can not be restored in same account. + :ivar can_undelete_reason: The reason why this database can not be restored in same account. :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this collection event happened. + :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str - :ivar owner_id: The name of this MongoDB collection. + :ivar owner_id: The name of this MongoDB database. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this MongoDB collection. + :ivar owner_resource_id: The resource ID of this MongoDB database. :vartype owner_resource_id: str """ @@ -9525,13 +12455,13 @@ def __init__(self, **kwargs: Any) -> None: self.owner_resource_id = None -class RestorableMongodbCollectionsListResult(_serialization.Model): - """The List operation response, that contains the MongoDB collection events and their properties. +class RestorableMongodbDatabasesListResult(_serialization.Model): + """The List operation response, that contains the MongoDB database events and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of MongoDB collection events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] + :ivar value: List of MongoDB database events and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] """ _validation = { @@ -9539,7 +12469,7 @@ class RestorableMongodbCollectionsListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[RestorableMongodbCollectionGetResult]"}, + "value": {"key": "value", "type": "[RestorableMongodbDatabaseGetResult]"}, } def __init__(self, **kwargs: Any) -> None: @@ -9548,8 +12478,79 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class RestorableMongodbDatabaseGetResult(_serialization.Model): - """An Azure Cosmos DB MongoDB database event. +class RestorableMongodbResourcesGetResult(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.database_name = database_name + self.collection_names = collection_names + + +class RestorableMongodbResourcesListResult(_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.RestorableMongodbResourcesGetResult] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RestorableMongodbResourcesGetResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class RestorableSqlContainerGetResult(_serialization.Model): + """An Azure Cosmos DB SQL container event. Variables are only populated by the server, and will be ignored when sending a request. @@ -9559,8 +12560,8 @@ class RestorableMongodbDatabaseGetResult(_serialization.Model): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB MongoDB database event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource + :ivar resource: The resource of an Azure Cosmos DB SQL container event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource """ _validation = { @@ -9573,15 +12574,15 @@ class RestorableMongodbDatabaseGetResult(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "resource": {"key": "properties.resource", "type": "RestorableMongodbDatabasePropertiesResource"}, + "resource": {"key": "properties.resource", "type": "RestorableSqlContainerPropertiesResource"}, } def __init__( - self, *, resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, **kwargs: Any + self, *, resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, **kwargs: Any ) -> None: """ - :keyword resource: The resource of an Azure Cosmos DB MongoDB database event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource + :keyword resource: The resource of an Azure Cosmos DB SQL container event. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource """ super().__init__(**kwargs) self.id = None @@ -9590,27 +12591,30 @@ def __init__( self.resource = resource -class RestorableMongodbDatabasePropertiesResource(_serialization.Model): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB database event. +class RestorableSqlContainerPropertiesResource(_serialization.Model): + """The resource of an Azure Cosmos DB SQL container 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 database event. Known values are: "Create", + :ivar operation_type: The operation type of this container event. Known values are: "Create", "Replace", "Delete", "Recreate", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar can_undelete: A state of this database to identify if this database is restorable in same - account. + :ivar can_undelete: A state of this container to identify if this container is restorable in + same account. :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this database can not be restored in same account. + :ivar can_undelete_reason: The reason why this container can not be restored in same account. :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this database event happened. + :ivar event_timestamp: The when this container event happened. :vartype event_timestamp: str - :ivar owner_id: The name of this MongoDB database. + :ivar owner_id: The name of this SQL container. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this MongoDB database. + :ivar owner_resource_id: The resource ID of this SQL container. :vartype owner_resource_id: str + :ivar container: Cosmos DB SQL container resource object. + :vartype container: + ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResourceContainer """ _validation = { @@ -9631,98 +12635,326 @@ class RestorableMongodbDatabasePropertiesResource(_serialization.Model): # pyli "event_timestamp": {"key": "eventTimestamp", "type": "str"}, "owner_id": {"key": "ownerId", "type": "str"}, "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, + "container": {"key": "container", "type": "RestorableSqlContainerPropertiesResourceContainer"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, **kwargs: Any + ) -> None: + """ + :keyword container: Cosmos DB SQL container resource object. + :paramtype container: + ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResourceContainer + """ + super().__init__(**kwargs) + self.rid = None + self.operation_type = None + self.can_undelete = None + self.can_undelete_reason = None + self.event_timestamp = None + self.owner_id = None + self.owner_resource_id = None + self.container = container + + +class SqlContainerResource(_serialization.Model): + """Cosmos DB SQL container resource object. + + All required parameters must be populated in order to send to server. + + :ivar id: Name of the Cosmos DB SQL container. Required. + :vartype id: str + :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :vartype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :ivar computed_properties: List of computed properties. + :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :ivar vector_embedding_policy: The vector embedding policy for the container. + :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + """ + + _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"}, + "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, + "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, + "materialized_view_definition": {"key": "materializedViewDefinition", "type": "MaterializedViewDefinition"}, + "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, + "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, + } + + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + 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, + client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, + analytical_storage_ttl: Optional[int] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + computed_properties: Optional[List["_models.ComputedProperty"]] = None, + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Name of the Cosmos DB SQL container. Required. + :paramtype id: str + :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :paramtype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :keyword computed_properties: List of computed properties. + :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :keyword vector_embedding_policy: The vector embedding policy for the container. + :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + """ super().__init__(**kwargs) - self.rid = None - self.operation_type = None - self.can_undelete = None - self.can_undelete_reason = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None + 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.restore_parameters = restore_parameters + self.create_mode = create_mode + self.materialized_view_definition = materialized_view_definition + self.computed_properties = computed_properties + self.vector_embedding_policy = vector_embedding_policy -class RestorableMongodbDatabasesListResult(_serialization.Model): - """The List operation response, that contains the MongoDB database events and their properties. +class RestorableSqlContainerPropertiesResourceContainer( + SqlContainerResource, ExtendedResourceProperties +): # pylint: disable=name-too-long + """Cosmos DB SQL container resource object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of MongoDB database events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RestorableMongodbDatabaseGetResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class RestorableMongodbResourcesGetResult(_serialization.Model): - """Specific Databases to restore. - - 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 server. - :ivar id: The unique resource identifier of the ARM resource. + :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 id: Name of the Cosmos DB SQL container. Required. :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] + :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :vartype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :ivar computed_properties: List of computed properties. + :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :ivar vector_embedding_policy: The vector embedding policy for the container. + :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + :ivar self_property: A system generated property that specifies the addressable path of the + container resource. + :vartype self_property: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, + "rid": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": True}, + "id": {"required": True}, + "self_property": {"readonly": True}, } _attribute_map = { + "rid": {"key": "_rid", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "type": "str"}, "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]"}, + "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"}, + "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, + "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, + "materialized_view_definition": {"key": "materializedViewDefinition", "type": "MaterializedViewDefinition"}, + "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, + "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, + "self_property": {"key": "_self", "type": "str"}, } def __init__( - self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs: Any + self, + *, + id: str, # pylint: disable=redefined-builtin + 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, + client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, + analytical_storage_ttl: Optional[int] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + computed_properties: Optional[List["_models.ComputedProperty"]] = None, + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + **kwargs: Any ) -> None: """ - :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] + :keyword id: Name of the Cosmos DB SQL container. Required. + :paramtype id: str + :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :paramtype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :keyword computed_properties: List of computed properties. + :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :keyword vector_embedding_policy: The vector embedding policy for the container. + :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.database_name = database_name - self.collection_names = collection_names + super().__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, + restore_parameters=restore_parameters, + create_mode=create_mode, + materialized_view_definition=materialized_view_definition, + computed_properties=computed_properties, + vector_embedding_policy=vector_embedding_policy, + **kwargs + ) + self.rid = None + self.ts = None + self.etag = None + self.self_property = None + 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.restore_parameters = restore_parameters + self.create_mode = create_mode + self.materialized_view_definition = materialized_view_definition + self.computed_properties = computed_properties + self.vector_embedding_policy = vector_embedding_policy -class RestorableMongodbResourcesListResult(_serialization.Model): - """The List operation response, that contains the restorable MongoDB resources. +class RestorableSqlContainersListResult(_serialization.Model): + """The List operation response, that contains the SQL container events and their properties. 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.RestorableMongodbResourcesGetResult] + :ivar value: List of SQL container events and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] """ _validation = { @@ -9730,7 +12962,7 @@ class RestorableMongodbResourcesListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[RestorableMongodbResourcesGetResult]"}, + "value": {"key": "value", "type": "[RestorableSqlContainerGetResult]"}, } def __init__(self, **kwargs: Any) -> None: @@ -9739,8 +12971,8 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class RestorableSqlContainerGetResult(_serialization.Model): - """An Azure Cosmos DB SQL container event. +class RestorableSqlDatabaseGetResult(_serialization.Model): + """An Azure Cosmos DB SQL database event. Variables are only populated by the server, and will be ignored when sending a request. @@ -9750,8 +12982,8 @@ class RestorableSqlContainerGetResult(_serialization.Model): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB SQL container event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource + :ivar resource: The resource of an Azure Cosmos DB SQL database event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource """ _validation = { @@ -9764,15 +12996,15 @@ class RestorableSqlContainerGetResult(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "resource": {"key": "properties.resource", "type": "RestorableSqlContainerPropertiesResource"}, + "resource": {"key": "properties.resource", "type": "RestorableSqlDatabasePropertiesResource"}, } def __init__( - self, *, resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, **kwargs: Any + self, *, resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, **kwargs: Any ) -> None: """ - :keyword resource: The resource of an Azure Cosmos DB SQL container event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource + :keyword resource: The resource of an Azure Cosmos DB SQL database event. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource """ super().__init__(**kwargs) self.id = None @@ -9781,30 +13013,29 @@ def __init__( self.resource = resource -class RestorableSqlContainerPropertiesResource(_serialization.Model): - """The resource of an Azure Cosmos DB SQL container event. +class RestorableSqlDatabasePropertiesResource(_serialization.Model): + """The resource of an Azure Cosmos DB SQL database 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 container event. Known values are: "Create", + :ivar operation_type: The operation type of this database event. Known values are: "Create", "Replace", "Delete", "Recreate", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar can_undelete: A state of this container to identify if this container is restorable in - same account. + :ivar can_undelete: A state of this database to identify if this database is restorable in same + account. :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this container can not be restored in same account. + :ivar can_undelete_reason: The reason why this database can not be restored in same account. :vartype can_undelete_reason: str - :ivar event_timestamp: The when this container event happened. + :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str - :ivar owner_id: The name of this SQL container. + :ivar owner_id: The name of the SQL database. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this SQL container. + :ivar owner_resource_id: The resource ID of the SQL database. :vartype owner_resource_id: str - :ivar container: Cosmos DB SQL container resource object. - :vartype container: - ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResourceContainer + :ivar database: Cosmos DB SQL database resource object. + :vartype database: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase """ _validation = { @@ -9825,16 +13056,16 @@ class RestorableSqlContainerPropertiesResource(_serialization.Model): "event_timestamp": {"key": "eventTimestamp", "type": "str"}, "owner_id": {"key": "ownerId", "type": "str"}, "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, - "container": {"key": "container", "type": "RestorableSqlContainerPropertiesResourceContainer"}, + "database": {"key": "database", "type": "RestorableSqlDatabasePropertiesResourceDatabase"}, } def __init__( - self, *, container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, **kwargs: Any + self, *, database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, **kwargs: Any ) -> None: """ - :keyword container: Cosmos DB SQL container resource object. - :paramtype container: - ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResourceContainer + :keyword database: Cosmos DB SQL database resource object. + :paramtype database: + ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase """ super().__init__(**kwargs) self.rid = None @@ -9844,42 +13075,21 @@ def __init__( self.event_timestamp = None self.owner_id = None self.owner_resource_id = None - self.container = container + self.database = database -class SqlContainerResource(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Cosmos DB SQL container resource object. +class SqlDatabaseResource(_serialization.Model): + """Cosmos DB SQL database resource object. All required parameters must be populated in order to send to server. - :ivar id: Name of the Cosmos DB SQL container. Required. + :ivar id: Name of the Cosmos DB SQL database. Required. :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int :ivar restore_parameters: Parameters to indicate the information about the restore. :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy """ _validation = { @@ -9888,85 +13098,37 @@ class SqlContainerResource(_serialization.Model): # pylint: disable=too-many-in _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"}, - "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, - "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, "create_mode": {"key": "createMode", "type": "str"}, - "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, - "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, } def __init__( self, *, id: str, # pylint: disable=redefined-builtin - 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, - client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, - analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Union[str, "_models.CreateMode"] = "Default", - computed_properties: Optional[List["_models.ComputedProperty"]] = None, - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL container. Required. + :keyword id: Name of the Cosmos DB SQL database. Required. :paramtype id: str - :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int :keyword restore_parameters: Parameters to indicate the information about the restore. :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword computed_properties: List of computed properties. - :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :keyword vector_embedding_policy: The vector embedding policy for the container. - :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy """ super().__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.client_encryption_policy = client_encryption_policy - self.analytical_storage_ttl = analytical_storage_ttl self.restore_parameters = restore_parameters self.create_mode = create_mode - self.computed_properties = computed_properties - self.vector_embedding_policy = vector_embedding_policy -class RestorableSqlContainerPropertiesResourceContainer( - SqlContainerResource, ExtendedResourceProperties -): # pylint: disable=too-many-instance-attributes,name-too-long - """Cosmos DB SQL container resource object. +class RestorableSqlDatabasePropertiesResourceDatabase( + SqlDatabaseResource, ExtendedResourceProperties +): # pylint: disable=name-too-long + """Cosmos DB SQL database resource object. Variables are only populated by the server, and will be ignored when sending a request. @@ -9979,36 +13141,21 @@ class RestorableSqlContainerPropertiesResourceContainer( :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str - :ivar id: Name of the Cosmos DB SQL container. Required. + :ivar id: Name of the Cosmos DB SQL database. Required. :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int :ivar restore_parameters: Parameters to indicate the information about the restore. :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + :ivar colls: A system generated property that specified the addressable path of the collections + resource. + :vartype colls: str + :ivar users: A system generated property that specifies the addressable path of the users + resource. + :vartype users: str :ivar self_property: A system generated property that specifies the addressable path of the - container resource. + database resource. :vartype self_property: str """ @@ -10017,6 +13164,8 @@ class RestorableSqlContainerPropertiesResourceContainer( "ts": {"readonly": True}, "etag": {"readonly": True}, "id": {"required": True}, + "colls": {"readonly": True}, + "users": {"readonly": True}, "self_property": {"readonly": True}, } @@ -10025,17 +13174,10 @@ class RestorableSqlContainerPropertiesResourceContainer( "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "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"}, - "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, - "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, "create_mode": {"key": "createMode", "type": "str"}, - "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, - "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, + "colls": {"key": "_colls", "type": "str"}, + "users": {"key": "_users", "type": "str"}, "self_property": {"key": "_self", "type": "str"}, } @@ -10043,89 +13185,109 @@ def __init__( self, *, id: str, # pylint: disable=redefined-builtin - 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, - client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, - analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Union[str, "_models.CreateMode"] = "Default", - computed_properties: Optional[List["_models.ComputedProperty"]] = None, - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL container. Required. + :keyword id: Name of the Cosmos DB SQL database. Required. :paramtype id: str - :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int :keyword restore_parameters: Parameters to indicate the information about the restore. :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword computed_properties: List of computed properties. - :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :keyword vector_embedding_policy: The vector embedding policy for the container. - :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy """ - super().__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, - restore_parameters=restore_parameters, - create_mode=create_mode, - computed_properties=computed_properties, - vector_embedding_policy=vector_embedding_policy, - **kwargs - ) - self.rid = None - self.ts = None - self.etag = None - self.self_property = None - 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.restore_parameters = restore_parameters - self.create_mode = create_mode - self.computed_properties = computed_properties - self.vector_embedding_policy = vector_embedding_policy + super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) + self.rid = None + self.ts = None + self.etag = None + self.colls = None + self.users = None + self.self_property = None + self.id = id + self.restore_parameters = restore_parameters + self.create_mode = create_mode + + +class RestorableSqlDatabasesListResult(_serialization.Model): + """The List operation response, that contains the SQL database events and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SQL database events and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RestorableSqlDatabaseGetResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class RestorableSqlResourcesGetResult(_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: Any + ) -> None: + """ + :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().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.database_name = database_name + self.collection_names = collection_names -class RestorableSqlContainersListResult(_serialization.Model): - """The List operation response, that contains the SQL container events and their properties. +class RestorableSqlResourcesListResult(_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 SQL container events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] + :ivar value: List of restorable SQL resources, including the database and collection names. + :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] """ _validation = { @@ -10133,7 +13295,7 @@ class RestorableSqlContainersListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[RestorableSqlContainerGetResult]"}, + "value": {"key": "value", "type": "[RestorableSqlResourcesGetResult]"}, } def __init__(self, **kwargs: Any) -> None: @@ -10142,8 +13304,8 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class RestorableSqlDatabaseGetResult(_serialization.Model): - """An Azure Cosmos DB SQL database event. +class RestorableTableGetResult(_serialization.Model): + """An Azure Cosmos DB Table event. Variables are only populated by the server, and will be ignored when sending a request. @@ -10153,8 +13315,8 @@ class RestorableSqlDatabaseGetResult(_serialization.Model): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar resource: The resource of an Azure Cosmos DB SQL database event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource + :ivar resource: The resource of an Azure Cosmos DB Table event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource """ _validation = { @@ -10167,15 +13329,15 @@ class RestorableSqlDatabaseGetResult(_serialization.Model): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "resource": {"key": "properties.resource", "type": "RestorableSqlDatabasePropertiesResource"}, + "resource": {"key": "properties.resource", "type": "RestorableTablePropertiesResource"}, } def __init__( - self, *, resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, **kwargs: Any + self, *, resource: Optional["_models.RestorableTablePropertiesResource"] = None, **kwargs: Any ) -> None: """ - :keyword resource: The resource of an Azure Cosmos DB SQL database event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource + :keyword resource: The resource of an Azure Cosmos DB Table event. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource """ super().__init__(**kwargs) self.id = None @@ -10184,29 +13346,27 @@ def __init__( self.resource = resource -class RestorableSqlDatabasePropertiesResource(_serialization.Model): - """The resource of an Azure Cosmos DB SQL database event. +class RestorableTablePropertiesResource(_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 database event. Known values are: "Create", + :ivar operation_type: The operation type of this table event. Known values are: "Create", "Replace", "Delete", "Recreate", and "SystemOperation". :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar can_undelete: A state of this database to identify if this database is restorable in same + :ivar can_undelete: A state of this table to identify if this table is restorable in same account. :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this database can not be restored in same account. + :ivar can_undelete_reason: The reason why this table can not be restored in same account. :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this database event happened. + :ivar event_timestamp: The time when this table event happened. :vartype event_timestamp: str - :ivar owner_id: The name of the SQL database. + :ivar owner_id: The name of this Table. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of the SQL database. + :ivar owner_resource_id: The resource ID of this Table. :vartype owner_resource_id: str - :ivar database: Cosmos DB SQL database resource object. - :vartype database: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase """ _validation = { @@ -10227,198 +13387,346 @@ class RestorableSqlDatabasePropertiesResource(_serialization.Model): "event_timestamp": {"key": "eventTimestamp", "type": "str"}, "owner_id": {"key": "ownerId", "type": "str"}, "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, - "database": {"key": "database", "type": "RestorableSqlDatabasePropertiesResourceDatabase"}, } - def __init__( - self, *, database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, **kwargs: Any - ) -> None: - """ - :keyword database: Cosmos DB SQL database resource object. - :paramtype database: - ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase - """ - super().__init__(**kwargs) - self.rid = None - self.operation_type = None - self.can_undelete = None - self.can_undelete_reason = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None - self.database = database + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.rid = None + self.operation_type = None + self.can_undelete = None + self.can_undelete_reason = None + self.event_timestamp = None + self.owner_id = None + self.owner_resource_id = None + + +class RestorableTableResourcesGetResult(_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 Table. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class RestorableTableResourcesListResult(_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[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RestorableTableResourcesGetResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class RestorableTablesListResult(_serialization.Model): + """The List operation response, that contains the Table events and their properties. + + 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] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[RestorableTableGetResult]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + + +class RestoreParameters(RestoreParametersBase): + """Parameters to indicate the information about the restore. + + :ivar restore_source: The id of the restorable database account from which the restore has to + be initiated. For example: + /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long + :vartype restore_source: str + :ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). + :vartype restore_timestamp_in_utc: ~datetime.datetime + :ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live + disabled upon the successful restore. + :vartype restore_with_ttl_disabled: bool + :ivar restore_mode: Describes the mode of the restore. "PointInTime" + :vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode + :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] + :ivar source_backup_location: The source backup location for restore. + :vartype source_backup_location: str + """ + + _attribute_map = { + "restore_source": {"key": "restoreSource", "type": "str"}, + "restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"}, + "restore_with_ttl_disabled": {"key": "restoreWithTtlDisabled", "type": "bool"}, + "restore_mode": {"key": "restoreMode", "type": "str"}, + "databases_to_restore": {"key": "databasesToRestore", "type": "[DatabaseRestoreResource]"}, + "gremlin_databases_to_restore": { + "key": "gremlinDatabasesToRestore", + "type": "[GremlinDatabaseRestoreResource]", + }, + "tables_to_restore": {"key": "tablesToRestore", "type": "[str]"}, + "source_backup_location": {"key": "sourceBackupLocation", "type": "str"}, + } + + def __init__( + self, + *, + restore_source: Optional[str] = None, + restore_timestamp_in_utc: Optional[datetime.datetime] = None, + restore_with_ttl_disabled: Optional[bool] = None, + restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, + databases_to_restore: Optional[List["_models.DatabaseRestoreResource"]] = None, + gremlin_databases_to_restore: Optional[List["_models.GremlinDatabaseRestoreResource"]] = None, + tables_to_restore: Optional[List[str]] = None, + source_backup_location: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword restore_source: The id of the restorable database account from which the restore has + to be initiated. For example: + /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long + :paramtype restore_source: str + :keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 + format). + :paramtype restore_timestamp_in_utc: ~datetime.datetime + :keyword restore_with_ttl_disabled: Specifies whether the restored account will have + Time-To-Live disabled upon the successful restore. + :paramtype restore_with_ttl_disabled: bool + :keyword restore_mode: Describes the mode of the restore. "PointInTime" + :paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode + :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] + :keyword source_backup_location: The source backup location for restore. + :paramtype source_backup_location: str + """ + super().__init__( + restore_source=restore_source, + restore_timestamp_in_utc=restore_timestamp_in_utc, + restore_with_ttl_disabled=restore_with_ttl_disabled, + **kwargs + ) + self.restore_mode = restore_mode + self.databases_to_restore = databases_to_restore + self.gremlin_databases_to_restore = gremlin_databases_to_restore + self.tables_to_restore = tables_to_restore + self.source_backup_location = source_backup_location + +class RetrieveThroughputParameters(ARMResourceProperties): + """Cosmos DB retrieve throughput parameters object. -class SqlDatabaseResource(_serialization.Model): - """Cosmos DB SQL 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 server. - :ivar id: Name of the Cosmos DB SQL database. Required. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :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: 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: The standard JSON format of a resource throughput. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource """ _validation = { - "id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "resource": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "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, *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", + resource: "_models.RetrieveThroughputPropertiesResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL database. Required. - :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a resource throughput. Required. + :paramtype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource """ - super().__init__(**kwargs) - self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode - + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource -class RestorableSqlDatabasePropertiesResourceDatabase( - SqlDatabaseResource, ExtendedResourceProperties -): # pylint: disable=name-too-long - """Cosmos DB SQL database resource object. - Variables are only populated by the server, and will be ignored when sending a request. +class RetrieveThroughputPropertiesResource(_serialization.Model): + """Resource to retrieve throughput information for Cosmos DB resource. All required parameters must be populated in order to send to server. - :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 id: Name of the Cosmos DB SQL database. Required. - :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar colls: A system generated property that specified the addressable path of the collections - resource. - :vartype colls: str - :ivar users: A system generated property that specifies the addressable path of the users - resource. - :vartype users: str - :ivar self_property: A system generated property that specifies the addressable path of the - database resource. - :vartype self_property: str + :ivar physical_partition_ids: Array of PhysicalPartitionId objects. Required. + :vartype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] """ _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, - "colls": {"readonly": True}, - "users": {"readonly": True}, - "self_property": {"readonly": True}, + "physical_partition_ids": {"required": True}, } _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, - "colls": {"key": "_colls", "type": "str"}, - "users": {"key": "_users", "type": "str"}, - "self_property": {"key": "_self", "type": "str"}, + "physical_partition_ids": {"key": "physicalPartitionIds", "type": "[PhysicalPartitionId]"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs: Any - ) -> None: + def __init__(self, *, physical_partition_ids: List["_models.PhysicalPartitionId"], **kwargs: Any) -> None: """ - :keyword id: Name of the Cosmos DB SQL database. Required. - :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword physical_partition_ids: Array of PhysicalPartitionId objects. Required. + :paramtype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) - self.rid = None - self.ts = None - self.etag = None - self.colls = None - self.users = None - self.self_property = None - self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode - + super().__init__(**kwargs) + self.physical_partition_ids = physical_partition_ids -class RestorableSqlDatabasesListResult(_serialization.Model): - """The List operation response, that contains the SQL database events and their properties. - Variables are only populated by the server, and will be ignored when sending a request. +class Role(_serialization.Model): + """The set of roles permitted through this Role Definition. - :ivar value: List of SQL database events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] + :ivar db: The database name the role is applied. + :vartype db: str + :ivar role: The role name. + :vartype role: str """ - _validation = { - "value": {"readonly": True}, + _attribute_map = { + "db": {"key": "db", "type": "str"}, + "role": {"key": "role", "type": "str"}, } + def __init__(self, *, db: Optional[str] = None, role: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword db: The database name the role is applied. + :paramtype db: str + :keyword role: The role name. + :paramtype role: str + """ + super().__init__(**kwargs) + self.db = db + self.role = role + + +class SeedNode(_serialization.Model): + """SeedNode. + + :ivar ip_address: IP address of this seed node. + :vartype ip_address: str + """ + _attribute_map = { - "value": {"key": "value", "type": "[RestorableSqlDatabaseGetResult]"}, + "ip_address": {"key": "ipAddress", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, ip_address: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword ip_address: IP address of this seed node. + :paramtype ip_address: str + """ super().__init__(**kwargs) - self.value = None + self.ip_address = ip_address -class RestorableSqlResourcesGetResult(_serialization.Model): - """Specific Databases to restore. +class ServiceResource(ARMProxyResource): + """Properties for the 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. + :ivar id: The unique resource identifier of the database account. :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The name of the database account. :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] + :ivar properties: Services response resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties """ _validation = { @@ -10431,34 +13739,47 @@ class RestorableSqlResourcesGetResult(_serialization.Model): "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]"}, + "properties": {"key": "properties", "type": "ServiceResourceProperties"}, } - def __init__( - self, *, database_name: Optional[str] = None, collection_names: Optional[List[str]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs: Any) -> None: """ - :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] + :keyword properties: Services response resource. + :paramtype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.database_name = database_name - self.collection_names = collection_names + self.properties = properties + + +class ServiceResourceCreateUpdateParameters(_serialization.Model): + """Parameters for Create or Update request for ServiceResource. + + :ivar properties: Properties in ServiceResourceCreateUpdateParameters. + :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "ServiceResourceCreateUpdateProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Properties in ServiceResourceCreateUpdateParameters. + :paramtype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties + """ + super().__init__(**kwargs) + self.properties = properties -class RestorableSqlResourcesListResult(_serialization.Model): - """The List operation response, that contains the restorable SQL resources. +class ServiceResourceListResult(_serialization.Model): + """The List operation response, that contains the Service Resource and their properties. 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.RestorableSqlResourcesGetResult] + :ivar value: List of Service Resource and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.ServiceResource] """ _validation = { @@ -10466,7 +13787,7 @@ class RestorableSqlResourcesListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[RestorableSqlResourcesGetResult]"}, + "value": {"key": "value", "type": "[ServiceResource]"}, } def __init__(self, **kwargs: Any) -> None: @@ -10475,114 +13796,317 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class RestorableTableGetResult(_serialization.Model): - """An Azure Cosmos DB Table event. +class SpatialSpec(_serialization.Model): + """SpatialSpec. + + :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 types: List of path's spatial type. + :vartype types: list[str or ~azure.mgmt.cosmosdb.models.SpatialType] + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "types": {"key": "types", "type": "[str]"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + types: Optional[List[Union[str, "_models.SpatialType"]]] = None, + **kwargs: Any + ) -> None: + """ + :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 types: List of path's spatial type. + :paramtype types: list[str or ~azure.mgmt.cosmosdb.models.SpatialType] + """ + super().__init__(**kwargs) + self.path = path + self.types = types + + +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource Identifier of the ARM resource. + All required parameters must be populated in order to send to server. + + :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 location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar 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: The standard JSON format of a container. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource + :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"}, - "resource": {"key": "properties.resource", "type": "RestorableTablePropertiesResource"}, + "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"}, } def __init__( - self, *, resource: Optional["_models.RestorableTablePropertiesResource"] = None, **kwargs: Any + self, + *, + resource: "_models.SqlContainerResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, + **kwargs: Any ) -> None: """ - :keyword resource: The resource of an Azure Cosmos DB Table event. - :paramtype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a container. Required. + :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().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource + self.options = options -class RestorableTablePropertiesResource(_serialization.Model): - """The resource of an Azure Cosmos DB Table event. +class SqlContainerGetPropertiesOptions(OptionsResource): + """SqlContainerGetPropertiesOptions. + + :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 + """ + + +class SqlContainerGetPropertiesResource(SqlContainerResource, ExtendedResourceProperties): + """SqlContainerGetPropertiesResource. 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 server. + :ivar rid: A system generated property. A unique identifier. :vartype rid: str - :ivar operation_type: The operation type of this table event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: str or ~azure.mgmt.cosmosdb.models.OperationType - :ivar can_undelete: A state of this table to identify if this table is restorable in same - account. - :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this table can not be restored in same account. - :vartype can_undelete_reason: str - :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 + :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 id: Name of the Cosmos DB SQL container. Required. + :vartype id: str + :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :vartype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :ivar computed_properties: List of computed properties. + :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :ivar vector_embedding_policy: The vector embedding policy for the container. + :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy """ _validation = { "rid": {"readonly": True}, - "operation_type": {"readonly": True}, - "can_undelete": {"readonly": True}, - "can_undelete_reason": {"readonly": True}, - "event_timestamp": {"readonly": True}, - "owner_id": {"readonly": True}, - "owner_resource_id": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": True}, + "id": {"required": True}, } _attribute_map = { "rid": {"key": "_rid", "type": "str"}, - "operation_type": {"key": "operationType", "type": "str"}, - "can_undelete": {"key": "canUndelete", "type": "str"}, - "can_undelete_reason": {"key": "canUndeleteReason", "type": "str"}, - "event_timestamp": {"key": "eventTimestamp", "type": "str"}, - "owner_id": {"key": "ownerId", "type": "str"}, - "owner_resource_id": {"key": "ownerResourceId", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "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"}, + "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, + "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, + "materialized_view_definition": {"key": "materializedViewDefinition", "type": "MaterializedViewDefinition"}, + "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, + "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + 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, + client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, + analytical_storage_ttl: Optional[int] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + computed_properties: Optional[List["_models.ComputedProperty"]] = None, + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Name of the Cosmos DB SQL container. Required. + :paramtype id: str + :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is + automatic for all document paths within the container. + :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 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: int + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword materialized_view_definition: The configuration for defining Materialized Views. This + must be specified only for creating a Materialized View container. + :paramtype materialized_view_definition: ~azure.mgmt.cosmosdb.models.MaterializedViewDefinition + :keyword computed_properties: List of computed properties. + :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] + :keyword vector_embedding_policy: The vector embedding policy for the container. + :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + """ + super().__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, + restore_parameters=restore_parameters, + create_mode=create_mode, + materialized_view_definition=materialized_view_definition, + computed_properties=computed_properties, + vector_embedding_policy=vector_embedding_policy, + **kwargs + ) self.rid = None - self.operation_type = None - self.can_undelete = None - self.can_undelete_reason = None - self.event_timestamp = None - self.owner_id = None - self.owner_resource_id = None + self.ts = None + self.etag = None + 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.restore_parameters = restore_parameters + self.create_mode = create_mode + self.materialized_view_definition = materialized_view_definition + self.computed_properties = computed_properties + self.vector_embedding_policy = vector_embedding_policy -class RestorableTableResourcesGetResult(_serialization.Model): - """Specific Databases to restore. +class SqlContainerGetResults(ARMResourceProperties): + """An Azure Cosmos DB container. 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 Table. + :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: 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.SqlContainerGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions """ _validation = { @@ -10595,23 +14119,52 @@ class RestorableTableResourcesGetResult(_serialization.Model): "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": "SqlContainerGetPropertiesResource"}, + "options": {"key": "properties.options", "type": "SqlContainerGetPropertiesOptions"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.SqlContainerGetPropertiesResource"] = None, + options: Optional["_models.SqlContainerGetPropertiesOptions"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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.SqlContainerGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions + """ + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options -class RestorableTableResourcesListResult(_serialization.Model): - """List of restorable table names. +class SqlContainerListResult(_serialization.Model): + """The List operation response, that contains the containers and their properties. 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[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] + :ivar value: List of containers and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] """ _validation = { @@ -10619,7 +14172,7 @@ class RestorableTableResourcesListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[RestorableTableResourcesGetResult]"}, + "value": {"key": "value", "type": "[SqlContainerGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -10628,170 +14181,208 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class RestorableTablesListResult(_serialization.Model): - """The List operation response, that contains the Table events and their properties. +class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB SQL database. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Table events and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] + All required parameters must be populated in order to send to server. + + :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: 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: The standard JSON format of a SQL database. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource + :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}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[RestorableTableGetResult]"}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "resource": {"required": True}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class RestoreParameters(RestoreParametersBase): - """Parameters to indicate the information about the restore. - - :ivar restore_source: The id of the restorable database account from which the restore has to - be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long - :vartype restore_source: str - :ivar restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 format). - :vartype restore_timestamp_in_utc: ~datetime.datetime - :ivar restore_with_ttl_disabled: Specifies whether the restored account will have Time-To-Live - disabled upon the successful restore. - :vartype restore_with_ttl_disabled: bool - :ivar restore_mode: Describes the mode of the restore. "PointInTime" - :vartype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode - :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 = { - "restore_source": {"key": "restoreSource", "type": "str"}, - "restore_timestamp_in_utc": {"key": "restoreTimestampInUtc", "type": "iso-8601"}, - "restore_with_ttl_disabled": {"key": "restoreWithTtlDisabled", "type": "bool"}, - "restore_mode": {"key": "restoreMode", "type": "str"}, - "databases_to_restore": {"key": "databasesToRestore", "type": "[DatabaseRestoreResource]"}, - "gremlin_databases_to_restore": { - "key": "gremlinDatabasesToRestore", - "type": "[GremlinDatabaseRestoreResource]", - }, - "tables_to_restore": {"key": "tablesToRestore", "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}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "SqlDatabaseResource"}, + "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } def __init__( self, *, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - restore_with_ttl_disabled: Optional[bool] = None, - restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, - databases_to_restore: Optional[List["_models.DatabaseRestoreResource"]] = None, - gremlin_databases_to_restore: Optional[List["_models.GremlinDatabaseRestoreResource"]] = None, - tables_to_restore: Optional[List[str]] = None, + resource: "_models.SqlDatabaseResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: """ - :keyword restore_source: The id of the restorable database account from which the restore has - to be initiated. For example: - /subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{restorableDatabaseAccountName}. # pylint: disable=line-too-long - :paramtype restore_source: str - :keyword restore_timestamp_in_utc: Time to which the account has to be restored (ISO-8601 - format). - :paramtype restore_timestamp_in_utc: ~datetime.datetime - :keyword restore_with_ttl_disabled: Specifies whether the restored account will have - Time-To-Live disabled upon the successful restore. - :paramtype restore_with_ttl_disabled: bool - :keyword restore_mode: Describes the mode of the restore. "PointInTime" - :paramtype restore_mode: str or ~azure.mgmt.cosmosdb.models.RestoreMode - :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] + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a SQL database. Required. + :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().__init__( - restore_source=restore_source, - restore_timestamp_in_utc=restore_timestamp_in_utc, - restore_with_ttl_disabled=restore_with_ttl_disabled, - **kwargs - ) - self.restore_mode = restore_mode - self.databases_to_restore = databases_to_restore - self.gremlin_databases_to_restore = gremlin_databases_to_restore - self.tables_to_restore = tables_to_restore + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options -class Role(_serialization.Model): - """The set of roles permitted through this Role Definition. +class SqlDatabaseGetPropertiesOptions(OptionsResource): + """SqlDatabaseGetPropertiesOptions. - :ivar db: The database name the role is applied. - :vartype db: str - :ivar role: The role name. - :vartype role: 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 """ - _attribute_map = { - "db": {"key": "db", "type": "str"}, - "role": {"key": "role", "type": "str"}, - } - def __init__(self, *, db: Optional[str] = None, role: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword db: The database name the role is applied. - :paramtype db: str - :keyword role: The role name. - :paramtype role: str - """ - super().__init__(**kwargs) - self.db = db - self.role = role +class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProperties): + """SqlDatabaseGetPropertiesResource. + Variables are only populated by the server, and will be ignored when sending a request. -class SeedNode(_serialization.Model): - """SeedNode. + All required parameters must be populated in order to send to server. - :ivar ip_address: IP address of this seed node. - :vartype ip_address: 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 id: Name of the Cosmos DB SQL database. Required. + :vartype id: str + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar colls: A system generated property that specified the addressable path of the collections + resource. + :vartype colls: str + :ivar users: A system generated property that specifies the addressable path of the users + resource. + :vartype users: str """ + _validation = { + "rid": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": True}, + "id": {"required": True}, + } + _attribute_map = { - "ip_address": {"key": "ipAddress", "type": "str"}, + "rid": {"key": "_rid", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, + "colls": {"key": "_colls", "type": "str"}, + "users": {"key": "_users", "type": "str"}, } - def __init__(self, *, ip_address: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", + colls: Optional[str] = None, + users: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword ip_address: IP address of this seed node. - :paramtype ip_address: str + :keyword id: Name of the Cosmos DB SQL database. Required. + :paramtype id: str + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword colls: A system generated property that specified the addressable path of the + collections resource. + :paramtype colls: str + :keyword users: A system generated property that specifies the addressable path of the users + resource. + :paramtype users: str """ - super().__init__(**kwargs) - self.ip_address = ip_address + super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) + self.rid = None + self.ts = None + self.etag = None + self.colls = colls + self.users = users + self.id = id + self.restore_parameters = restore_parameters + self.create_mode = create_mode -class ServiceResource(ARMProxyResource): - """Properties for the database account. +class SqlDatabaseGetResults(ARMResourceProperties): + """An Azure Cosmos DB SQL database. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar properties: Services response resource. - :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar 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.SqlDatabaseGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions """ _validation = { @@ -10804,358 +14395,336 @@ class ServiceResource(ARMProxyResource): "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "ServiceResourceProperties"}, + "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"}, } - def __init__(self, *, properties: Optional["_models.ServiceResourceProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None, + options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: Services response resource. - :paramtype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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.SqlDatabaseGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions """ - super().__init__(**kwargs) - self.properties = properties + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options -class ServiceResourceCreateUpdateParameters(_serialization.Model): - """Parameters for Create or Update request for ServiceResource. +class SqlDatabaseListResult(_serialization.Model): + """The List operation response, that contains the SQL databases and their properties. - :ivar properties: Properties in ServiceResourceCreateUpdateParameters. - :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SQL databases and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] """ + _validation = { + "value": {"readonly": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "ServiceResourceCreateUpdateProperties"}, + "value": {"key": "value", "type": "[SqlDatabaseGetResults]"}, } - def __init__( - self, *, properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Properties in ServiceResourceCreateUpdateParameters. - :paramtype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.properties = properties + self.value = None -class ServiceResourceListResult(_serialization.Model): - """The List operation response, that contains the Service Resource and their properties. +class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long + """Resource for a regional service location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Service Resource and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.ServiceResource] + :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", and "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 """ _validation = { - "value": {"readonly": True}, + "name": {"readonly": True}, + "location": {"readonly": True}, + "status": {"readonly": True}, + "sql_dedicated_gateway_endpoint": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, + "name": {"key": "name", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None + self.sql_dedicated_gateway_endpoint = None -class SpatialSpec(_serialization.Model): - """SpatialSpec. +class SqlDedicatedGatewayServiceResource(_serialization.Model): + """Describes the service response property for SqlDedicatedGateway. - :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 types: List of path's spatial type. - :vartype types: list[str or ~azure.mgmt.cosmosdb.models.SpatialType] + :ivar properties: Properties for SqlDedicatedGatewayServiceResource. + :vartype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "SqlDedicatedGatewayServiceResourceProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Properties for SqlDedicatedGatewayServiceResource. + :paramtype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SqlDedicatedGatewayServiceResourceCreateUpdateProperties( + ServiceResourceCreateUpdateProperties +): # pylint: disable=name-too-long + """Properties for Create or Update request for SqlDedicatedGatewayServiceResource. + + All required parameters must be populated in order to send to server. + + :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", and "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. Required. Known values are: + "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder". + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType + :ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: + "IntegratedCache" and "DistributedQuery". + :vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType """ + _validation = { + "instance_count": {"minimum": 0}, + "service_type": {"required": True}, + } + _attribute_map = { - "path": {"key": "path", "type": "str"}, - "types": {"key": "types", "type": "[str]"}, + "instance_size": {"key": "instanceSize", "type": "str"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + "service_type": {"key": "serviceType", "type": "str"}, + "dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"}, } def __init__( self, *, - path: Optional[str] = None, - types: Optional[List[Union[str, "_models.SpatialType"]]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None, **kwargs: Any ) -> None: """ - :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 types: List of path's spatial type. - :paramtype types: list[str or ~azure.mgmt.cosmosdb.models.SpatialType] + :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + "Cosmos.D8s", and "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 dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: + "IntegratedCache" and "DistributedQuery". + :paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType """ - super().__init__(**kwargs) - self.path = path - self.types = types + super().__init__(instance_size=instance_size, instance_count=instance_count, **kwargs) + self.service_type: str = "SqlDedicatedGateway" + self.dedicated_gateway_type = dedicated_gateway_type -class SqlContainerCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB container. +class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): # pylint: disable=name-too-long + """Properties for SqlDedicatedGatewayServiceResource. 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 server. - :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: 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: The standard JSON format of a container. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.SqlContainerResource - :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 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", and "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. Required. Known values are: + "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "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", and "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 + :ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: + "IntegratedCache" and "DistributedQuery". + :vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType + :ivar locations: An array that contains all of the locations for the service. + :vartype locations: + list[~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayRegionalServiceResource] """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, + "creation_time": {"readonly": True}, + "instance_count": {"minimum": 0}, + "service_type": {"required": True}, + "status": {"readonly": True}, + "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"}, - "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlContainerResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, + "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"}, + "sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"}, + "dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"}, + "locations": {"key": "locations", "type": "[SqlDedicatedGatewayRegionalServiceResource]"}, } def __init__( self, *, - resource: "_models.SqlContainerResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - options: Optional["_models.CreateUpdateOptions"] = None, + additional_properties: Optional[Dict[str, Any]] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + sql_dedicated_gateway_endpoint: Optional[str] = None, + dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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: The standard JSON format of a container. Required. - :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 + :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", and "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 sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service. + :paramtype sql_dedicated_gateway_endpoint: str + :keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: + "IntegratedCache" and "DistributedQuery". + :paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options - - -class SqlContainerGetPropertiesOptions(OptionsResource): - """SqlContainerGetPropertiesOptions. - - :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 - """ - - -class SqlContainerGetPropertiesResource( - SqlContainerResource, ExtendedResourceProperties -): # pylint: disable=too-many-instance-attributes - """SqlContainerGetPropertiesResource. + super().__init__( + additional_properties=additional_properties, + instance_size=instance_size, + instance_count=instance_count, + **kwargs + ) + self.service_type: str = "SqlDedicatedGateway" + self.sql_dedicated_gateway_endpoint = sql_dedicated_gateway_endpoint + self.dedicated_gateway_type = dedicated_gateway_type + self.locations = None - 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 server. +class SqlRoleAssignmentCreateUpdateParameters(_serialization.Model): + """Parameters to create and update an Azure Cosmos DB SQL Role Assignment. - :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 id: Name of the Cosmos DB SQL container. Required. - :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + :ivar role_definition_id: The unique identifier for the associated Role Definition. + :vartype role_definition_id: str + :ivar scope: The data plane resource path for which access is being granted through this Role + Assignment. + :vartype scope: str + :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + which access is being granted through this Role Assignment. Tenant ID for the principal is + inferred using the tenant associated with the subscription. + :vartype principal_id: str """ - _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, - } - - _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "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"}, - "client_encryption_policy": {"key": "clientEncryptionPolicy", "type": "ClientEncryptionPolicy"}, - "analytical_storage_ttl": {"key": "analyticalStorageTtl", "type": "int"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, - "computed_properties": {"key": "computedProperties", "type": "[ComputedProperty]"}, - "vector_embedding_policy": {"key": "vectorEmbeddingPolicy", "type": "VectorEmbeddingPolicy"}, + _attribute_map = { + "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, + "scope": {"key": "properties.scope", "type": "str"}, + "principal_id": {"key": "properties.principalId", "type": "str"}, } def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - 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, - client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = None, - analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - computed_properties: Optional[List["_models.ComputedProperty"]] = None, - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + role_definition_id: Optional[str] = None, + scope: Optional[str] = None, + principal_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL container. Required. - :paramtype id: str - :keyword indexing_policy: The configuration of the indexing policy. By default, the indexing is - automatic for all document paths within the container. - :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 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: int - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword computed_properties: List of computed properties. - :paramtype computed_properties: list[~azure.mgmt.cosmosdb.models.ComputedProperty] - :keyword vector_embedding_policy: The vector embedding policy for the container. - :paramtype vector_embedding_policy: ~azure.mgmt.cosmosdb.models.VectorEmbeddingPolicy + :keyword role_definition_id: The unique identifier for the associated Role Definition. + :paramtype role_definition_id: str + :keyword scope: The data plane resource path for which access is being granted through this + Role Assignment. + :paramtype scope: str + :keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph + to which access is being granted through this Role Assignment. Tenant ID for the principal is + inferred using the tenant associated with the subscription. + :paramtype principal_id: str """ - super().__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, - restore_parameters=restore_parameters, - create_mode=create_mode, - computed_properties=computed_properties, - vector_embedding_policy=vector_embedding_policy, - **kwargs - ) - self.rid = None - self.ts = None - self.etag = None - 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.restore_parameters = restore_parameters - self.create_mode = create_mode - self.computed_properties = computed_properties - self.vector_embedding_policy = vector_embedding_policy + super().__init__(**kwargs) + self.role_definition_id = role_definition_id + self.scope = scope + self.principal_id = principal_id -class SqlContainerGetResults(ARMResourceProperties): - """An Azure Cosmos DB container. +class SqlRoleAssignmentGetResults(ARMProxyResource): + """An Azure Cosmos DB Role Assignment. 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 database account. :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The name of the database account. :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: 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.SqlContainerGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions + :ivar role_definition_id: The unique identifier for the associated Role Definition. + :vartype role_definition_id: str + :ivar scope: The data plane resource path for which access is being granted through this Role + Assignment. + :vartype scope: str + :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + which access is being granted through this Role Assignment. Tenant ID for the principal is + inferred using the tenant associated with the subscription. + :vartype principal_id: str """ _validation = { @@ -11168,48 +14737,43 @@ class SqlContainerGetResults(ARMResourceProperties): "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": "SqlContainerGetPropertiesResource"}, - "options": {"key": "properties.options", "type": "SqlContainerGetPropertiesOptions"}, + "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, + "scope": {"key": "properties.scope", "type": "str"}, + "principal_id": {"key": "properties.principalId", "type": "str"}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.SqlContainerGetPropertiesResource"] = None, - options: Optional["_models.SqlContainerGetPropertiesOptions"] = None, + role_definition_id: Optional[str] = None, + scope: Optional[str] = None, + principal_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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.SqlContainerGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.SqlContainerGetPropertiesOptions + :keyword role_definition_id: The unique identifier for the associated Role Definition. + :paramtype role_definition_id: str + :keyword scope: The data plane resource path for which access is being granted through this + Role Assignment. + :paramtype scope: str + :keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph + to which access is being granted through this Role Assignment. Tenant ID for the principal is + inferred using the tenant associated with the subscription. + :paramtype principal_id: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options + super().__init__(**kwargs) + self.role_definition_id = role_definition_id + self.scope = scope + self.principal_id = principal_id -class SqlContainerListResult(_serialization.Model): - """The List operation response, that contains the containers and their properties. +class SqlRoleAssignmentListResult(_serialization.Model): + """The relevant Role Assignments. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of containers and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :ivar value: List of Role Assignments and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] """ _validation = { @@ -11217,7 +14781,7 @@ class SqlContainerListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[SqlContainerGetResults]"}, + "value": {"key": "value", "type": "[SqlRoleAssignmentGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -11226,181 +14790,169 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB SQL database. +class SqlRoleDefinitionCreateUpdateParameters(_serialization.Model): + """Parameters to create and update an Azure Cosmos DB SQL Role Definition. - Variables are only populated by the server, and will be ignored when sending a request. + :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. Known values + are: "BuiltInRole" and "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 + the entire database account or any underlying Database / Collection. Must have at least one + element. Scopes higher than Database account are not enforceable as assignable Scopes. Note + that resources referenced in assignable Scopes need not exist. + :vartype assignable_scopes: list[str] + :ivar permissions: The set of operations allowed through this Role Definition. + :vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + """ - All required parameters must be populated in order to send to server. + _attribute_map = { + "role_name": {"key": "properties.roleName", "type": "str"}, + "type": {"key": "properties.type", "type": "str"}, + "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, + "permissions": {"key": "properties.permissions", "type": "[Permission]"}, + } - :ivar id: The unique resource identifier of the ARM resource. + def __init__( + self, + *, + role_name: Optional[str] = None, + type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, + assignable_scopes: Optional[List[str]] = None, + permissions: Optional[List["_models.Permission"]] = None, + **kwargs: Any + ) -> None: + """ + :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. Known values + are: "BuiltInRole" and "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 + on the entire database account or any underlying Database / Collection. Must have at least one + element. Scopes higher than Database account are not enforceable as assignable Scopes. Note + that resources referenced in assignable Scopes need not exist. + :paramtype assignable_scopes: list[str] + :keyword permissions: The set of operations allowed through this Role Definition. + :paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + """ + super().__init__(**kwargs) + self.role_name = role_name + self.type = type + self.assignable_scopes = assignable_scopes + self.permissions = permissions + + +class SqlRoleDefinitionGetResults(ARMProxyResource): + """An Azure Cosmos DB SQL Role Definition. + + 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 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: 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: The standard JSON format of a SQL database. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.SqlDatabaseResource - :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 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. + Known values are: "BuiltInRole" and "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 + the entire database account or any underlying Database / Collection. Must have at least one + element. Scopes higher than Database account are not enforceable as assignable Scopes. Note + that resources referenced in assignable Scopes need not exist. + :vartype assignable_scopes: list[str] + :ivar permissions: The set of operations allowed through this Role Definition. + :vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission] """ _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": "SqlDatabaseResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, + "role_name": {"key": "properties.roleName", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, + "permissions": {"key": "properties.permissions", "type": "[Permission]"}, } def __init__( self, *, - resource: "_models.SqlDatabaseResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - options: Optional["_models.CreateUpdateOptions"] = None, + role_name: Optional[str] = None, + type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, + assignable_scopes: Optional[List[str]] = None, + permissions: Optional[List["_models.Permission"]] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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: The standard JSON format of a SQL database. Required. - :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 + :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. Known values are: "BuiltInRole" and "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 + on the entire database account or any underlying Database / Collection. Must have at least one + element. Scopes higher than Database account are not enforceable as assignable Scopes. Note + that resources referenced in assignable Scopes need not exist. + :paramtype assignable_scopes: list[str] + :keyword permissions: The set of operations allowed through this Role Definition. + :paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission] """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options - - -class SqlDatabaseGetPropertiesOptions(OptionsResource): - """SqlDatabaseGetPropertiesOptions. - - :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 - """ + super().__init__(**kwargs) + self.role_name = role_name + self.type_properties_type = type_properties_type + self.assignable_scopes = assignable_scopes + self.permissions = permissions -class SqlDatabaseGetPropertiesResource(SqlDatabaseResource, ExtendedResourceProperties): - """SqlDatabaseGetPropertiesResource. +class SqlRoleDefinitionListResult(_serialization.Model): + """The relevant Role Definitions. 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 server. - - :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 id: Name of the Cosmos DB SQL database. Required. - :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar colls: A system generated property that specified the addressable path of the collections - resource. - :vartype colls: str - :ivar users: A system generated property that specifies the addressable path of the users - resource. - :vartype users: str + :ivar value: List of Role Definitions and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] """ _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, + "value": {"readonly": True}, } _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, - "colls": {"key": "_colls", "type": "str"}, - "users": {"key": "_users", "type": "str"}, + "value": {"key": "value", "type": "[SqlRoleDefinitionGetResults]"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - colls: Optional[str] = None, - users: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Name of the Cosmos DB SQL database. Required. - :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :keyword colls: A system generated property that specified the addressable path of the - collections resource. - :paramtype colls: str - :keyword users: A system generated property that specifies the addressable path of the users - resource. - :paramtype users: str - """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) - self.rid = None - self.ts = None - self.etag = None - self.colls = colls - self.users = users - self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None -class SqlDatabaseGetResults(ARMResourceProperties): - """An Azure Cosmos DB SQL database. +class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB storedProcedure. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to server. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -11416,16 +14968,20 @@ class SqlDatabaseGetResults(ARMResourceProperties): 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.SqlDatabaseGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar resource: The standard JSON format of a storedProcedure. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource + :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 = { @@ -11434,17 +14990,19 @@ class SqlDatabaseGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlDatabaseGetPropertiesResource"}, - "options": {"key": "properties.options", "type": "SqlDatabaseGetPropertiesOptions"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "SqlStoredProcedureResource"}, + "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } def __init__( self, *, + resource: "_models.SqlStoredProcedureResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.SqlDatabaseGetPropertiesResource"] = None, - options: Optional["_models.SqlDatabaseGetPropertiesOptions"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: """ @@ -11457,455 +15015,430 @@ def __init__( 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.SqlDatabaseGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetPropertiesOptions - """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options - - -class SqlDatabaseListResult(_serialization.Model): - """The List operation response, that contains the SQL databases and their properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of SQL databases and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SqlDatabaseGetResults]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - - -class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long - """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. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "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 - """ - - _validation = { - "name": {"readonly": True}, - "location": {"readonly": True}, - "status": {"readonly": True}, - "sql_dedicated_gateway_endpoint": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"}, - } + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :keyword resource: The standard JSON format of a storedProcedure. Required. + :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().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.sql_dedicated_gateway_endpoint = None +class SqlStoredProcedureResource(_serialization.Model): + """Cosmos DB SQL storedProcedure resource object. -class SqlDedicatedGatewayServiceResource(_serialization.Model): - """Describes the service response property for SqlDedicatedGateway. + All required parameters must be populated in order to send to server. - :ivar properties: Properties for SqlDedicatedGatewayServiceResource. - :vartype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties + :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. + :vartype id: str + :ivar body: Body of the Stored Procedure. + :vartype body: str """ + _validation = { + "id": {"required": True}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "SqlDedicatedGatewayServiceResourceProperties"}, + "id": {"key": "id", "type": "str"}, + "body": {"key": "body", "type": "str"}, } def __init__( - self, *, properties: Optional["_models.SqlDedicatedGatewayServiceResourceProperties"] = None, **kwargs: Any + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin ) -> None: """ - :keyword properties: Properties for SqlDedicatedGatewayServiceResource. - :paramtype properties: ~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayServiceResourceProperties + :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. + :paramtype id: str + :keyword body: Body of the Stored Procedure. + :paramtype body: str """ super().__init__(**kwargs) - self.properties = properties + self.id = id + self.body = body -class SqlDedicatedGatewayServiceResourceCreateUpdateProperties( - ServiceResourceCreateUpdateProperties -): # pylint: disable=name-too-long - """Properties for Create or Update request for SqlDedicatedGatewayServiceResource. +class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, ExtendedResourceProperties): + """SqlStoredProcedureGetPropertiesResource. + + 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 server. - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "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. Required. Known values are: - "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "MaterializedViewsBuilder". - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.ServiceType - :ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: - "IntegratedCache" and "DistributedQuery". - :vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType + :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 id: Name of the Cosmos DB SQL storedProcedure. Required. + :vartype id: str + :ivar body: Body of the Stored Procedure. + :vartype body: str """ _validation = { - "instance_count": {"minimum": 0}, - "service_type": {"required": True}, + "rid": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": True}, + "id": {"required": True}, } _attribute_map = { - "instance_size": {"key": "instanceSize", "type": "str"}, - "instance_count": {"key": "instanceCount", "type": "int"}, - "service_type": {"key": "serviceType", "type": "str"}, - "dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"}, + "rid": {"key": "_rid", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "body": {"key": "body", "type": "str"}, } def __init__( - self, - *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, - dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None, - **kwargs: Any + self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin ) -> None: """ - :keyword instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "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 dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: - "IntegratedCache" and "DistributedQuery". - :paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType + :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. + :paramtype id: str + :keyword body: Body of the Stored Procedure. + :paramtype body: str """ - super().__init__(instance_size=instance_size, instance_count=instance_count, **kwargs) - self.service_type: str = "SqlDedicatedGateway" - self.dedicated_gateway_type = dedicated_gateway_type + super().__init__(id=id, body=body, **kwargs) + self.rid = None + self.ts = None + self.etag = None + self.id = id + self.body = body -class SqlDedicatedGatewayServiceResourceProperties(ServiceResourceProperties): # pylint: disable=name-too-long - """Properties for SqlDedicatedGatewayServiceResource. +class SqlStoredProcedureGetResults(ARMResourceProperties): + """An Azure Cosmos DB storedProcedure. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :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", and "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. Required. Known values are: - "SqlDedicatedGateway", "DataTransfer", "GraphAPICompute", and "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", and "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 - :ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: - "IntegratedCache" and "DistributedQuery". - :vartype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: - list[~azure.mgmt.cosmosdb.models.SqlDedicatedGatewayRegionalServiceResource] + :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: 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.SqlStoredProcedureGetPropertiesResource """ _validation = { - "creation_time": {"readonly": True}, - "instance_count": {"minimum": 0}, - "service_type": {"required": True}, - "status": {"readonly": True}, - "locations": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"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"}, - "sql_dedicated_gateway_endpoint": {"key": "sqlDedicatedGatewayEndpoint", "type": "str"}, - "dedicated_gateway_type": {"key": "dedicatedGatewayType", "type": "str"}, - "locations": {"key": "locations", "type": "[SqlDedicatedGatewayRegionalServiceResource]"}, + "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": "SqlStoredProcedureGetPropertiesResource"}, } def __init__( self, *, - additional_properties: Optional[Dict[str, Any]] = None, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, - sql_dedicated_gateway_endpoint: Optional[str] = None, - dedicated_gateway_type: Optional[Union[str, "_models.DedicatedGatewayType"]] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None, **kwargs: Any ) -> None: """ - :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", and "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 sql_dedicated_gateway_endpoint: SqlDedicatedGateway endpoint for the service. - :paramtype sql_dedicated_gateway_endpoint: str - :keyword dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: - "IntegratedCache" and "DistributedQuery". - :paramtype dedicated_gateway_type: str or ~azure.mgmt.cosmosdb.models.DedicatedGatewayType + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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.SqlStoredProcedureGetPropertiesResource """ - super().__init__( - additional_properties=additional_properties, - instance_size=instance_size, - instance_count=instance_count, - **kwargs - ) - self.service_type: str = "SqlDedicatedGateway" - self.sql_dedicated_gateway_endpoint = sql_dedicated_gateway_endpoint - self.dedicated_gateway_type = dedicated_gateway_type - self.locations = None + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource -class SqlRoleAssignmentCreateUpdateParameters(_serialization.Model): - """Parameters to create and update an Azure Cosmos DB SQL Role Assignment. +class SqlStoredProcedureListResult(_serialization.Model): + """The List operation response, that contains the storedProcedures and their properties. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str - :ivar scope: The data plane resource path for which access is being granted through this Role - Assignment. - :vartype scope: str - :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to - which access is being granted through this Role Assignment. Tenant ID for the principal is - inferred using the tenant associated with the subscription. - :vartype principal_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of storedProcedures and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] """ + _validation = { + "value": {"readonly": True}, + } + _attribute_map = { - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "principal_id": {"key": "properties.principalId", "type": "str"}, + "value": {"key": "value", "type": "[SqlStoredProcedureGetResults]"}, } - def __init__( - self, - *, - role_definition_id: Optional[str] = None, - scope: Optional[str] = None, - principal_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword role_definition_id: The unique identifier for the associated Role Definition. - :paramtype role_definition_id: str - :keyword scope: The data plane resource path for which access is being granted through this - Role Assignment. - :paramtype scope: str - :keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph - to which access is being granted through this Role Assignment. Tenant ID for the principal is - inferred using the tenant associated with the subscription. - :paramtype principal_id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.role_definition_id = role_definition_id - self.scope = scope - self.principal_id = principal_id + self.value = None -class SqlRoleAssignmentGetResults(ARMProxyResource): - """An Azure Cosmos DB Role Assignment. +class SqlTriggerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB trigger. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. + All required parameters must be populated in order to send to server. + + :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 role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str - :ivar scope: The data plane resource path for which access is being granted through this Role - Assignment. - :vartype scope: str - :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to - which access is being granted through this Role Assignment. Tenant ID for the principal is - inferred using the tenant associated with the subscription. - :vartype principal_id: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar 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: The standard JSON format of a trigger. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource + :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"}, - "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, - "scope": {"key": "properties.scope", "type": "str"}, - "principal_id": {"key": "properties.principalId", "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"}, } def __init__( self, *, - role_definition_id: Optional[str] = None, - scope: Optional[str] = None, - principal_id: Optional[str] = None, + resource: "_models.SqlTriggerResource", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: """ - :keyword role_definition_id: The unique identifier for the associated Role Definition. - :paramtype role_definition_id: str - :keyword scope: The data plane resource path for which access is being granted through this - Role Assignment. - :paramtype scope: str - :keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph - to which access is being granted through this Role Assignment. Tenant ID for the principal is - inferred using the tenant associated with the subscription. - :paramtype principal_id: str + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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: The standard JSON format of a trigger. Required. + :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().__init__(**kwargs) - self.role_definition_id = role_definition_id - self.scope = scope - self.principal_id = principal_id + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource + self.options = options -class SqlRoleAssignmentListResult(_serialization.Model): - """The relevant Role Assignments. +class SqlTriggerResource(_serialization.Model): + """Cosmos DB SQL trigger 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 server. - :ivar value: List of Role Assignments and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + :ivar id: Name of the Cosmos DB SQL trigger. Required. + :vartype id: str + :ivar body: Body of the Trigger. + :vartype body: str + :ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". + :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType + :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", + "Create", "Update", "Delete", and "Replace". + :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ _validation = { - "value": {"readonly": True}, + "id": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SqlRoleAssignmentGetResults]"}, + "id": {"key": "id", "type": "str"}, + "body": {"key": "body", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "trigger_operation": {"key": "triggerOperation", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + body: Optional[str] = None, + trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, + trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Name of the Cosmos DB SQL trigger. Required. + :paramtype id: str + :keyword body: Body of the Trigger. + :paramtype body: str + :keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". + :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType + :keyword trigger_operation: The operation the trigger is associated with. Known values are: + "All", "Create", "Update", "Delete", and "Replace". + :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation + """ super().__init__(**kwargs) - self.value = None + self.id = id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation -class SqlRoleDefinitionCreateUpdateParameters(_serialization.Model): - """Parameters to create and update an Azure Cosmos DB SQL Role Definition. +class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProperties): + """SqlTriggerGetPropertiesResource. - :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. Known values - are: "BuiltInRole" and "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 - the entire database account or any underlying Database / Collection. Must have at least one - element. Scopes higher than Database account are not enforceable as assignable Scopes. Note - that resources referenced in assignable Scopes need not exist. - :vartype assignable_scopes: list[str] - :ivar permissions: The set of operations allowed through this Role Definition. - :vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + 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 server. + + :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 id: Name of the Cosmos DB SQL trigger. Required. + :vartype id: str + :ivar body: Body of the Trigger. + :vartype body: str + :ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". + :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType + :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", + "Create", "Update", "Delete", and "Replace". + :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ + _validation = { + "rid": {"readonly": True}, + "ts": {"readonly": True}, + "etag": {"readonly": True}, + "id": {"required": True}, + } + _attribute_map = { - "role_name": {"key": "properties.roleName", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, - "permissions": {"key": "properties.permissions", "type": "[Permission]"}, + "rid": {"key": "_rid", "type": "str"}, + "ts": {"key": "_ts", "type": "float"}, + "etag": {"key": "_etag", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "body": {"key": "body", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "trigger_operation": {"key": "triggerOperation", "type": "str"}, } def __init__( self, *, - role_name: Optional[str] = None, - type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, - assignable_scopes: Optional[List[str]] = None, - permissions: Optional[List["_models.Permission"]] = None, + id: str, # pylint: disable=redefined-builtin + body: Optional[str] = None, + trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, + trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, **kwargs: Any ) -> None: """ - :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. Known values - are: "BuiltInRole" and "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 - on the entire database account or any underlying Database / Collection. Must have at least one - element. Scopes higher than Database account are not enforceable as assignable Scopes. Note - that resources referenced in assignable Scopes need not exist. - :paramtype assignable_scopes: list[str] - :keyword permissions: The set of operations allowed through this Role Definition. - :paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + :keyword id: Name of the Cosmos DB SQL trigger. Required. + :paramtype id: str + :keyword body: Body of the Trigger. + :paramtype body: str + :keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". + :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType + :keyword trigger_operation: The operation the trigger is associated with. Known values are: + "All", "Create", "Update", "Delete", and "Replace". + :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation """ - super().__init__(**kwargs) - self.role_name = role_name - self.type = type - self.assignable_scopes = assignable_scopes - self.permissions = permissions + super().__init__(id=id, body=body, trigger_type=trigger_type, trigger_operation=trigger_operation, **kwargs) + self.rid = None + self.ts = None + self.etag = None + self.id = id + self.body = body + self.trigger_type = trigger_type + self.trigger_operation = trigger_operation -class SqlRoleDefinitionGetResults(ARMProxyResource): - """An Azure Cosmos DB SQL Role Definition. +class SqlTriggerGetResults(ARMResourceProperties): + """An Azure Cosmos DB trigger. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The unique resource identifier of the database account. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the database account. + :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :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. - Known values are: "BuiltInRole" and "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 - the entire database account or any underlying Database / Collection. Must have at least one - element. Scopes higher than Database account are not enforceable as assignable Scopes. Note - that resources referenced in assignable Scopes need not exist. - :vartype assignable_scopes: list[str] - :ivar permissions: The set of operations allowed through this Role Definition. - :vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar 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.SqlTriggerGetPropertiesResource """ _validation = { @@ -11918,51 +15451,47 @@ class SqlRoleDefinitionGetResults(ARMProxyResource): "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"}, - "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, - "permissions": {"key": "properties.permissions", "type": "[Permission]"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "SqlTriggerGetPropertiesResource"}, } def __init__( self, *, - role_name: Optional[str] = None, - type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, - assignable_scopes: Optional[List[str]] = None, - permissions: Optional[List["_models.Permission"]] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None, **kwargs: Any ) -> None: """ - :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. Known values are: "BuiltInRole" and "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 - on the entire database account or any underlying Database / Collection. Must have at least one - element. Scopes higher than Database account are not enforceable as assignable Scopes. Note - that resources referenced in assignable Scopes need not exist. - :paramtype assignable_scopes: list[str] - :keyword permissions: The set of operations allowed through this Role Definition. - :paramtype permissions: list[~azure.mgmt.cosmosdb.models.Permission] + :keyword location: The location of the resource group to which the resource belongs. + :paramtype location: str + :keyword 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.SqlTriggerGetPropertiesResource """ - super().__init__(**kwargs) - self.role_name = role_name - self.type_properties_type = type_properties_type - self.assignable_scopes = assignable_scopes - self.permissions = permissions + super().__init__(location=location, tags=tags, identity=identity, **kwargs) + self.resource = resource -class SqlRoleDefinitionListResult(_serialization.Model): - """The relevant Role Definitions. +class SqlTriggerListResult(_serialization.Model): + """The List operation response, that contains the triggers and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Role Definitions and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :ivar value: List of triggers and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] """ _validation = { @@ -11970,7 +15499,7 @@ class SqlRoleDefinitionListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[SqlRoleDefinitionGetResults]"}, + "value": {"key": "value", "type": "[SqlTriggerGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -11979,8 +15508,8 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB storedProcedure. +class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): # pylint: disable=name-too-long + """Parameters to create and update Cosmos DB userDefinedFunction. Variables are only populated by the server, and will be ignored when sending a request. @@ -12001,8 +15530,10 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar resource: The standard JSON format of a storedProcedure. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar resource: The standard JSON format of a userDefinedFunction. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource :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 @@ -12021,16 +15552,18 @@ class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlStoredProcedureResource"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } def __init__( self, *, - resource: "_models.SqlStoredProcedureResource", + resource: "_models.SqlUserDefinedFunctionResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -12044,25 +15577,27 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword resource: The standard JSON format of a storedProcedure. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureResource + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :keyword resource: The standard JSON format of a userDefinedFunction. Required. + :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options -class SqlStoredProcedureResource(_serialization.Model): - """Cosmos DB SQL storedProcedure resource object. +class SqlUserDefinedFunctionResource(_serialization.Model): + """Cosmos DB SQL userDefinedFunction resource object. All required parameters must be populated in order to send to server. - :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. + :ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required. :vartype id: str - :ivar body: Body of the Stored Procedure. + :ivar body: Body of the User Defined Function. :vartype body: str """ @@ -12079,9 +15614,9 @@ def __init__( self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin ) -> None: """ - :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. + :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. :paramtype id: str - :keyword body: Body of the Stored Procedure. + :keyword body: Body of the User Defined Function. :paramtype body: str """ super().__init__(**kwargs) @@ -12089,8 +15624,10 @@ def __init__( self.body = body -class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, ExtendedResourceProperties): - """SqlStoredProcedureGetPropertiesResource. +class SqlUserDefinedFunctionGetPropertiesResource( + SqlUserDefinedFunctionResource, ExtendedResourceProperties +): # pylint: disable=name-too-long + """SqlUserDefinedFunctionGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -12103,9 +15640,9 @@ class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource, Extend :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str - :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. + :ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required. :vartype id: str - :ivar body: Body of the Stored Procedure. + :ivar body: Body of the User Defined Function. :vartype body: str """ @@ -12128,9 +15665,9 @@ def __init__( self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin ) -> None: """ - :keyword id: Name of the Cosmos DB SQL storedProcedure. Required. + :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. :paramtype id: str - :keyword body: Body of the Stored Procedure. + :keyword body: Body of the User Defined Function. :paramtype body: str """ super().__init__(id=id, body=body, **kwargs) @@ -12141,8 +15678,8 @@ def __init__( self.body = body -class SqlStoredProcedureGetResults(ARMResourceProperties): - """An Azure Cosmos DB storedProcedure. +class SqlUserDefinedFunctionGetResults(ARMResourceProperties): + """An Azure Cosmos DB userDefinedFunction. Variables are only populated by the server, and will be ignored when sending a request. @@ -12161,8 +15698,10 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): 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 + :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ _validation = { @@ -12177,7 +15716,8 @@ class SqlStoredProcedureGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlStoredProcedureGetPropertiesResource"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionGetPropertiesResource"}, } def __init__( @@ -12185,7 +15725,8 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.SqlStoredProcedureGetPropertiesResource"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.SqlUserDefinedFunctionGetPropertiesResource"] = None, **kwargs: Any ) -> None: """ @@ -12198,20 +15739,22 @@ def __init__( 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 + :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetPropertiesResource """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource -class SqlStoredProcedureListResult(_serialization.Model): - """The List operation response, that contains the storedProcedures and their properties. +class SqlUserDefinedFunctionListResult(_serialization.Model): + """The List operation response, that contains the userDefinedFunctions and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of storedProcedures and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + :ivar value: List of userDefinedFunctions and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] """ _validation = { @@ -12219,7 +15762,7 @@ class SqlStoredProcedureListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[SqlStoredProcedureGetResults]"}, + "value": {"key": "value", "type": "[SqlUserDefinedFunctionGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -12228,8 +15771,72 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class SqlTriggerCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB trigger. +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :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. Known values are: + "User", "Application", "ManagedIdentity", and "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. Known values + are: "User", "Application", "ManagedIdentity", and "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 + """ + + _attribute_map = { + "created_by": {"key": "createdBy", "type": "str"}, + "created_by_type": {"key": "createdByType", "type": "str"}, + "created_at": {"key": "createdAt", "type": "iso-8601"}, + "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, + "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, + "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + } + + def __init__( + self, + *, + created_by: Optional[str] = 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, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :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. Known values are: + "User", "Application", "ManagedIdentity", and "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. Known + values are: "User", "Application", "ManagedIdentity", and "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 + """ + super().__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TableCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Table. Variables are only populated by the server, and will be ignored when sending a request. @@ -12250,8 +15857,10 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar resource: The standard JSON format of a trigger. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar resource: The standard JSON format of a Table. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.TableResource :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 @@ -12270,16 +15879,18 @@ class SqlTriggerCreateUpdateParameters(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlTriggerResource"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "TableResource"}, "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, } def __init__( self, *, - resource: "_models.SqlTriggerResource", + resource: "_models.TableResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, options: Optional["_models.CreateUpdateOptions"] = None, **kwargs: Any ) -> None: @@ -12293,31 +15904,42 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword resource: The standard JSON format of a trigger. Required. - :paramtype resource: ~azure.mgmt.cosmosdb.models.SqlTriggerResource + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :keyword resource: The standard JSON format of a Table. Required. + :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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource self.options = options -class SqlTriggerResource(_serialization.Model): - """Cosmos DB SQL trigger resource object. +class TableGetPropertiesOptions(OptionsResource): + """TableGetPropertiesOptions. + + :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 + """ + + +class TableResource(_serialization.Model): + """Cosmos DB table resource object. All required parameters must be populated in order to send to server. - :ivar id: Name of the Cosmos DB SQL trigger. Required. + :ivar id: Name of the Cosmos DB table. Required. :vartype id: str - :ivar body: Body of the Trigger. - :vartype body: str - :ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". - :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", - "Create", "Update", "Delete", and "Replace". - :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -12326,40 +15948,35 @@ class SqlTriggerResource(_serialization.Model): _attribute_map = { "id": {"key": "id", "type": "str"}, - "body": {"key": "body", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "trigger_operation": {"key": "triggerOperation", "type": "str"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, } def __init__( self, *, id: str, # pylint: disable=redefined-builtin - body: Optional[str] = None, - trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, - trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL trigger. Required. + :keyword id: Name of the Cosmos DB table. Required. :paramtype id: str - :keyword body: Body of the Trigger. - :paramtype body: str - :keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". - :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :keyword trigger_operation: The operation the trigger is associated with. Known values are: - "All", "Create", "Update", "Delete", and "Replace". - :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ super().__init__(**kwargs) self.id = id - self.body = body - self.trigger_type = trigger_type - self.trigger_operation = trigger_operation + self.restore_parameters = restore_parameters + self.create_mode = create_mode -class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProperties): - """SqlTriggerGetPropertiesResource. +class TableGetPropertiesResource(TableResource, ExtendedResourceProperties): + """TableGetPropertiesResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -12372,15 +15989,13 @@ class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProper :ivar etag: A system generated property representing the resource etag required for optimistic concurrency control. :vartype etag: str - :ivar id: Name of the Cosmos DB SQL trigger. Required. + :ivar id: Name of the Cosmos DB table. Required. :vartype id: str - :ivar body: Body of the Trigger. - :vartype body: str - :ivar trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". - :vartype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", - "Create", "Update", "Delete", and "Replace". - :vartype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ _validation = { @@ -12395,43 +16010,38 @@ class SqlTriggerGetPropertiesResource(SqlTriggerResource, ExtendedResourceProper "ts": {"key": "_ts", "type": "float"}, "etag": {"key": "_etag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "body": {"key": "body", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "trigger_operation": {"key": "triggerOperation", "type": "str"}, + "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, + "create_mode": {"key": "createMode", "type": "str"}, } def __init__( self, *, id: str, # pylint: disable=redefined-builtin - body: Optional[str] = None, - trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, - trigger_operation: Optional[Union[str, "_models.TriggerOperation"]] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Union[str, "_models.CreateMode"] = "Default", **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL trigger. Required. + :keyword id: Name of the Cosmos DB table. Required. :paramtype id: str - :keyword body: Body of the Trigger. - :paramtype body: str - :keyword trigger_type: Type of the Trigger. Known values are: "Pre" and "Post". - :paramtype trigger_type: str or ~azure.mgmt.cosmosdb.models.TriggerType - :keyword trigger_operation: The operation the trigger is associated with. Known values are: - "All", "Create", "Update", "Delete", and "Replace". - :paramtype trigger_operation: str or ~azure.mgmt.cosmosdb.models.TriggerOperation + :keyword restore_parameters: Parameters to indicate the information about the restore. + :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters + :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: + "Default" and "Restore". + :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ - super().__init__(id=id, body=body, trigger_type=trigger_type, trigger_operation=trigger_operation, **kwargs) + super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) self.rid = None self.ts = None self.etag = None self.id = id - self.body = body - self.trigger_type = trigger_type - self.trigger_operation = trigger_operation + self.restore_parameters = restore_parameters + self.create_mode = create_mode -class SqlTriggerGetResults(ARMResourceProperties): - """An Azure Cosmos DB trigger. +class TableGetResults(ARMResourceProperties): + """An Azure Cosmos DB Table. Variables are only populated by the server, and will be ignored when sending a request. @@ -12450,8 +16060,12 @@ class SqlTriggerGetResults(ARMResourceProperties): 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 + :vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions """ _validation = { @@ -12466,7 +16080,9 @@ class SqlTriggerGetResults(ARMResourceProperties): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "SqlTriggerGetPropertiesResource"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "resource": {"key": "properties.resource", "type": "TableGetPropertiesResource"}, + "options": {"key": "properties.options", "type": "TableGetPropertiesOptions"}, } def __init__( @@ -12474,7 +16090,9 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.SqlTriggerGetPropertiesResource"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + resource: Optional["_models.TableGetPropertiesResource"] = None, + options: Optional["_models.TableGetPropertiesOptions"] = None, **kwargs: Any ) -> None: """ @@ -12487,20 +16105,25 @@ def __init__( 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 + :paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource + :keyword options: + :paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource + self.options = options -class SqlTriggerListResult(_serialization.Model): - """The List operation response, that contains the triggers and their properties. +class TableListResult(_serialization.Model): + """The List operation response, that contains the Table and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of triggers and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :ivar value: List of Table and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.TableGetResults] """ _validation = { @@ -12508,7 +16131,7 @@ class SqlTriggerListResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[SqlTriggerGetResults]"}, + "value": {"key": "value", "type": "[TableGetResults]"}, } def __init__(self, **kwargs: Any) -> None: @@ -12517,336 +16140,295 @@ def __init__(self, **kwargs: Any) -> None: self.value = None -class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): # pylint: disable=name-too-long - """Parameters to create and update Cosmos DB userDefinedFunction. +class TableRoleAssignmentListResult(_serialization.Model): + """The relevant Role Assignments. 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 server. - - :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: 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: The standard JSON format of a userDefinedFunction. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionResource - :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 value: List of Role Assignments and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "resource": {"required": True}, + "value": {"readonly": True}, + "next_link": {"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}"}, - "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, + "value": {"key": "value", "type": "[TableRoleAssignmentResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, - *, - resource: "_models.SqlUserDefinedFunctionResource", - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - options: Optional["_models.CreateUpdateOptions"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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: The standard JSON format of a userDefinedFunction. Required. - :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().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None -class SqlUserDefinedFunctionResource(_serialization.Model): - """Cosmos DB SQL userDefinedFunction resource object. +class TableRoleAssignmentResource(ProxyResource): + """Parameters to create and update an Azure Cosmos DB Table Role Assignment. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str - :ivar body: Body of the User Defined Function. - :vartype body: 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar role_definition_id: The unique identifier for the associated Role Definition. + :vartype role_definition_id: str + :ivar scope: The data plane resource path for which access is being granted through this Table + Role Assignment. + :vartype scope: str + :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + which access is being granted through this Table Role Assignment. Tenant ID for the principal + is inferred using the tenant associated with the subscription. + :vartype principal_id: str + :ivar provisioning_state: Provisioning state of the resource. + :vartype provisioning_state: str """ _validation = { - "id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, - "body": {"key": "body", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "role_definition_id": {"key": "properties.roleDefinitionId", "type": "str"}, + "scope": {"key": "properties.scope", "type": "str"}, + "principal_id": {"key": "properties.principalId", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } def __init__( - self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin + self, + *, + role_definition_id: Optional[str] = None, + scope: Optional[str] = None, + principal_id: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. - :paramtype id: str - :keyword body: Body of the User Defined Function. - :paramtype body: str + :keyword role_definition_id: The unique identifier for the associated Role Definition. + :paramtype role_definition_id: str + :keyword scope: The data plane resource path for which access is being granted through this + Table Role Assignment. + :paramtype scope: str + :keyword principal_id: The unique identifier for the associated AAD principal in the AAD graph + to which access is being granted through this Table Role Assignment. Tenant ID for the + principal is inferred using the tenant associated with the subscription. + :paramtype principal_id: str """ super().__init__(**kwargs) - self.id = id - self.body = body + self.role_definition_id = role_definition_id + self.scope = scope + self.principal_id = principal_id + self.provisioning_state = None -class SqlUserDefinedFunctionGetPropertiesResource( - SqlUserDefinedFunctionResource, ExtendedResourceProperties -): # pylint: disable=name-too-long - """SqlUserDefinedFunctionGetPropertiesResource. +class TableRoleDefinitionListResult(_serialization.Model): + """The relevant Role Definitions. 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 server. - - :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 id: Name of the Cosmos DB SQL userDefinedFunction. Required. - :vartype id: str - :ivar body: Body of the User Defined Function. - :vartype body: str + :ivar value: List of Role Definitions and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str """ _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, + "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "body": {"key": "body", "type": "str"}, + "value": {"key": "value", "type": "[TableRoleDefinitionResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__( - self, *, id: str, body: Optional[str] = None, **kwargs: Any # pylint: disable=redefined-builtin - ) -> None: - """ - :keyword id: Name of the Cosmos DB SQL userDefinedFunction. Required. - :paramtype id: str - :keyword body: Body of the User Defined Function. - :paramtype body: str - """ - super().__init__(id=id, body=body, **kwargs) - self.rid = None - self.ts = None - self.etag = None - self.id = id - self.body = body + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None -class SqlUserDefinedFunctionGetResults(ARMResourceProperties): - """An Azure Cosmos DB userDefinedFunction. +class TableRoleDefinitionResource(ProxyResource): + """Parameters to create and update an Azure Cosmos DB Table Role Definition. 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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 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.SqlUserDefinedFunctionGetPropertiesResource + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar id_properties_id: The path id for the Role Definition. + :vartype id_properties_id: 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. + Known values are: "BuiltInRole" and "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 Table Role + Assignments may be created using this Role Definition. This will allow application of this Role + Definition on the entire database account or any underlying Database / Collection. Must have at + least one element. Scopes higher than Database account are not enforceable as assignable + Scopes. Note that resources referenced in assignable Scopes need not exist. + :vartype assignable_scopes: list[str] + :ivar permissions: The set of operations allowed through this Role Definition. + :vartype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"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}"}, - "resource": {"key": "properties.resource", "type": "SqlUserDefinedFunctionGetPropertiesResource"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "id_properties_id": {"key": "properties.id", "type": "str"}, + "role_name": {"key": "properties.roleName", "type": "str"}, + "type_properties_type": {"key": "properties.type", "type": "str"}, + "assignable_scopes": {"key": "properties.assignableScopes", "type": "[str]"}, + "permissions": {"key": "properties.permissions", "type": "[PermissionAutoGenerated]"}, } def __init__( self, *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.SqlUserDefinedFunctionGetPropertiesResource"] = None, + id_properties_id: Optional[str] = None, + role_name: Optional[str] = None, + type_properties_type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, + assignable_scopes: Optional[List[str]] = None, + permissions: Optional[List["_models.PermissionAutoGenerated"]] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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.SqlUserDefinedFunctionGetPropertiesResource + :keyword id_properties_id: The path id for the Role Definition. + :paramtype id_properties_id: str + :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. Known values are: "BuiltInRole" and "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 Table Role + Assignments may be created using this Role Definition. This will allow application of this Role + Definition on the entire database account or any underlying Database / Collection. Must have at + least one element. Scopes higher than Database account are not enforceable as assignable + Scopes. Note that resources referenced in assignable Scopes need not exist. + :paramtype assignable_scopes: list[str] + :keyword permissions: The set of operations allowed through this Role Definition. + :paramtype permissions: list[~azure.mgmt.cosmosdb.models.PermissionAutoGenerated] """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource + super().__init__(**kwargs) + self.id_properties_id = id_properties_id + self.role_name = role_name + self.type_properties_type = type_properties_type + self.assignable_scopes = assignable_scopes + self.permissions = permissions -class SqlUserDefinedFunctionListResult(_serialization.Model): - """The List operation response, that contains the userDefinedFunctions and their properties. +class ThroughputBucketResource(_serialization.Model): + """Cosmos DB throughput bucket 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 server. - :ivar value: List of userDefinedFunctions and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + :ivar id: Represents the throughput bucket id. Required. + :vartype id: int + :ivar max_throughput_percentage: Represents maximum percentage throughput that can be used by + the bucket. Required. + :vartype max_throughput_percentage: int """ _validation = { - "value": {"readonly": True}, + "id": {"required": True}, + "max_throughput_percentage": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SqlUserDefinedFunctionGetResults]"}, + "id": {"key": "id", "type": "int"}, + "max_throughput_percentage": {"key": "maxThroughputPercentage", "type": "int"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, id: int, max_throughput_percentage: int, **kwargs: Any # pylint: disable=redefined-builtin + ) -> None: + """ + :keyword id: Represents the throughput bucket id. Required. + :paramtype id: int + :keyword max_throughput_percentage: Represents maximum percentage throughput that can be used + by the bucket. Required. + :paramtype max_throughput_percentage: int + """ super().__init__(**kwargs) - self.value = None + self.id = id + self.max_throughput_percentage = max_throughput_percentage -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. +class ThroughputPolicyResource(_serialization.Model): + """Cosmos DB resource throughput policy. - :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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known values - are: "User", "Application", "ManagedIdentity", and "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 + :ivar is_enabled: Determines whether the ThroughputPolicy is active or not. + :vartype is_enabled: bool + :ivar increment_percent: Represents the percentage by which throughput can increase every time + throughput policy kicks in. + :vartype increment_percent: int """ _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "increment_percent": {"key": "incrementPercent", "type": "int"}, } def __init__( - self, - *, - created_by: Optional[str] = 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, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any + self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs: Any ) -> None: """ - :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. Known values are: - "User", "Application", "ManagedIdentity", and "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. Known - values are: "User", "Application", "ManagedIdentity", and "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 + :keyword is_enabled: Determines whether the ThroughputPolicy is active or not. + :paramtype is_enabled: bool + :keyword increment_percent: Represents the percentage by which throughput can increase every + time throughput policy kicks in. + :paramtype increment_percent: int """ super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TableCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Table. + self.is_enabled = is_enabled + self.increment_percent = increment_percent - 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 server. +class ThroughputPoolAccountCreateParameters(_serialization.Model): + """Parameters for creating a Azure Cosmos DB throughput pool account. - :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: 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 @@ -12854,42 +16436,28 @@ class TableCreateUpdateParameters(ARMResourceProperties): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar resource: The standard JSON format of a Table. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.TableResource - :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 account_resource_identifier: The resource identifier of global database account in the + throughputPool. + :vartype account_resource_identifier: str + :ivar account_location: The location of global database account in the throughputPool. + :vartype account_location: 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}"}, - "resource": {"key": "properties.resource", "type": "TableResource"}, - "options": {"key": "properties.options", "type": "CreateUpdateOptions"}, + "account_resource_identifier": {"key": "properties.accountResourceIdentifier", "type": "str"}, + "account_location": {"key": "properties.accountLocation", "type": "str"}, } def __init__( self, *, - resource: "_models.TableResource", - location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - options: Optional["_models.CreateUpdateOptions"] = None, + account_resource_identifier: Optional[str] = None, + account_location: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str :keyword 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 @@ -12897,262 +16465,313 @@ def __init__( with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :paramtype tags: dict[str, str] - :keyword resource: The standard JSON format of a Table. Required. - :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 + :keyword account_resource_identifier: The resource identifier of global database account in the + throughputPool. + :paramtype account_resource_identifier: str + :keyword account_location: The location of global database account in the throughputPool. + :paramtype account_location: str """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options - - -class TableGetPropertiesOptions(OptionsResource): - """TableGetPropertiesOptions. - - :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 - """ + super().__init__(**kwargs) + self.tags = tags + self.account_resource_identifier = account_resource_identifier + self.account_location = account_location -class TableResource(_serialization.Model): - """Cosmos DB table resource object. +class ThroughputPoolAccountResource(ProxyResource): + """An Azure Cosmos DB Throughputpool Account. - All required parameters must be populated in order to send to server. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Name of the Cosmos DB table. Required. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar provisioning_state: A provisioning state of the ThroughputPool Account. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar account_resource_identifier: The resource identifier of global database account in the + throughputPool. + :vartype account_resource_identifier: str + :ivar account_location: The location of global database account in the throughputPool. + :vartype account_location: str + :ivar account_instance_id: The instance id of global database account in the throughputPool. + :vartype account_instance_id: str """ _validation = { - "id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "account_instance_id": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "account_resource_identifier": {"key": "properties.accountResourceIdentifier", "type": "str"}, + "account_location": {"key": "properties.accountLocation", "type": "str"}, + "account_instance_id": {"key": "properties.accountInstanceId", "type": "str"}, } def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", + provisioning_state: Optional[Union[str, "_models.Status"]] = None, + account_resource_identifier: Optional[str] = None, + account_location: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword id: Name of the Cosmos DB table. Required. - :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword provisioning_state: A provisioning state of the ThroughputPool Account. Known values + are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :keyword account_resource_identifier: The resource identifier of global database account in the + throughputPool. + :paramtype account_resource_identifier: str + :keyword account_location: The location of global database account in the throughputPool. + :paramtype account_location: str """ super().__init__(**kwargs) - self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode + self.provisioning_state = provisioning_state + self.account_resource_identifier = account_resource_identifier + self.account_location = account_location + self.account_instance_id = None -class TableGetPropertiesResource(TableResource, ExtendedResourceProperties): - """TableGetPropertiesResource. +class ThroughputPoolAccountsListResult(_serialization.Model): + """The List operation response, that contains the global database accounts and their properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of global database accounts in a throughput pool and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ThroughputPoolAccountResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. 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 server. - :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 id: Name of the Cosmos DB table. Required. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str """ _validation = { - "rid": {"readonly": True}, - "ts": {"readonly": True}, - "etag": {"readonly": True}, - "id": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { - "rid": {"key": "_rid", "type": "str"}, - "ts": {"key": "_ts", "type": "float"}, - "etag": {"key": "_etag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "restore_parameters": {"key": "restoreParameters", "type": "ResourceRestoreParameters"}, - "create_mode": {"key": "createMode", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, } - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Union[str, "_models.CreateMode"] = "Default", - **kwargs: Any - ) -> None: + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword id: Name of the Cosmos DB table. Required. - :paramtype id: str - :keyword restore_parameters: Parameters to indicate the information about the restore. - :paramtype restore_parameters: ~azure.mgmt.cosmosdb.models.ResourceRestoreParameters - :keyword create_mode: Enum to indicate the mode of resource creation. Known values are: - "Default" and "Restore". - :paramtype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str """ - super().__init__(id=id, restore_parameters=restore_parameters, create_mode=create_mode, **kwargs) - self.rid = None - self.ts = None - self.etag = None - self.id = id - self.restore_parameters = restore_parameters - self.create_mode = create_mode + super().__init__(**kwargs) + self.tags = tags + self.location = location -class TableGetResults(ARMResourceProperties): - """An Azure Cosmos DB Table. +class ThroughputPoolResource(TrackedResource): + """An Azure Cosmos DB Throughputpool. 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. + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :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 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". + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool. + :vartype max_throughput: int """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, - "resource": {"key": "properties.resource", "type": "TableGetPropertiesResource"}, - "options": {"key": "properties.options", "type": "TableGetPropertiesOptions"}, + "location": {"key": "location", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_throughput": {"key": "properties.maxThroughput", "type": "int"}, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, - resource: Optional["_models.TableGetPropertiesResource"] = None, - options: Optional["_models.TableGetPropertiesOptions"] = None, + provisioning_state: Optional[Union[str, "_models.Status"]] = None, + max_throughput: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword location: The location of the resource group to which the resource belongs. - :paramtype location: str - :keyword 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". + :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword resource: - :paramtype resource: ~azure.mgmt.cosmosdb.models.TableGetPropertiesResource - :keyword options: - :paramtype options: ~azure.mgmt.cosmosdb.models.TableGetPropertiesOptions + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the + pool. + :paramtype max_throughput: int """ - super().__init__(location=location, tags=tags, **kwargs) - self.resource = resource - self.options = options + super().__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = provisioning_state + self.max_throughput = max_throughput -class TableListResult(_serialization.Model): - """The List operation response, that contains the Table and their properties. +class ThroughputPoolsListResult(_serialization.Model): + """The List operation response, that contains the throughput pools and their properties. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: List of Table and their properties. - :vartype value: list[~azure.mgmt.cosmosdb.models.TableGetResults] + :ivar value: List of throughput pools and their properties. + :vartype value: list[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :ivar next_link: The link used to get the next page of results. + :vartype next_link: str """ _validation = { "value": {"readonly": True}, + "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[TableGetResults]"}, + "value": {"key": "value", "type": "[ThroughputPoolResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None + self.next_link = None -class ThroughputPolicyResource(_serialization.Model): - """Cosmos DB resource throughput policy. +class ThroughputPoolUpdate(_serialization.Model): + """Represents a throughput pool resource for updates. - :ivar is_enabled: Determines whether the ThroughputPolicy is active or not. - :vartype is_enabled: bool - :ivar increment_percent: Represents the percentage by which throughput can increase every time - throughput policy kicks in. - :vartype increment_percent: int + :ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar max_throughput: Value for throughput to be shared among CosmosDB resources in the pool. + :vartype max_throughput: int """ _attribute_map = { - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "increment_percent": {"key": "incrementPercent", "type": "int"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "max_throughput": {"key": "properties.maxThroughput", "type": "int"}, } def __init__( - self, *, is_enabled: Optional[bool] = None, increment_percent: Optional[int] = None, **kwargs: Any + self, + *, + provisioning_state: Optional[Union[str, "_models.Status"]] = None, + max_throughput: Optional[int] = None, + **kwargs: Any ) -> None: """ - :keyword is_enabled: Determines whether the ThroughputPolicy is active or not. - :paramtype is_enabled: bool - :keyword increment_percent: Represents the percentage by which throughput can increase every - time throughput policy kicks in. - :paramtype increment_percent: int + :keyword provisioning_state: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", and "Updating". + :paramtype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :keyword max_throughput: Value for throughput to be shared among CosmosDB resources in the + pool. + :paramtype max_throughput: int """ super().__init__(**kwargs) - self.is_enabled = is_enabled - self.increment_percent = increment_percent + self.provisioning_state = provisioning_state + self.max_throughput = max_throughput class ThroughputSettingsResource(_serialization.Model): @@ -13177,6 +16796,9 @@ class ThroughputSettingsResource(_serialization.Model): :ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. :vartype soft_allowed_maximum_throughput: str + :ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB + container. + :vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource] """ _validation = { @@ -13193,6 +16815,7 @@ class ThroughputSettingsResource(_serialization.Model): "offer_replace_pending": {"key": "offerReplacePending", "type": "str"}, "instant_maximum_throughput": {"key": "instantMaximumThroughput", "type": "str"}, "soft_allowed_maximum_throughput": {"key": "softAllowedMaximumThroughput", "type": "str"}, + "throughput_buckets": {"key": "throughputBuckets", "type": "[ThroughputBucketResource]"}, } def __init__( @@ -13200,6 +16823,7 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, + throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None, **kwargs: Any ) -> None: """ @@ -13209,6 +16833,9 @@ def __init__( :keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource + :keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB + container. + :paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource] """ super().__init__(**kwargs) self.throughput = throughput @@ -13217,6 +16844,7 @@ def __init__( self.offer_replace_pending = None self.instant_maximum_throughput = None self.soft_allowed_maximum_throughput = None + self.throughput_buckets = throughput_buckets class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource, ExtendedResourceProperties): @@ -13247,6 +16875,9 @@ class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource, Extend :ivar soft_allowed_maximum_throughput: The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified. :vartype soft_allowed_maximum_throughput: str + :ivar throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB + container. + :vartype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource] """ _validation = { @@ -13269,6 +16900,7 @@ class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource, Extend "offer_replace_pending": {"key": "offerReplacePending", "type": "str"}, "instant_maximum_throughput": {"key": "instantMaximumThroughput", "type": "str"}, "soft_allowed_maximum_throughput": {"key": "softAllowedMaximumThroughput", "type": "str"}, + "throughput_buckets": {"key": "throughputBuckets", "type": "[ThroughputBucketResource]"}, } def __init__( @@ -13276,6 +16908,7 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, + throughput_buckets: Optional[List["_models.ThroughputBucketResource"]] = None, **kwargs: Any ) -> None: """ @@ -13285,8 +16918,16 @@ def __init__( :keyword autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. :paramtype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettingsResource + :keyword throughput_buckets: Array of Throughput Bucket limits to be applied to the Cosmos DB + container. + :paramtype throughput_buckets: list[~azure.mgmt.cosmosdb.models.ThroughputBucketResource] """ - super().__init__(throughput=throughput, autoscale_settings=autoscale_settings, **kwargs) + super().__init__( + throughput=throughput, + autoscale_settings=autoscale_settings, + throughput_buckets=throughput_buckets, + **kwargs + ) self.rid = None self.ts = None self.etag = None @@ -13296,6 +16937,7 @@ def __init__( self.offer_replace_pending = None self.instant_maximum_throughput = None self.soft_allowed_maximum_throughput = None + self.throughput_buckets = throughput_buckets class ThroughputSettingsGetResults(ARMResourceProperties): @@ -13318,6 +16960,8 @@ class ThroughputSettingsGetResults(ARMResourceProperties): 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 """ @@ -13334,6 +16978,7 @@ 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"}, } @@ -13342,6 +16987,7 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, resource: Optional["_models.ThroughputSettingsGetPropertiesResource"] = None, **kwargs: Any ) -> None: @@ -13355,10 +17001,12 @@ def __init__( 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().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource @@ -13384,6 +17032,8 @@ class ThroughputSettingsUpdateParameters(ARMResourceProperties): 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: The standard JSON format of a resource throughput. Required. :vartype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ @@ -13401,6 +17051,7 @@ 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"}, } @@ -13410,6 +17061,7 @@ def __init__( resource: "_models.ThroughputSettingsResource", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, **kwargs: Any ) -> None: """ @@ -13422,10 +17074,12 @@ def __init__( 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: The standard JSON format of a resource throughput. Required. :paramtype resource: ~azure.mgmt.cosmosdb.models.ThroughputSettingsResource """ - super().__init__(location=location, tags=tags, **kwargs) + super().__init__(location=location, tags=tags, identity=identity, **kwargs) self.resource = resource 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 0a347515778b..2654ee4c1eb6 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 @@ -5,50 +5,65 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._database_accounts_operations import DatabaseAccountsOperations -from ._operations import Operations -from ._database_operations import DatabaseOperations -from ._collection_operations import CollectionOperations -from ._collection_region_operations import CollectionRegionOperations -from ._database_account_region_operations import DatabaseAccountRegionOperations -from ._percentile_source_target_operations import PercentileSourceTargetOperations -from ._percentile_target_operations import PercentileTargetOperations -from ._percentile_operations import PercentileOperations -from ._collection_partition_region_operations import CollectionPartitionRegionOperations -from ._collection_partition_operations import CollectionPartitionOperations -from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations -from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations -from ._sql_resources_operations import SqlResourcesOperations -from ._mongo_db_resources_operations import MongoDBResourcesOperations -from ._table_resources_operations import TableResourcesOperations -from ._cassandra_resources_operations import CassandraResourcesOperations -from ._gremlin_resources_operations import GremlinResourcesOperations -from ._locations_operations import LocationsOperations -from ._cassandra_clusters_operations import CassandraClustersOperations -from ._cassandra_data_centers_operations import CassandraDataCentersOperations -from ._notebook_workspaces_operations import NotebookWorkspacesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._restorable_database_accounts_operations import RestorableDatabaseAccountsOperations -from ._restorable_sql_databases_operations import RestorableSqlDatabasesOperations -from ._restorable_sql_containers_operations import RestorableSqlContainersOperations -from ._restorable_sql_resources_operations import RestorableSqlResourcesOperations -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 typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._chaos_fault_operations import ChaosFaultOperations # type: ignore +from ._database_accounts_operations import DatabaseAccountsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._database_operations import DatabaseOperations # type: ignore +from ._collection_operations import CollectionOperations # type: ignore +from ._collection_region_operations import CollectionRegionOperations # type: ignore +from ._database_account_region_operations import DatabaseAccountRegionOperations # type: ignore +from ._percentile_source_target_operations import PercentileSourceTargetOperations # type: ignore +from ._percentile_target_operations import PercentileTargetOperations # type: ignore +from ._percentile_operations import PercentileOperations # type: ignore +from ._collection_partition_region_operations import CollectionPartitionRegionOperations # type: ignore +from ._collection_partition_operations import CollectionPartitionOperations # type: ignore +from ._partition_key_range_id_operations import PartitionKeyRangeIdOperations # type: ignore +from ._partition_key_range_id_region_operations import PartitionKeyRangeIdRegionOperations # type: ignore +from ._graph_resources_operations import GraphResourcesOperations # type: ignore +from ._sql_resources_operations import SqlResourcesOperations # type: ignore +from ._mongo_db_resources_operations import MongoDBResourcesOperations # type: ignore +from ._table_resources_operations import TableResourcesOperations # type: ignore +from ._cassandra_resources_operations import CassandraResourcesOperations # type: ignore +from ._gremlin_resources_operations import GremlinResourcesOperations # type: ignore +from ._locations_operations import LocationsOperations # type: ignore +from ._data_transfer_jobs_operations import DataTransferJobsOperations # type: ignore +from ._cassandra_clusters_operations import CassandraClustersOperations # type: ignore +from ._cassandra_data_centers_operations import CassandraDataCentersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._notebook_workspaces_operations import NotebookWorkspacesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._restorable_database_accounts_operations import RestorableDatabaseAccountsOperations # type: ignore +from ._restorable_sql_databases_operations import RestorableSqlDatabasesOperations # type: ignore +from ._restorable_sql_containers_operations import RestorableSqlContainersOperations # type: ignore +from ._restorable_sql_resources_operations import RestorableSqlResourcesOperations # type: ignore +from ._restorable_mongodb_databases_operations import RestorableMongodbDatabasesOperations # type: ignore +from ._restorable_mongodb_collections_operations import RestorableMongodbCollectionsOperations # type: ignore +from ._restorable_mongodb_resources_operations import RestorableMongodbResourcesOperations # type: ignore +from ._restorable_gremlin_databases_operations import RestorableGremlinDatabasesOperations # type: ignore +from ._restorable_gremlin_graphs_operations import RestorableGremlinGraphsOperations # type: ignore +from ._restorable_gremlin_resources_operations import RestorableGremlinResourcesOperations # type: ignore +from ._restorable_tables_operations import RestorableTablesOperations # type: ignore +from ._restorable_table_resources_operations import RestorableTableResourcesOperations # type: ignore +from ._service_operations import ServiceOperations # type: ignore +from ._throughput_pools_operations import ThroughputPoolsOperations # type: ignore +from ._throughput_pool_operations import ThroughputPoolOperations # type: ignore +from ._throughput_pool_accounts_operations import ThroughputPoolAccountsOperations # type: ignore +from ._throughput_pool_account_operations import ThroughputPoolAccountOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ChaosFaultOperations", "DatabaseAccountsOperations", "Operations", "DatabaseOperations", @@ -62,14 +77,17 @@ "CollectionPartitionOperations", "PartitionKeyRangeIdOperations", "PartitionKeyRangeIdRegionOperations", + "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", "LocationsOperations", + "DataTransferJobsOperations", "CassandraClustersOperations", "CassandraDataCentersOperations", + "NetworkSecurityPerimeterConfigurationsOperations", "NotebookWorkspacesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", @@ -86,6 +104,10 @@ "RestorableTablesOperations", "RestorableTableResourcesOperations", "ServiceOperations", + "ThroughputPoolsOperations", + "ThroughputPoolOperations", + "ThroughputPoolAccountsOperations", + "ThroughputPoolAccountOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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 c989e6328414..f81ee2645b69 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +56,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/cassandraClusters" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -74,7 +74,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +83,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -104,7 +104,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,7 +113,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -139,7 +139,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +148,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -174,7 +174,7 @@ def build_create_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +184,7 @@ def build_create_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -212,7 +212,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -222,7 +222,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -250,7 +250,7 @@ def build_invoke_command_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -260,7 +260,7 @@ def build_invoke_command_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -282,13 +282,200 @@ def build_invoke_command_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_deallocate_request( +def build_invoke_command_async_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommandAsync", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_command_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_command_async_request( + resource_group_name: str, cluster_name: str, command_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands/{commandId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*$" + ), + "commandId": _SERIALIZER.url( + "command_id", command_id, "str", max_length=100, min_length=1, pattern=r"^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_backups_request( resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_backup_request( + resource_group_name: str, cluster_name: str, backup_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deallocate_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + x_ms_force_deallocate: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -297,7 +484,7 @@ def build_deallocate_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -312,6 +499,8 @@ def build_deallocate_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if x_ms_force_deallocate is not None: + _headers["x-ms-force-deallocate"] = _SERIALIZER.header("x_ms_force_deallocate", x_ms_force_deallocate, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) @@ -323,7 +512,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -332,7 +521,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -358,7 +547,7 @@ def build_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -367,7 +556,7 @@ def build_status_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -387,7 +576,7 @@ def build_status_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class CassandraClustersOperations: +class CassandraClustersOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -420,7 +609,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ClusterResour api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +686,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListClusters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -571,7 +760,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -614,7 +803,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo return deserialized # type: ignore def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -721,7 +910,7 @@ def _create_update_initial( body: Union[_models.ClusterResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -918,7 +1107,7 @@ def _update_initial( body: Union[_models.ClusterResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1110,7 +1299,7 @@ def _invoke_command_initial( body: Union[_models.CommandPostBody, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1295,8 +1484,497 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _deallocate_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _invoke_command_async_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CommandAsyncPostBody") + + _request = build_invoke_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: _models.CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CommandPublicResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CommandPublicResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CommandPublicResource]: + """Invoke a command like nodetool for cassandra maintenance asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Specification which command to run where. Is either a CommandAsyncPostBody type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandAsyncPostBody or IO[bytes] + :return: An instance of LROPoller that returns either CommandPublicResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._invoke_command_async_initial( + 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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CommandPublicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CommandPublicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CommandPublicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_command( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.CommandPublicResource"]: + """List all commands currently running on ring info. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of either CommandPublicResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListCommands] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_command_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ListCommands", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get_command_async( + self, resource_group_name: str, cluster_name: str, command_id: str, **kwargs: Any + ) -> _models.CommandPublicResource: + """Get details about a specified command that was run asynchronously. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param command_id: Managed Cassandra cluster command id. Required. + :type command_id: str + :return: CommandPublicResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CommandPublicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) + + _request = build_get_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + command_id=command_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("CommandPublicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_backups( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.BackupResource"]: + """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. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of either BackupResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListBackups] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_backups_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @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. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param backup_id: Id of a restorable backup of a Cassandra cluster. Required. + :type backup_id: str + :return: BackupResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.BackupResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.BackupResource] = kwargs.pop("cls", None) + + _request = build_get_backup_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + backup_id=backup_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _deallocate_initial( + self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1314,6 +1992,7 @@ def _deallocate_initial(self, resource_group_name: str, cluster_name: str, **kwa resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, + x_ms_force_deallocate=x_ms_force_deallocate, api_version=api_version, headers=_headers, params=_params, @@ -1344,7 +2023,9 @@ def _deallocate_initial(self, resource_group_name: str, cluster_name: str, **kwa return deserialized # type: ignore @distributed_trace - def begin_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_deallocate( + self, resource_group_name: str, cluster_name: str, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any + ) -> LROPoller[None]: """Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, and reserved the data disk. This won't do anything on an already deallocated cluster. Use Start to restart the cluster. @@ -1354,6 +2035,10 @@ def begin_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs :type resource_group_name: str :param cluster_name: Managed Cassandra cluster name. Required. :type cluster_name: str + :param x_ms_force_deallocate: Force to deallocate a cluster of Cluster Type Production. Force + to deallocate a cluster of Cluster Type Production might cause data loss. Default value is + None. + :type x_ms_force_deallocate: str :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: @@ -1370,6 +2055,7 @@ def begin_deallocate(self, resource_group_name: str, cluster_name: str, **kwargs raw_result = self._deallocate_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, + x_ms_force_deallocate=x_ms_force_deallocate, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1399,7 +2085,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1516,7 +2202,7 @@ def status( :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 31d793a37ec9..e0cee0656e01 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +56,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +82,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +91,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -126,7 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +134,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -169,7 +168,7 @@ def build_create_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -179,7 +178,7 @@ def build_create_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -215,7 +214,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,7 +224,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -295,7 +294,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListDataCenters] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -374,7 +373,7 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,7 +419,7 @@ def get( def _delete_initial( self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +533,7 @@ def _create_update_initial( body: Union[_models.DataCenterResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -741,7 +740,7 @@ def _update_initial( body: Union[_models.DataCenterResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 de5657308272..e91e4db53617 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_cassandra_keyspaces_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_cassandra_keyspaces_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +85,7 @@ def build_get_cassandra_keyspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_cassandra_keyspace_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_update_cassandra_keyspace_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_update_cassandra_keyspace_request( # pylint: disable=name-too- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,14 +159,14 @@ def build_delete_cassandra_keyspace_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,7 +190,7 @@ def build_get_cassandra_keyspace_throughput_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_get_cassandra_keyspace_throughput_request( # pylint: disable=name-too "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +226,7 @@ def build_update_cassandra_keyspace_throughput_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,7 @@ def build_update_cassandra_keyspace_throughput_request( # pylint: disable=name- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +265,7 @@ def build_migrate_cassandra_keyspace_to_autoscale_request( # pylint: disable=na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_migrate_cassandra_keyspace_to_autoscale_request( # pylint: disable=na "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +301,7 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request( # pylint: di _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_migrate_cassandra_keyspace_to_manual_throughput_request( # pylint: di "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default/migrateToManualThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -337,7 +337,7 @@ def build_list_cassandra_tables_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +346,7 @@ def build_list_cassandra_tables_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +378,7 @@ def build_get_cassandra_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +387,7 @@ def build_get_cassandra_table_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -420,7 +420,7 @@ def build_create_update_cassandra_table_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -430,7 +430,7 @@ def build_create_update_cassandra_table_request( # pylint: disable=name-too-lon "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -464,14 +464,14 @@ def build_delete_cassandra_table_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -501,7 +501,7 @@ def build_get_cassandra_table_throughput_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +510,7 @@ def build_get_cassandra_table_throughput_request( # pylint: disable=name-too-lo "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -543,7 +543,7 @@ def build_update_cassandra_table_throughput_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -553,7 +553,7 @@ def build_update_cassandra_table_throughput_request( # pylint: disable=name-too "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -588,7 +588,7 @@ def build_migrate_cassandra_table_to_autoscale_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -597,7 +597,7 @@ def build_migrate_cassandra_table_to_autoscale_request( # pylint: disable=name- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -630,7 +630,7 @@ def build_migrate_cassandra_table_to_manual_throughput_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +639,7 @@ def build_migrate_cassandra_table_to_manual_throughput_request( # pylint: disab "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default/migrateToManualThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -661,6 +661,301 @@ def build_migrate_cassandra_table_to_manual_throughput_request( # pylint: disab return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_cassandra_views_request( + resource_group_name: str, account_name: str, keyspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_cassandra_view_request( + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_update_cassandra_view_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_cassandra_view_request( + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + # 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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_get_cassandra_view_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_cassandra_view_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_migrate_cassandra_view_to_autoscale_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_migrate_cassandra_view_to_manual_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class CassandraResourcesOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -702,7 +997,7 @@ def list_cassandra_keyspaces( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CassandraKeyspaceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -782,7 +1077,7 @@ def get_cassandra_keyspace( :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -833,7 +1128,7 @@ def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long create_update_cassandra_keyspace_parameters: Union[_models.CassandraKeyspaceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1046,7 +1341,7 @@ def get_long_running_output(pipeline_response): def _delete_cassandra_keyspace_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1177,7 +1472,7 @@ def get_cassandra_keyspace_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1228,7 +1523,7 @@ def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-l update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1439,7 +1734,7 @@ def get_long_running_output(pipeline_response): def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1560,7 +1855,7 @@ def get_long_running_output(pipeline_response): def _migrate_cassandra_keyspace_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1702,7 +1997,7 @@ def list_cassandra_tables( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CassandraTableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1784,7 +2079,7 @@ def get_cassandra_table( :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1837,7 +2132,7 @@ def _create_update_cassandra_table_initial( create_update_cassandra_table_parameters: Union[_models.CassandraTableCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2061,7 +2356,7 @@ def get_long_running_output(pipeline_response): def _delete_cassandra_table_initial( self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2198,7 +2493,7 @@ def get_cassandra_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2251,7 +2546,7 @@ def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2473,7 +2768,7 @@ def get_long_running_output(pipeline_response): def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2598,7 +2893,7 @@ def get_long_running_output(pipeline_response): def _migrate_cassandra_table_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2719,3 +3014,1043 @@ def get_long_running_output(pipeline_response): return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace + def list_cassandra_views( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> Iterable["_models.CassandraViewGetResults"]: + """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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An iterator like instance of either CassandraViewGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CassandraViewListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_cassandra_views_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + 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) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :return: CassandraViewGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) + + _request = build_get_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + 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: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_cassandra_view_parameters, (IOBase, bytes)): + _content = create_update_cassandra_view_parameters + else: + _json = self._serialize.body(create_update_cassandra_view_parameters, "CassandraViewCreateUpdateParameters") + + _request = build_create_update_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Required. + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + 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: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Required. + :type create_update_cassandra_view_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + 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: Union[_models.CassandraViewCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param create_update_cassandra_view_parameters: The parameters to provide for the current + Cassandra View. Is either a CassandraViewCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns either CassandraViewGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CassandraViewGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CassandraViewGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CassandraViewGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_cassandra_view_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_cassandra_view_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_cassandra_view( + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Cassandra view. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + + _request = build_get_cassandra_view_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + + _request = build_update_cassandra_view_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_update_cassandra_view_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Required. + :type update_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_update_cassandra_view_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra view. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_cassandra_view_to_autoscale_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_cassandra_view_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_cassandra_view_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_cassandra_view_to_manual_throughput_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_cassandra_view_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + view_name=view_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_cassandra_view_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any + ) -> LROPoller[_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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param view_name: Cosmos DB view name. Required. + :type view_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_chaos_fault_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_chaos_fault_operations.py new file mode 100644 index 000000000000..990e1f522bc9 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_chaos_fault_operations.py @@ -0,0 +1,523 @@ +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +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(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_enable_disable_request( + resource_group_name: str, account_name: str, chaos_fault: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "chaosFault": _SERIALIZER.url("chaos_fault", chaos_fault, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, chaos_fault: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "chaosFault": _SERIALIZER.url("chaos_fault", chaos_fault, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ChaosFaultOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`chaos_fault` attribute. + """ + + models = _models + + 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, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.ChaosFaultResource"]: + """List Chaos Faults for CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either ChaosFaultResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ChaosFaultListResponse] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ChaosFaultListResponse", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _enable_disable_initial( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(chaos_fault_request, (IOBase, bytes)): + _content = chaos_fault_request + else: + _json = self._serialize.body(chaos_fault_request, "ChaosFaultResource") + + _request = build_enable_disable_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: _models.ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Required. + :type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Required. + :type chaos_fault_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ChaosFaultResource]: + """Enable, disable Chaos Fault in a CosmosDB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :param chaos_fault_request: A request object to enable/disable the chaos fault. Is either a + ChaosFaultResource type or a IO[bytes] type. Required. + :type chaos_fault_request: ~azure.mgmt.cosmosdb.models.ChaosFaultResource or IO[bytes] + :return: An instance of LROPoller that returns either ChaosFaultResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._enable_disable_initial( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + chaos_fault_request=chaos_fault_request, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ChaosFaultResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ChaosFaultResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, chaos_fault: str, **kwargs: Any + ) -> _models.ChaosFaultResource: + """Get Chaos Fault for a CosmosdB account for a particular Chaos Fault. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param chaos_fault: The name of the ChaosFault. Required. + :type chaos_fault: str + :return: ChaosFaultResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ChaosFaultResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ChaosFaultResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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 56e09406cf1a..b2cdb2e88136 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -97,7 +96,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +105,7 @@ def build_list_usages_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -141,7 +140,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +149,7 @@ def build_list_metric_definitions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -227,7 +226,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -327,7 +326,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +416,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 8680b1ddffab..36024135ef0d 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -97,7 +96,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +105,7 @@ def build_list_usages_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,7 +184,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -285,7 +284,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionUsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 1795a9e0ace2..42fb451d8f53 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +52,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +61,7 @@ def build_list_metrics_request( "/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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -144,7 +143,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 230c5025c4b4..d975117d7954 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +52,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +61,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -144,7 +143,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 new file mode 100644 index 000000000000..0c5c5489b190 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_data_transfer_jobs_operations.py @@ -0,0 +1,836 @@ +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pause_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resume_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cancel_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_complete_request( + resource_group_name: str, account_name: str, job_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/complete", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_database_account_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class DataTransferJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`data_transfer_jobs` attribute. + """ + + models = _models + + 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") + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: _models.CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: Union[_models.CreateJobRequest, IO[bytes]], + **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Creates a Data Transfer Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :param job_create_parameters: Is either a CreateJobRequest type or a IO[bytes] type. Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CreateJobRequest or IO[bytes] + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _json = self._serialize.body(job_create_parameters, "CreateJobRequest") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_pause_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_resume_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def complete( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.DataTransferJobGetResults: + """Completes a Data Transfer Online Job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param job_name: Name of the Data Transfer Job. Required. + :type job_name: str + :return: DataTransferJobGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_complete_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.DataTransferJobGetResults"]: + """Get a list of Data Transfer jobs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either DataTransferJobGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.DataTransferJobFeedResults] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) 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 bb1055ae9ae5..6acaeaa8093e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -122,7 +121,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 a5ace477525c..44f9cea428bb 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +48,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +57,7 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +83,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +93,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -158,14 +158,14 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -188,7 +188,7 @@ def build_failover_priority_change_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( @@ -196,7 +196,7 @@ def build_failover_priority_change_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -221,13 +221,13 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -245,7 +245,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,7 +257,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -277,7 +277,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -286,7 +286,7 @@ def build_list_keys_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -312,7 +312,7 @@ def build_list_connection_strings_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,7 +321,7 @@ def build_list_connection_strings_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -347,7 +347,7 @@ def build_offline_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -357,7 +357,7 @@ def build_offline_region_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -385,7 +385,7 @@ def build_online_region_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -395,7 +395,7 @@ def build_online_region_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -423,7 +423,7 @@ def build_get_read_only_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -432,7 +432,7 @@ def build_get_read_only_keys_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -458,7 +458,7 @@ def build_list_read_only_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -467,7 +467,7 @@ def build_list_read_only_keys_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -493,7 +493,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # Construct URL _url = kwargs.pop( @@ -501,7 +501,7 @@ def build_regenerate_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -525,7 +525,7 @@ def build_regenerate_key_request( def build_check_name_exists_request(account_name: str, **kwargs: Any) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") path_format_arguments = { @@ -548,7 +548,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -557,7 +557,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -584,7 +584,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -593,7 +593,7 @@ def build_list_usages_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -621,7 +621,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -630,7 +630,7 @@ def build_list_metric_definitions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -682,7 +682,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,7 +731,7 @@ def _update_initial( update_parameters: Union[_models.DatabaseAccountUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -924,7 +924,7 @@ def _create_or_update_initial( create_update_parameters: Union[_models.DatabaseAccountCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1117,7 +1117,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1231,7 +1231,7 @@ def _failover_priority_change_initial( failover_parameters: Union[_models.FailoverPolicies, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1440,7 +1440,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.DatabaseAccountGetResults"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1520,7 +1520,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1596,7 +1596,7 @@ def list_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1653,7 +1653,7 @@ def list_connection_strings( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListConnectionStringsResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1702,7 +1702,7 @@ def _offline_region_initial( region_parameter_for_offline: Union[_models.RegionForOnlineOffline, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1752,7 +1752,7 @@ def _offline_region_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1898,7 +1898,7 @@ def _online_region_initial( region_parameter_for_online: Union[_models.RegionForOnlineOffline, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1948,7 +1948,7 @@ def _online_region_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2102,7 +2102,7 @@ def get_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2159,7 +2159,7 @@ def list_read_only_keys( :rtype: ~azure.mgmt.cosmosdb.models.DatabaseAccountListReadOnlyKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2208,7 +2208,7 @@ def _regenerate_key_initial( key_to_regenerate: Union[_models.DatabaseAccountRegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2406,7 +2406,7 @@ def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: :rtype: bool :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2468,7 +2468,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2556,7 +2556,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2640,7 +2640,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 cfe133ebda20..bf8bff596b63 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -88,7 +87,7 @@ def build_list_usages_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +96,7 @@ def build_list_usages_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -126,7 +125,7 @@ def build_list_metric_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +134,7 @@ def build_list_metric_definitions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -203,7 +202,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +298,7 @@ def list_usages( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsagesResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +385,7 @@ def list_metric_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MetricDefinitionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 new file mode 100644 index 000000000000..9f6d8471f342 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_graph_resources_operations.py @@ -0,0 +1,679 @@ +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_graphs_request( + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_graph_request( + resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_update_graph_request( + resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_graph_resource_request( + resource_group_name: str, account_name: str, graph_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + # 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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +class GraphResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`graph_resources` attribute. + """ + + models = _models + + 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_graphs( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.GraphResourceGetResults"]: + """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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either GraphResourceGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GraphResourcesListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_graphs_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :return: GraphResourceGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) + + _request = build_get_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_graph_initial( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_graph_parameters, (IOBase, bytes)): + _content = create_update_graph_parameters + else: + _json = self._serialize.body(create_update_graph_parameters, "GraphResourceCreateUpdateParameters") + + _request = build_create_update_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. + Required. + :type create_update_graph_parameters: + ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. + Required. + :type create_update_graph_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: Union[_models.GraphResourceCreateUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :param create_update_graph_parameters: The parameters to provide for the current graph. Is + either a GraphResourceCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_graph_parameters: + ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GraphResourceGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GraphResourceGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GraphResourceGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_graph_resource_initial( + self, resource_group_name: str, account_name: str, graph_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_graph_resource_request( + resource_group_name=resource_group_name, + account_name=account_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_graph_resource( + 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 15900e7d8dd3..47c59fb336c8 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_gremlin_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_gremlin_databases_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +85,7 @@ def build_get_gremlin_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_gremlin_database_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_update_gremlin_database_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_update_gremlin_database_request( # pylint: disable=name-too-lo "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,14 +159,14 @@ def build_delete_gremlin_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,7 +190,7 @@ def build_get_gremlin_database_throughput_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_get_gremlin_database_throughput_request( # pylint: disable=name-too-l "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +226,7 @@ def build_update_gremlin_database_throughput_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,7 @@ def build_update_gremlin_database_throughput_request( # pylint: disable=name-to "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +265,7 @@ def build_migrate_gremlin_database_to_autoscale_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_migrate_gremlin_database_to_autoscale_request( # pylint: disable=name "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +301,7 @@ def build_migrate_gremlin_database_to_manual_throughput_request( # pylint: disa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_migrate_gremlin_database_to_manual_throughput_request( # pylint: disa "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -337,7 +337,7 @@ def build_list_gremlin_graphs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +346,7 @@ def build_list_gremlin_graphs_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +378,7 @@ def build_get_gremlin_graph_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +387,7 @@ def build_get_gremlin_graph_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -420,7 +420,7 @@ def build_create_update_gremlin_graph_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -430,7 +430,7 @@ def build_create_update_gremlin_graph_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -464,14 +464,14 @@ def build_delete_gremlin_graph_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -501,7 +501,7 @@ def build_get_gremlin_graph_throughput_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +510,7 @@ def build_get_gremlin_graph_throughput_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -543,7 +543,7 @@ def build_update_gremlin_graph_throughput_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -553,7 +553,7 @@ def build_update_gremlin_graph_throughput_request( # pylint: disable=name-too-l "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -588,7 +588,7 @@ def build_migrate_gremlin_graph_to_autoscale_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -597,7 +597,7 @@ def build_migrate_gremlin_graph_to_autoscale_request( # pylint: disable=name-to "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -630,7 +630,7 @@ def build_migrate_gremlin_graph_to_manual_throughput_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +639,7 @@ def build_migrate_gremlin_graph_to_manual_throughput_request( # pylint: disable "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -672,7 +672,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -682,7 +682,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/retrieveContinuousBackupInformation", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -747,7 +747,7 @@ def list_gremlin_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GremlinDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -827,7 +827,7 @@ def get_gremlin_database( :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -878,7 +878,7 @@ def _create_update_gremlin_database_initial( create_update_gremlin_database_parameters: Union[_models.GremlinDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1091,7 +1091,7 @@ def get_long_running_output(pipeline_response): def _delete_gremlin_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1222,7 +1222,7 @@ def get_gremlin_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1273,7 +1273,7 @@ def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-lon update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1484,7 +1484,7 @@ def get_long_running_output(pipeline_response): def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1605,7 +1605,7 @@ def get_long_running_output(pipeline_response): def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1747,7 +1747,7 @@ def list_gremlin_graphs( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GremlinGraphListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1829,7 +1829,7 @@ def get_gremlin_graph( :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1882,7 +1882,7 @@ def _create_update_gremlin_graph_initial( create_update_gremlin_graph_parameters: Union[_models.GremlinGraphCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2104,7 +2104,7 @@ def get_long_running_output(pipeline_response): def _delete_gremlin_graph_initial( self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2241,7 +2241,7 @@ def get_gremlin_graph_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2294,7 +2294,7 @@ def _update_gremlin_graph_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2516,7 +2516,7 @@ def get_long_running_output(pipeline_response): def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2641,7 +2641,7 @@ def get_long_running_output(pipeline_response): def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2772,7 +2772,7 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 425f8b0f5ba8..a33a23db87c1 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +42,13 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -67,7 +66,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +74,7 @@ def build_get_request(location: str, subscription_id: str, **kwargs: Any) -> Htt "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" ) path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), } @@ -123,7 +122,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.LocationGetResult"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LocationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +193,7 @@ def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 003131a06f3d..e2b4f01d3981 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_mongo_db_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_mongo_db_databases_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +85,7 @@ def build_get_mongo_db_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_mongo_db_database_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_update_mongo_db_database_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_update_mongo_db_database_request( # pylint: disable=name-too-l "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,14 +159,14 @@ def build_delete_mongo_db_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,7 +190,7 @@ def build_get_mongo_db_database_throughput_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_get_mongo_db_database_throughput_request( # pylint: disable=name-too- "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +226,7 @@ def build_update_mongo_db_database_throughput_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,7 @@ def build_update_mongo_db_database_throughput_request( # pylint: disable=name-t "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +265,7 @@ def build_migrate_mongo_db_database_to_autoscale_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_migrate_mongo_db_database_to_autoscale_request( # pylint: disable=nam "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +301,7 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( # pylint: dis "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -331,13 +331,181 @@ def build_migrate_mongo_db_database_to_manual_throughput_request( # pylint: dis return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_mongo_db_database_retrieve_throughput_distribution_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mongo_db_database_redistribute_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mongo_db_container_retrieve_throughput_distribution_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_mongo_db_container_redistribute_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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 + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_mongo_db_collections_request( resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +514,7 @@ def build_list_mongo_db_collections_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +546,7 @@ def build_get_mongo_db_collection_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +555,7 @@ def build_get_mongo_db_collection_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -420,7 +588,7 @@ def build_create_update_mongo_db_collection_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -430,7 +598,7 @@ def build_create_update_mongo_db_collection_request( # pylint: disable=name-too "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -464,14 +632,14 @@ def build_delete_mongo_db_collection_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -490,6 +658,90 @@ def build_delete_mongo_db_collection_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) +def build_mongo_db_database_partition_merge_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/partitionMerge", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_mongo_db_collection_partition_merge_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_mongo_db_collection_throughput_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -501,7 +753,7 @@ def build_get_mongo_db_collection_throughput_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +762,7 @@ def build_get_mongo_db_collection_throughput_request( # pylint: disable=name-to "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -543,7 +795,7 @@ def build_update_mongo_db_collection_throughput_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -553,7 +805,7 @@ def build_update_mongo_db_collection_throughput_request( # pylint: disable=name "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -588,7 +840,7 @@ def build_migrate_mongo_db_collection_to_autoscale_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -597,7 +849,7 @@ def build_migrate_mongo_db_collection_to_autoscale_request( # pylint: disable=n "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -630,7 +882,7 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request( # pylint: d _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +891,7 @@ def build_migrate_mongo_db_collection_to_manual_throughput_request( # pylint: d "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/migrateToManualThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -667,7 +919,7 @@ def build_get_mongo_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -677,7 +929,7 @@ def build_get_mongo_role_definition_request( ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -703,7 +955,7 @@ def build_create_update_mongo_role_definition_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -714,7 +966,7 @@ def build_create_update_mongo_role_definition_request( # pylint: disable=name-t ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -742,7 +994,7 @@ def build_delete_mongo_role_definition_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -752,7 +1004,7 @@ def build_delete_mongo_role_definition_request( # pylint: disable=name-too-long ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -778,7 +1030,7 @@ def build_list_mongo_role_definitions_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -787,7 +1039,7 @@ def build_list_mongo_role_definitions_request( # pylint: disable=name-too-long "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -813,7 +1065,7 @@ def build_get_mongo_user_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -823,7 +1075,7 @@ def build_get_mongo_user_definition_request( ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -849,7 +1101,7 @@ def build_create_update_mongo_user_definition_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -860,7 +1112,7 @@ def build_create_update_mongo_user_definition_request( # pylint: disable=name-t ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -888,7 +1140,7 @@ def build_delete_mongo_user_definition_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -898,7 +1150,7 @@ def build_delete_mongo_user_definition_request( # pylint: disable=name-too-long ) # 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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -924,7 +1176,7 @@ def build_list_mongo_user_definitions_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -933,7 +1185,7 @@ def build_list_mongo_user_definitions_request( # pylint: disable=name-too-long "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -964,7 +1216,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -974,7 +1226,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1039,7 +1291,7 @@ def list_mongo_db_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoDBDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1119,7 +1371,7 @@ def get_mongo_db_database( :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1170,7 +1422,7 @@ def _create_update_mongo_db_database_initial( create_update_mongo_db_database_parameters: Union[_models.MongoDBDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,7 +1635,7 @@ def get_long_running_output(pipeline_response): def _delete_mongo_db_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1514,7 +1766,7 @@ def get_mongo_db_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1565,7 +1817,7 @@ def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-lo update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1776,7 +2028,7 @@ def get_long_running_output(pipeline_response): def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1897,7 +2149,7 @@ def get_long_running_output(pipeline_response): def _migrate_mongo_db_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2015,23 +2267,929 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def list_mongo_db_collections( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.MongoDBCollectionGetResults"]: - """Lists the MongoDB collection under an existing Azure Cosmos DB database account. + def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An iterator like instance of either MongoDBCollectionGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] - :raises ~azure.core.exceptions.HttpResponseError: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_mongo_db_database_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB database. Is either a RetrieveThroughputParameters type or + a IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._mongo_db_database_retrieve_throughput_distribution_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _mongo_db_database_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_mongo_db_database_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_mongo_db_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB database. Is either a RedistributeThroughputParameters type + or a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._mongo_db_database_redistribute_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _mongo_db_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_mongo_db_container_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_mongo_db_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current MongoDB container. Is either a RetrieveThroughputParameters type + or a IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_mongo_db_container_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current MongoDB container. Is either a RedistributeThroughputParameters type + or a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_mongo_db_collections( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.MongoDBCollectionGetResults"]: + """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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An iterator like instance of either MongoDBCollectionGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -2039,7 +3197,142 @@ def list_mongo_db_collections( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoDBCollectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_mongo_db_collections_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get_mongo_db_collection( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> _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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :return: MongoDBCollectionGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + + _request = build_get_mongo_db_collection_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("MongoDBCollectionGetResults", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2047,66 +3340,150 @@ def list_mongo_db_collections( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _request = build_list_mongo_db_collections_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_collection_parameters + else: + _json = self._serialize.body( + create_update_mongo_db_collection_parameters, "MongoDBCollectionCreateUpdateParameters" + ) - def extract_data(pipeline_response): - deserialized = self._deserialize("MongoDBCollectionListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + _request = build_create_update_mongo_db_collection_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def get_next(next_link=None): - _request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") ) - response = pipeline_response.http_response + response_headers["location"] = self._deserialize("str", response.headers.get("location")) - 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 = response.stream_download(self._client._pipeline, decompress=_decompress) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore + + @overload + def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Required. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Required. + :type create_update_mongo_db_collection_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def get_mongo_db_collection( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> _models.MongoDBCollectionGetResults: - """Gets the MongoDB collection under an existing Azure Cosmos DB database account. + def begin_create_update_mongo_db_collection( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> 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. Required. @@ -2117,11 +3494,69 @@ def get_mongo_db_collection( :type database_name: str :param collection_name: Cosmos DB collection name. Required. :type collection_name: str - :return: MongoDBCollectionGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :param create_update_mongo_db_collection_parameters: The parameters to provide for the current + MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] + type. Required. + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_update_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MongoDBCollectionGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_mongo_db_collection_initial( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2133,9 +3568,9 @@ def get_mongo_db_collection( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_get_mongo_db_collection_request( + _request = build_delete_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2147,34 +3582,106 @@ def get_mongo_db_collection( ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long + @distributed_trace + def begin_delete_mongo_db_collection( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB MongoDB Collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_mongo_db_collection_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _mongo_db_database_partition_merge_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + merge_parameters: Union[_models.MergeParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2192,18 +3699,15 @@ def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_collection_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _json = self._serialize.body( - create_update_mongo_db_collection_parameters, "MongoDBCollectionCreateUpdateParameters" - ) + _json = self._serialize.body(merge_parameters, "MergeParameters") - _request = build_create_update_mongo_db_collection_request( + _request = build_mongo_db_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2245,18 +3749,17 @@ def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long return deserialized # type: ignore @overload - def begin_create_update_mongo_db_collection( + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2265,34 +3768,30 @@ def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :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: """ @overload - def begin_create_update_mongo_db_collection( + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: IO[bytes], + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2301,31 +3800,28 @@ def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Required. - :type create_update_mongo_db_collection_parameters: IO[bytes] + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :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: """ @distributed_trace - def begin_create_update_mongo_db_collection( + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[_models.MongoDBCollectionCreateUpdateParameters, IO[bytes]], + merge_parameters: Union[_models.MergeParameters, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -2334,16 +3830,13 @@ def begin_create_update_mongo_db_collection( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param collection_name: Cosmos DB collection name. Required. - :type collection_name: str - :param create_update_mongo_db_collection_parameters: The parameters to provide for the current - MongoDB Collection. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either MongoDBCollectionGetResults or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2351,17 +3844,16 @@ def begin_create_update_mongo_db_collection( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_mongo_db_collection_initial( + raw_result = self._mongo_db_database_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, + merge_parameters=merge_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -2373,32 +3865,40 @@ def begin_create_update_mongo_db_collection( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MongoDBCollectionGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.MongoDBCollectionGetResults]( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_mongo_db_collection_initial( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2406,19 +3906,31 @@ def _delete_mongo_db_collection_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_delete_mongo_db_collection_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_list_mongo_db_collection_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -2432,7 +3944,7 @@ def _delete_mongo_db_collection_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -2454,11 +3966,87 @@ def _delete_mongo_db_collection_initial( return deserialized # type: ignore + @overload + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param collection_name: Cosmos DB collection name. Required. + :type collection_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + @distributed_trace - def begin_delete_mongo_db_collection( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB Collection. + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **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. Required. @@ -2469,25 +4057,33 @@ def begin_delete_mongo_db_collection( :type database_name: str :param collection_name: Cosmos DB collection name. Required. :type collection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_mongo_db_collection_initial( + 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, headers=_headers, params=_params, @@ -2496,24 +4092,30 @@ def begin_delete_mongo_db_collection( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get_mongo_db_collection_throughput( @@ -2535,7 +4137,7 @@ def get_mongo_db_collection_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2588,7 +4190,7 @@ def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too- update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2810,7 +4412,7 @@ def get_long_running_output(pipeline_response): def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2935,7 +4537,7 @@ def get_long_running_output(pipeline_response): def _migrate_mongo_db_collection_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3075,7 +4677,7 @@ def get_mongo_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3128,7 +4730,7 @@ def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-lo ], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3339,7 +4941,7 @@ def get_long_running_output(pipeline_response): def _delete_mongo_role_definition_initial( self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3467,7 +5069,7 @@ def list_mongo_role_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoRoleDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3547,7 +5149,7 @@ def get_mongo_user_definition( :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3600,7 +5202,7 @@ def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-lo ], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3811,7 +5413,7 @@ def get_long_running_output(pipeline_response): def _delete_mongo_user_definition_initial( self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3939,7 +5541,7 @@ def list_mongo_user_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.MongoUserDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4010,7 +5612,7 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_network_security_perimeter_configurations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_network_security_perimeter_configurations_operations.py new file mode 100644 index 000000000000..787c67acc437 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_network_security_perimeter_configurations_operations.py @@ -0,0 +1,461 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +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(resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", + network_security_perimeter_configuration_name, + "str", + pattern=r"^.*$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_reconcile_request( + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", + network_security_perimeter_configuration_name, + "str", + pattern=r"^.*$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + models = _models + + 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, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]: + """Gets list of effective Network Security Perimeter Configuration for cosmos db account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets effective Network Security Perimeter Configuration for association. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param network_security_perimeter_configuration_name: The name for Network Security Perimeter + configuration. Required. + :type network_security_perimeter_configuration_name: str + :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _reconcile_initial( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_reconcile_request( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reconcile( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Refreshes any information about the association. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param network_security_perimeter_configuration_name: The name for Network Security Perimeter + configuration. Required. + :type network_security_perimeter_configuration_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reconcile_initial( + resource_group_name=resource_group_name, + account_name=account_name, + network_security_perimeter_configuration_name=network_security_perimeter_configuration_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 228a024c413e..44b0aa2abc35 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_by_database_account_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -89,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -129,7 +129,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -139,7 +139,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -172,7 +172,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -181,7 +181,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -212,7 +212,7 @@ def build_list_connection_info_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,7 +221,7 @@ def build_list_connection_info_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -252,7 +252,7 @@ def build_regenerate_auth_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -261,7 +261,7 @@ def build_regenerate_auth_token_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -292,7 +292,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -301,7 +301,7 @@ def build_start_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -362,7 +362,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotebookWorkspaceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +418,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -447,7 +447,7 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -481,7 +481,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NotebookWorkspace", pipeline_response.http_response) @@ -499,7 +499,7 @@ def _create_or_update_initial( notebook_create_update_parameters: Union[_models.NotebookWorkspaceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -550,7 +550,7 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -711,7 +711,7 @@ def _delete_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -750,7 +750,7 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -845,7 +845,7 @@ def list_connection_info( :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -879,7 +879,7 @@ def list_connection_info( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("NotebookWorkspaceConnectionInfoResult", pipeline_response.http_response) @@ -896,7 +896,7 @@ def _regenerate_auth_token_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -935,7 +935,7 @@ def _regenerate_auth_token_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -1015,7 +1015,7 @@ def _start_initial( notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1054,7 +1054,7 @@ def _start_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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 6895122705ce..2fc1b8b87e7e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 5165d38a54dd..7b3f17e06782 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +52,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +61,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -143,7 +142,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 203522a26afe..868a395fdf97 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +53,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +62,7 @@ def build_list_metrics_request( "/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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -149,7 +148,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PartitionMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 16f6f020f7c5..96cfa6b3436e 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -120,7 +119,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 5d2d47a56f60..fc802d126ced 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -141,7 +140,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 ae3c8c7e7398..ffd2e926b097 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_metrics_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_metrics_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -124,7 +123,7 @@ def list_metrics( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PercentileMetricListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 59d541efb4c8..071fb8c5de91 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +49,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +58,7 @@ def build_list_by_database_account_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -89,7 +88,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +97,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -131,7 +130,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +140,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -176,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -185,7 +184,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -249,7 +248,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -328,7 +327,7 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -379,7 +378,7 @@ def _create_or_update_initial( parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +429,7 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -578,7 +577,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -617,7 +616,7 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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 36efa9526eda..f5e65e201e88 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_by_database_account_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +53,7 @@ def build_list_by_database_account_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -80,7 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +88,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -150,7 +149,7 @@ def list_by_database_account( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,7 +228,7 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 21ec035e65e3..ad8edbcefefe 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +51,7 @@ def build_list_by_location_request(location: str, subscription_id: str, **kwargs "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), } @@ -71,7 +70,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -79,7 +78,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/restorableDatabaseAccounts" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -97,7 +96,7 @@ def build_get_by_location_request(location: str, instance_id: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +105,7 @@ def build_get_by_location_request(location: str, instance_id: str, subscription_ "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -162,7 +161,7 @@ def list_by_location(self, location: str, **kwargs: Any) -> Iterable["_models.Re api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,7 +239,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.RestorableDatabaseAccountGetR api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableDatabaseAccountsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -316,7 +315,7 @@ def get_by_location( :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 33d42b2ecf81..d3c6d3af43ea 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +51,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -113,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 40a14534f67e..c4eb2026d578 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_request( "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -142,7 +141,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinGraphsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index ce133cb42bb0..5a6d14031154 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_request( "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -138,7 +137,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableGremlinResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 4570aac4eb65..56d3570339c9 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbCollections", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -142,7 +141,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbCollectionsListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 f2d39316e650..fd8758e71dd7 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +51,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -113,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 ac35ee88344b..d63ce3ee58f6 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableMongodbResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -138,7 +137,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableMongodbResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 5ab9fc83ffef..3630399cf3cc 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +51,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +60,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlContainers", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -141,7 +140,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlContainersListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 bc84754ec592..847ce1032796 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +51,7 @@ def build_list_request(location: str, instance_id: str, subscription_id: str, ** "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -113,7 +112,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlDatabasesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 5896e3d2cde5..6434964b4bd8 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_request( "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}/restorableSqlResources", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -138,7 +137,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableSqlResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index 49bfc7c1fb73..1b014900e3c8 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_request( "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -137,7 +136,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableTableResourcesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 index f97cc61fece4..2a1327a634b6 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,7 @@ def build_list_request( "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "str"), "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } @@ -132,7 +131,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RestorableTablesListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 c55b731d5d1b..3268a28d74ec 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +56,7 @@ def build_list_request(resource_group_name: str, account_name: str, subscription "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -83,7 +82,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -93,7 +92,7 @@ def build_create_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -122,7 +121,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +130,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -158,7 +157,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +166,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +225,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServiceResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -296,7 +295,7 @@ def _create_initial( create_update_parameters: Union[_models.ServiceResourceCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,17 +348,10 @@ def _create_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} - if response.status_code == 202: - response_headers["azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("azure-AsyncOperation") - ) - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @@ -518,7 +510,7 @@ def get( :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -564,7 +556,7 @@ def get( def _delete_initial( self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 6af6c04f29a1..8c45119c3e95 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_sql_databases_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_sql_databases_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +85,7 @@ def build_get_sql_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_sql_database_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_update_sql_database_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_update_sql_database_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,14 +159,14 @@ def build_delete_sql_database_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,7 +190,7 @@ def build_get_sql_database_throughput_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_get_sql_database_throughput_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +226,7 @@ def build_update_sql_database_throughput_request( # pylint: disable=name-too-lo _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,7 @@ def build_update_sql_database_throughput_request( # pylint: disable=name-too-lo "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +265,7 @@ def build_migrate_sql_database_to_autoscale_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_migrate_sql_database_to_autoscale_request( # pylint: disable=name-too "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +301,7 @@ def build_migrate_sql_database_to_manual_throughput_request( # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_migrate_sql_database_to_manual_throughput_request( # pylint: disable= "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/migrateToManualThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -331,13 +331,136 @@ def build_migrate_sql_database_to_manual_throughput_request( # pylint: disable= return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_client_encryption_keys_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_client_encryption_key_request( + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_update_client_encryption_key_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_sql_containers_request( resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +469,7 @@ def build_list_sql_containers_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -378,7 +501,7 @@ def build_get_sql_container_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,7 +510,7 @@ def build_get_sql_container_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -420,7 +543,7 @@ def build_create_update_sql_container_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -430,7 +553,7 @@ def build_create_update_sql_container_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -464,14 +587,14 @@ def build_delete_sql_container_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -490,6 +613,90 @@ def build_delete_sql_container_request( return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) +def build_sql_database_partition_merge_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/partitionMerge", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_sql_container_partition_merge_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("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"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_sql_container_throughput_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -501,7 +708,7 @@ def build_get_sql_container_throughput_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -510,7 +717,7 @@ def build_get_sql_container_throughput_request( # pylint: disable=name-too-long "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -543,7 +750,7 @@ def build_update_sql_container_throughput_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -553,7 +760,7 @@ def build_update_sql_container_throughput_request( # pylint: disable=name-too-l "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -588,7 +795,7 @@ def build_migrate_sql_container_to_autoscale_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -597,7 +804,7 @@ def build_migrate_sql_container_to_autoscale_request( # pylint: disable=name-to "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -630,7 +837,7 @@ def build_migrate_sql_container_to_manual_throughput_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -639,7 +846,7 @@ def build_migrate_sql_container_to_manual_throughput_request( # pylint: disable "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -661,22 +868,23 @@ def build_migrate_sql_container_to_manual_throughput_request( # pylint: disable return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_client_encryption_keys_request( # pylint: disable=name-too-long +def build_sql_database_retrieve_throughput_distribution_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -692,32 +900,74 @@ def build_list_client_encryption_keys_request( # pylint: disable=name-too-long _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_client_encryption_key_request( +def build_sql_database_redistribute_throughput_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, database_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_sql_container_retrieve_throughput_distribution_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + container_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", + "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -725,7 +975,7 @@ def build_get_client_encryption_key_request( "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"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -734,33 +984,35 @@ def build_get_client_encryption_key_request( _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_update_client_encryption_key_request( # pylint: disable=name-too-long +def build_sql_container_redistribute_throughput_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + container_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/clientEncryptionKeys/{clientEncryptionKeyName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -768,7 +1020,7 @@ def build_create_update_client_encryption_key_request( # pylint: disable=name-t "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"), + "containerName": _SERIALIZER.url("container_name", container_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -781,7 +1033,7 @@ def build_create_update_client_encryption_key_request( # pylint: disable=name-t _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) def build_list_sql_stored_procedures_request( @@ -795,7 +1047,7 @@ def build_list_sql_stored_procedures_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -804,7 +1056,7 @@ def build_list_sql_stored_procedures_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -838,7 +1090,7 @@ def build_get_sql_stored_procedure_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -847,7 +1099,7 @@ def build_get_sql_stored_procedure_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -882,7 +1134,7 @@ def build_create_update_sql_stored_procedure_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -892,7 +1144,7 @@ def build_create_update_sql_stored_procedure_request( # pylint: disable=name-to "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -928,14 +1180,14 @@ def build_delete_sql_stored_procedure_request( # pylint: disable=name-too-long ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -966,7 +1218,7 @@ def build_list_sql_user_defined_functions_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -975,7 +1227,7 @@ def build_list_sql_user_defined_functions_request( # pylint: disable=name-too-l "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1009,7 +1261,7 @@ def build_get_sql_user_defined_function_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1018,7 +1270,7 @@ def build_get_sql_user_defined_function_request( # pylint: disable=name-too-lon "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1053,7 +1305,7 @@ def build_create_update_sql_user_defined_function_request( # pylint: disable=na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -1063,7 +1315,7 @@ def build_create_update_sql_user_defined_function_request( # pylint: disable=na "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1099,14 +1351,14 @@ def build_delete_sql_user_defined_function_request( # pylint: disable=name-too- ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1137,7 +1389,7 @@ def build_list_sql_triggers_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1146,7 +1398,7 @@ def build_list_sql_triggers_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1180,7 +1432,7 @@ def build_get_sql_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1189,7 +1441,7 @@ def build_get_sql_trigger_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1224,7 +1476,7 @@ def build_create_update_sql_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -1234,7 +1486,7 @@ def build_create_update_sql_trigger_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1270,14 +1522,14 @@ def build_delete_sql_trigger_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1303,7 +1555,7 @@ def build_get_sql_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1313,7 +1565,7 @@ def build_get_sql_role_definition_request( ) # pylint: disable=line-too-long path_format_arguments = { "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1339,7 +1591,7 @@ def build_create_update_sql_role_definition_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -1350,7 +1602,7 @@ def build_create_update_sql_role_definition_request( # pylint: disable=name-too ) # pylint: disable=line-too-long path_format_arguments = { "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1378,7 +1630,7 @@ def build_delete_sql_role_definition_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1388,7 +1640,7 @@ def build_delete_sql_role_definition_request( ) # pylint: disable=line-too-long path_format_arguments = { "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1414,7 +1666,7 @@ def build_list_sql_role_definitions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1423,7 +1675,7 @@ def build_list_sql_role_definitions_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1449,7 +1701,7 @@ def build_get_sql_role_assignment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1459,7 +1711,7 @@ def build_get_sql_role_assignment_request( ) # pylint: disable=line-too-long path_format_arguments = { "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1485,7 +1737,7 @@ def build_create_update_sql_role_assignment_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -1496,7 +1748,7 @@ def build_create_update_sql_role_assignment_request( # pylint: disable=name-too ) # pylint: disable=line-too-long path_format_arguments = { "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1524,7 +1776,7 @@ def build_delete_sql_role_assignment_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1534,7 +1786,7 @@ def build_delete_sql_role_assignment_request( ) # pylint: disable=line-too-long path_format_arguments = { "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1560,7 +1812,7 @@ def build_list_sql_role_assignments_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1569,7 +1821,7 @@ def build_list_sql_role_assignments_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1600,7 +1852,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -1610,7 +1862,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/retrieveContinuousBackupInformation", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -1675,7 +1927,7 @@ def list_sql_databases( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlDatabaseListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1755,7 +2007,7 @@ def get_sql_database( :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1806,7 +2058,7 @@ def _create_update_sql_database_initial( create_update_sql_database_parameters: Union[_models.SqlDatabaseCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2016,7 +2268,7 @@ def get_long_running_output(pipeline_response): def _delete_sql_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2147,7 +2399,7 @@ def get_sql_database_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2198,7 +2450,7 @@ def _update_sql_database_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2409,7 +2661,7 @@ def get_long_running_output(pipeline_response): def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2530,7 +2782,7 @@ def get_long_running_output(pipeline_response): def _migrate_sql_database_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2649,10 +2901,10 @@ def get_long_running_output(pipeline_response): ) @distributed_trace - def list_sql_containers( + def list_client_encryption_keys( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.SqlContainerGetResults"]: - """Lists the SQL container under an existing Azure Cosmos DB database account. + ) -> Iterable["_models.ClientEncryptionKeyGetResults"]: + """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. Required. @@ -2661,18 +2913,18 @@ def list_sql_containers( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An iterator like instance of either SqlContainerGetResults or the result of + :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2683,7 +2935,7 @@ def list_sql_containers( def prepare_request(next_link=None): if not next_link: - _request = build_list_sql_containers_request( + _request = build_list_client_encryption_keys_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -2712,7 +2964,7 @@ def prepare_request(next_link=None): return _request def extract_data(pipeline_response): - deserialized = self._deserialize("SqlContainerListResult", pipeline_response) + deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -2736,10 +2988,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - 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. + 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. Required. @@ -2748,13 +3005,13 @@ def get_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :return: SqlContainerGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :return: ClientEncryptionKeyGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2766,13 +3023,13 @@ def get_sql_container( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - _request = build_get_sql_container_request( + _request = build_get_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, headers=_headers, @@ -2791,23 +3048,25 @@ def get_sql_container( 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.http_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_sql_container_initial( + def _create_update_client_encryption_key_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2825,16 +3084,18 @@ def _create_update_sql_container_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): - _content = create_update_sql_container_parameters + if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): + _content = create_update_client_encryption_key_parameters else: - _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") + _json = self._serialize.body( + create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" + ) - _request = build_create_update_sql_container_request( + _request = build_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -2876,18 +3137,19 @@ def _create_update_sql_container_initial( return deserialized # type: ignore @overload - def begin_create_update_sql_container( + def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -2896,34 +3158,36 @@ def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :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: """ @overload - def begin_create_update_sql_container( + def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: IO[bytes], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -2932,31 +3196,35 @@ def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Required. - :type create_update_sql_container_parameters: IO[bytes] + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Required. + :type create_update_client_encryption_key_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :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: """ @distributed_trace - def begin_create_update_sql_container( + def begin_create_update_client_encryption_key( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -2965,15 +3233,17 @@ def begin_create_update_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :param create_update_sql_container_parameters: The parameters to provide for the current SQL - container. Is either a SqlContainerCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_container_parameters: - ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :param create_update_client_encryption_key_parameters: The parameters to provide for the client + encryption key. Is either a ClientEncryptionKeyCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_client_encryption_key_parameters: + ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] + :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: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -2981,17 +3251,17 @@ def begin_create_update_sql_container( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_sql_container_initial( + raw_result = self._create_update_client_encryption_key_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, + 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, @@ -3003,7 +3273,7 @@ def begin_create_update_sql_container( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) + deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3015,80 +3285,21 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlContainerGetResults].from_continuation_token( + return LROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.SqlContainerGetResults]( + return LROPoller[_models.ClientEncryptionKeyGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_container_initial( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_sql_container_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("azure-AsyncOperation") - ) - response_headers["location"] = self._deserialize("str", response.headers.get("location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @distributed_trace - def begin_delete_sql_container( - 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. + def list_sql_containers( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> Iterable["_models.SqlContainerGetResults"]: + """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. Required. @@ -3097,60 +3308,85 @@ def begin_delete_sql_container( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] + :return: An iterator like instance of either SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - 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, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + cls: ClsType[_models.SqlContainerListResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_sql_containers_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SqlContainerListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, None, {}) # type: ignore + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + 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) @distributed_trace - def get_sql_container_throughput( + def get_sql_container( 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. + ) -> _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. Required. @@ -3161,11 +3397,11 @@ def get_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :return: ThroughputSettingsGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :return: SqlContainerGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3177,9 +3413,9 @@ def get_sql_container_throughput( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - _request = build_get_sql_container_throughput_request( + _request = build_get_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3202,23 +3438,23 @@ def get_sql_container_throughput( 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.http_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_sql_container_throughput_initial( + def _create_update_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3236,12 +3472,12 @@ def _update_sql_container_throughput_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): + _content = create_update_sql_container_parameters else: - _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + _json = self._serialize.body(create_update_sql_container_parameters, "SqlContainerCreateUpdateParameters") - _request = build_update_sql_container_throughput_request( + _request = build_create_update_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3287,18 +3523,18 @@ def _update_sql_container_throughput_initial( return deserialized # type: ignore @overload - def begin_update_sql_container_throughput( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -3309,32 +3545,32 @@ def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :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 SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_sql_container_throughput( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: IO[bytes], + create_update_sql_container_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -3345,29 +3581,29 @@ def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Required. - :type update_throughput_parameters: IO[bytes] + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Required. + :type create_update_sql_container_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :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 SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_sql_container_throughput( + def begin_create_update_sql_container( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + create_update_sql_container_parameters: Union[_models.SqlContainerCreateUpdateParameters, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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. Required. @@ -3378,14 +3614,13 @@ def begin_update_sql_container_throughput( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL container. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] - :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] + :param create_update_sql_container_parameters: The parameters to provide for the current SQL + container. Is either a SqlContainerCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_container_parameters: + ~azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns either SqlContainerGetResults or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -3393,17 +3628,17 @@ def begin_update_sql_container_throughput( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._update_sql_container_throughput_initial( + raw_result = self._create_update_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - update_throughput_parameters=update_throughput_parameters, + create_update_sql_container_parameters=create_update_sql_container_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -3415,7 +3650,7 @@ def begin_update_sql_container_throughput( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + deserialized = self._deserialize("SqlContainerGetResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -3427,20 +3662,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.SqlContainerGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ThroughputSettingsGetResults]( + return LROPoller[_models.SqlContainerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-long + def _delete_sql_container_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3454,7 +3689,7 @@ def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-lon api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_migrate_sql_container_to_autoscale_request( + _request = build_delete_sql_container_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3474,7 +3709,7 @@ def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-lon response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -3497,10 +3732,10 @@ def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-lon return deserialized # type: ignore @distributed_trace - def begin_migrate_sql_container_to_autoscale( + def begin_delete_sql_container( 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. Required. @@ -3511,21 +3746,20 @@ def begin_migrate_sql_container_to_autoscale( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :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: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_sql_container_to_autoscale_initial( + raw_result = self._delete_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, @@ -3539,11 +3773,9 @@ def begin_migrate_sql_container_to_autoscale( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -3552,20 +3784,23 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ThroughputSettingsGetResults]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + def _sql_database_partition_merge_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3573,19 +3808,30 @@ def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_migrate_sql_container_to_manual_throughput_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_sql_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) @@ -3621,11 +3867,18 @@ def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name return deserialized # type: ignore - @distributed_trace - def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-too-long - 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 autoscale to manual throughput. + @overload + def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3634,28 +3887,1084 @@ def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-to :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param container_name: Cosmos DB container name. Required. - :type container_name: str - :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: - """ + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._sql_database_partition_merge_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + merge_parameters=merge_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _list_sql_container_partition_merge_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: Union[_models.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _json = self._serialize.body(merge_parameters, "MergeParameters") + + _request = build_list_sql_container_partition_merge_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_list_sql_container_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.MergeParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param merge_parameters: The parameters for the merge operation. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionStorageInfoCollection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionStorageInfoCollection", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionStorageInfoCollection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( + self._client, raw_result, get_long_running_output, polling_method # 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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: ThroughputSettingsGetResults or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + + _request = build_get_sql_container_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _json = self._serialize.body(update_throughput_parameters, "ThroughputSettingsUpdateParameters") + + _request = build_update_sql_container_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + 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, + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_update_sql_container_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Required. + :type update_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @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: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], + **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. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL container. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_sql_container_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_sql_container_to_autoscale( + 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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._migrate_sql_container_to_autoscale_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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_migrate_sql_container_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-too-long + 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 autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :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: + """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._migrate_sql_container_to_manual_throughput_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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _sql_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_sql_database_retrieve_throughput_distribution_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL database. Is either a RetrieveThroughputParameters type or a + IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._migrate_sql_container_to_manual_throughput_initial( + raw_result = self._sql_database_retrieve_throughput_distribution_initial( 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, @@ -3665,33 +4974,117 @@ def begin_migrate_sql_container_to_manual_throughput( # pylint: disable=name-to kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ThroughputSettingsGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ThroughputSettingsGetResults]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def list_client_encryption_keys( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.ClientEncryptionKeyGetResults"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. + def _sql_database_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") + + _request = build_sql_database_redistribute_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3700,105 +5093,142 @@ def list_client_encryption_keys( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An iterator like instance of either ClientEncryptionKeyGetResults or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientEncryptionKeysListResult] = kwargs.pop("cls", None) + @overload + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ - def prepare_request(next_link=None): - if not next_link: + @distributed_trace + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL database. - _request = build_list_client_encryption_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Is either a RedistributeThroughputParameters type or a + IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._sql_database_redistribute_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeysListResult", pipeline_response) - list_of_elem = deserialized.value + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **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) - - @distributed_trace - def get_client_encryption_key( + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _sql_container_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + container_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], **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. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_name: Cosmos DB database name. Required. - :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :return: ClientEncryptionKeyGetResults or the result of cls(response) - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3806,54 +5236,231 @@ def get_client_encryption_key( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_get_client_encryption_key_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _json = self._serialize.body(retrieve_throughput_parameters, "RetrieveThroughputParameters") + + _request = build_sql_container_retrieve_throughput_distribution_request( 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, subscription_id=self._config.subscription_id, api_version=api_version, + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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.http_response) + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _create_update_client_encryption_key_initial( # pylint: disable=name-too-long + @overload + def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[ - _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] - ], + container_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Required. + :type retrieve_throughput_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_sql_container_retrieve_throughput_distribution( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + retrieve_throughput_parameters: Union[_models.RetrieveThroughputParameters, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Retrieve throughput distribution for an Azure Cosmos DB SQL container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param retrieve_throughput_parameters: The parameters to provide for retrieving throughput + distribution for the current SQL container. Is either a RetrieveThroughputParameters type or a + IO[bytes] type. Required. + :type retrieve_throughput_parameters: ~azure.mgmt.cosmosdb.models.RetrieveThroughputParameters + or IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._sql_container_retrieve_throughput_distribution_initial( + 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 + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _sql_container_redistribute_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -3871,18 +5478,16 @@ def _create_update_client_encryption_key_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _json = None _content = None - if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _json = self._serialize.body( - create_update_client_encryption_key_parameters, "ClientEncryptionKeyCreateUpdateParameters" - ) + _json = self._serialize.body(redistribute_throughput_parameters, "RedistributeThroughputParameters") - _request = build_create_update_client_encryption_key_request( + _request = build_sql_container_redistribute_throughput_request( 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, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, @@ -3924,19 +5529,18 @@ def _create_update_client_encryption_key_initial( # pylint: disable=name-too-lo return deserialized # type: ignore @overload - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long 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, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **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). + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3945,36 +5549,35 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or + the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], + container_name: str, + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **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). + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -3983,35 +5586,32 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Required. - :type create_update_client_encryption_key_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or + the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: Union[ - _models.ClientEncryptionKeyCreateUpdateParameters, IO[bytes] - ], + container_name: str, + redistribute_throughput_parameters: Union[_models.RedistributeThroughputParameters, IO[bytes]], **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). + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB SQL container. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4020,17 +5620,17 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. - :type client_encryption_key_name: str - :param create_update_client_encryption_key_parameters: The parameters to provide for the client - encryption key. Is either a ClientEncryptionKeyCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ClientEncryptionKeyGetResults or the - result of cls(response) + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Is either a RedistributeThroughputParameters type or + a IO[bytes] type. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.models.RedistributeThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns either PhysicalPartitionThroughputInfoResult or + the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -4038,17 +5638,17 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.PhysicalPartitionThroughputInfoResult] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_update_client_encryption_key_initial( + raw_result = self._sql_container_redistribute_throughput_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, + container_name=container_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -4060,25 +5660,27 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ClientEncryptionKeyGetResults", pipeline_response.http_response) + deserialized = self._deserialize("PhysicalPartitionThroughputInfoResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_token( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ClientEncryptionKeyGetResults]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @@ -4108,7 +5710,7 @@ def list_sql_stored_procedures( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlStoredProcedureListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4199,7 +5801,7 @@ def get_sql_stored_procedure( :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4256,7 +5858,7 @@ def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-lon ], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4499,7 +6101,7 @@ def _delete_sql_stored_procedure_initial( stored_procedure_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4653,7 +6255,7 @@ def list_sql_user_defined_functions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlUserDefinedFunctionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4744,7 +6346,7 @@ def get_sql_user_defined_function( :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -4801,7 +6403,7 @@ def _create_update_sql_user_defined_function_initial( # pylint: disable=name-to ], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5047,7 +6649,7 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long user_defined_function_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5200,7 +6802,7 @@ def list_sql_triggers( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlTriggerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5291,7 +6893,7 @@ def get_sql_trigger( :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5346,7 +6948,7 @@ def _create_update_sql_trigger_initial( create_update_sql_trigger_parameters: Union[_models.SqlTriggerCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5584,7 +7186,7 @@ def _delete_sql_trigger_initial( trigger_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5728,7 +7330,7 @@ def get_sql_role_definition( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5779,7 +7381,7 @@ def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long create_update_sql_role_definition_parameters: Union[_models.SqlRoleDefinitionCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -5985,7 +7587,7 @@ def get_long_running_output(pipeline_response): def _delete_sql_role_definition_initial( self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6113,7 +7715,7 @@ def list_sql_role_definitions( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlRoleDefinitionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6192,7 +7794,7 @@ def get_sql_role_assignment( :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6243,7 +7845,7 @@ def _create_update_sql_role_assignment_initial( # pylint: disable=name-too-long create_update_sql_role_assignment_parameters: Union[_models.SqlRoleAssignmentCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6449,7 +8051,7 @@ def get_long_running_output(pipeline_response): def _delete_sql_role_assignment_initial( self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6577,7 +8179,7 @@ def list_sql_role_assignments( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlRoleAssignmentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -6648,7 +8250,7 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 3f2c40f5ff9e..ce89a5759846 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_tables_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_list_tables_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -85,7 +85,7 @@ def build_get_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +94,7 @@ def build_get_table_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -121,7 +121,7 @@ def build_create_update_table_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_create_update_table_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -159,14 +159,14 @@ def build_delete_table_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) # 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 = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -190,7 +190,7 @@ def build_get_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,7 +199,7 @@ def build_get_table_throughput_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -226,7 +226,7 @@ def build_update_table_throughput_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +236,7 @@ def build_update_table_throughput_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -265,7 +265,7 @@ def build_migrate_table_to_autoscale_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -274,7 +274,7 @@ def build_migrate_table_to_autoscale_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default/migrateToAutoscale", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -301,7 +301,7 @@ def build_migrate_table_to_manual_throughput_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +310,7 @@ def build_migrate_table_to_manual_throughput_request( # pylint: disable=name-to "/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), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -337,7 +337,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-11-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -347,7 +347,7 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/retrieveContinuousBackupInformation", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -370,7 +370,299 @@ def build_retrieve_continuous_backup_information_request( # pylint: disable=nam return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class TableResourcesOperations: +def build_get_table_role_definition_request( + resource_group_name: str, account_name: str, role_definition_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleDefinitions/{roleDefinitionId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_update_table_role_definition_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, role_definition_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleDefinitions/{roleDefinitionId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_table_role_definition_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, role_definition_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleDefinitions/{roleDefinitionId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleDefinitionId": _SERIALIZER.url("role_definition_id", role_definition_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_table_role_definitions_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleDefinitions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_table_role_assignment_request( + resource_group_name: str, account_name: str, role_assignment_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_update_table_role_assignment_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, role_assignment_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_table_role_assignment_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, role_assignment_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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]+)*" + ), + "roleAssignmentId": _SERIALIZER.url("role_assignment_id", role_assignment_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_table_role_assignments_request( # pylint: disable=name-too-long + resource_group_name: str, account_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class TableResourcesOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -410,7 +702,7 @@ def list_tables( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.TableListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +781,7 @@ def get_table( :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +832,7 @@ def _create_update_table_initial( create_update_table_parameters: Union[_models.TableCreateUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -749,7 +1041,7 @@ def get_long_running_output(pipeline_response): def _delete_table_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -880,7 +1172,7 @@ def get_table_throughput( :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -931,7 +1223,7 @@ def _update_table_throughput_initial( update_throughput_parameters: Union[_models.ThroughputSettingsUpdateParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1142,7 +1434,7 @@ def get_long_running_output(pipeline_response): def _migrate_table_to_autoscale_initial( self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1263,7 +1555,7 @@ def get_long_running_output(pipeline_response): def _migrate_table_to_manual_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1389,7 +1681,7 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too location: Union[_models.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1586,3 +1878,965 @@ def get_long_running_output(pipeline_response): return LROPoller[_models.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) + + @distributed_trace + def get_table_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.TableRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Table Role Definition with the given + Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: TableRoleDefinitionResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + + _request = build_get_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TableRoleDefinitionResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_table_role_definition_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: Union[_models.TableRoleDefinitionResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): + _content = create_update_table_role_definition_parameters + else: + _json = self._serialize.body(create_update_table_role_definition_parameters, "TableRoleDefinitionResource") + + _request = build_create_update_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: _models.TableRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_table_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TableRoleDefinitionResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_table_role_definition_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TableRoleDefinitionResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_update_table_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_table_role_definition_parameters: Union[_models.TableRoleDefinitionResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.TableRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_table_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a TableRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_table_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource or IO[bytes] + :return: An instance of LROPoller that returns either TableRoleDefinitionResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_update_table_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + create_update_table_role_definition_parameters=create_update_table_role_definition_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TableRoleDefinitionResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.TableRoleDefinitionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.TableRoleDefinitionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_table_role_definition_initial( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_table_role_definition_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_table_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Table Role Definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_table_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_table_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.TableRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Table Role Definitions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either TableRoleDefinitionResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleDefinitionListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_table_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TableRoleDefinitionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get_table_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.TableRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Table Role Assignment with the given + Id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: TableRoleAssignmentResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) + + _request = build_get_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("TableRoleAssignmentResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_table_role_assignment_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[_models.TableRoleAssignmentResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_table_role_assignment_parameters + else: + _json = self._serialize.body(create_update_table_role_assignment_parameters, "TableRoleAssignmentResource") + + _request = build_create_update_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TableRoleAssignmentResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_table_role_assignment_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TableRoleAssignmentResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[_models.TableRoleAssignmentResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.TableRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_table_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a TableRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource or IO[bytes] + :return: An instance of LROPoller that returns either TableRoleAssignmentResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_update_table_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_table_role_assignment_parameters=create_update_table_role_assignment_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TableRoleAssignmentResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.TableRoleAssignmentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.TableRoleAssignmentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_table_role_assignment_initial( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_table_role_assignment_request( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_table_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Table Role Assignment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_table_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_table_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> Iterable["_models.TableRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Table Role Assignments. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of either TableRoleAssignmentResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.TableRoleAssignmentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_table_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TableRoleAssignmentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_account_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_account_operations.py new file mode 100644 index 000000000000..6488036f4c95 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_account_operations.py @@ -0,0 +1,616 @@ +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", + throughput_pool_account_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", + throughput_pool_account_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", + throughput_pool_account_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ThroughputPoolAccountOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`throughput_pool_account` attribute. + """ + + models = _models + + 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( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> _models.ThroughputPoolAccountResource: + """Retrieves the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :return: ThroughputPoolAccountResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ThroughputPoolAccountResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ThroughputPoolAccountResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _models.ThroughputPoolAccountResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolAccountResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :param body: The parameters to provide for the current ThroughputPoolAccount. Is either a + ThroughputPoolAccountResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource or IO[bytes] + :return: An instance of LROPoller that returns either ThroughputPoolAccountResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolAccountResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputPoolAccountResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputPoolAccountResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Removes an existing Azure Cosmos DB database account from a throughput pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param throughput_pool_account_name: Cosmos DB global database account in a Throughput Pool. + Required. + :type throughput_pool_account_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_accounts_operations.py new file mode 100644 index 000000000000..f2c1849d39ce --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_accounts_operations.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +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( + resource_group_name: str, throughput_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ThroughputPoolAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`throughput_pool_accounts` attribute. + """ + + models = _models + + 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, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ThroughputPoolAccountResource"]: + """Lists all the Azure Cosmos DB accounts available under the subscription. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: An iterator like instance of either ThroughputPoolAccountResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolAccountsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolAccountsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_operations.py new file mode 100644 index 000000000000..2919a1dba435 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pool_operations.py @@ -0,0 +1,795 @@ +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, throughput_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, throughput_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, throughput_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, throughput_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "throughputPoolName": _SERIALIZER.url( + "throughput_pool_name", + throughput_pool_name, + "str", + max_length=50, + min_length=3, + pattern=r"^[a-z0-9]+(-[a-z0-9]+)*", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class ThroughputPoolOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`throughput_pool` attribute. + """ + + models = _models + + 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(self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any) -> _models.ThroughputPoolResource: + """Retrieves the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: ThroughputPoolResource or the result of cls(response) + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ThroughputPoolResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: _models.ThroughputPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current ThroughputPool. Is either a + ThroughputPoolResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource or IO[bytes] + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ThroughputPoolUpdate") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[_models.ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Default value is None. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :param body: The parameters to provide for the current Throughput Pool. Is either a + ThroughputPoolUpdate type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.cosmosdb.models.ThroughputPoolUpdate or IO[bytes] + :return: An instance of LROPoller that returns either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ThroughputPoolResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ThroughputPoolResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ThroughputPoolResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("azure-AsyncOperation") + ) + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Throughput Pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pools_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pools_operations.py new file mode 100644 index 000000000000..63aa00ea6f78 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_throughput_pools_operations.py @@ -0,0 +1,270 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore +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, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/throughputPools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ThroughputPoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`throughput_pools` attribute. + """ + + models = _models + + 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.ThroughputPoolResource"]: + """Lists all the Azure Cosmos DB Throughput Pools available under the subscription. + + :return: An iterator like instance of either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.ThroughputPoolResource"]: + """List all the ThroughputPools in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ThroughputPoolResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ThroughputPoolsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ThroughputPoolsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_enable_disable.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_enable_disable.py new file mode 100644 index 000000000000..4b9ad5f3c2a5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_enable_disable.py @@ -0,0 +1,51 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python chaos_fault_enable_disable.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chaos_fault.begin_enable_disable( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + chaos_fault="ServiceUnavailability", + chaos_fault_request={ + "properties": { + "action": "Enable", + "containerName": "testCollection", + "databaseName": "testDatabase", + "region": "EastUS", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/ChaosFaultEnableDisable.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_get.py new file mode 100644 index 000000000000..b2ba3c278234 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python chaos_fault_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chaos_fault.get( + resource_group_name="rg1", + account_name="ddb1", + chaos_fault="ServiceUnavailability", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/ChaosFaultGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_list.py new file mode 100644 index 000000000000..09e9cd493241 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/chaos_fault_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python chaos_fault_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.chaos_fault.list( + resource_group_name="rg1", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/ChaosFaultList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py index e6dfd7c2f5ff..e7f63c53d3dd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py index 03729a959053..f7b641215cf1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py index 7fa874e02f86..ae19ae4319f8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py index 5368140864ec..282720bfdc52 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py index 6878f9ed72f8..a3302bca5a20 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py index 56374369ddc8..6ab188e0af38 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py index 4286ee7e49b2..ef0191a0ebeb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py index 6e36534c0ca4..e5259bf1cc5e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_keyspace_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraKeyspaceThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py index c9965ca41e7a..2940fb5b2f28 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_create_update.py @@ -40,6 +40,7 @@ def main(): "properties": { "options": {}, "resource": { + "analyticalStorageTtl": 500, "defaultTtl": 100, "id": "tableName", "schema": { @@ -55,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py index d63f8b95107d..41b41fcdcc8b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py index 3766b7a3cae1..a0050dd5ef20 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py index 96d2b18cb6cb..de494ddab4c7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py index f637f5a0afaf..ccd477a80252 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_autoscale.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py index 0df0d3c587c3..7b9e1e8f7c1f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_migrate_to_manual_throughput.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py index dcc10a624658..5799318a611b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py index a55e1fb6b4d8..65b194fe226b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_table_throughput_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCassandraTableThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraTableThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py new file mode 100644 index 000000000000..d87478e65373 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_create_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.begin_create_update_cassandra_view( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + create_update_cassandra_view_parameters={ + "properties": { + "options": {}, + "resource": { + "id": "viewname", + "viewDefinition": "SELECT columna, columnb, columnc FROM keyspacename.srctablename WHERE columna IS NOT NULL AND columnc IS NOT NULL PRIMARY (columnc, columna)", + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewCreateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py new file mode 100644 index 000000000000..6935bcd52d09 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_delete.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.cassandra_resources.begin_delete_cassandra_view( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py new file mode 100644 index 000000000000..ca1686c205c3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_get.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.get_cassandra_view( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py new file mode 100644 index 000000000000..ddc37e59875a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_list.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.list_cassandra_views( + resource_group_name="rgName", + account_name="ddb1", + keyspace_name="keyspacename", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py new file mode 100644 index 000000000000..e3c87ad9db2e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_autoscale.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_migrate_to_autoscale.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.begin_migrate_cassandra_view_to_autoscale( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewMigrateToAutoscale.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py new file mode 100644 index 000000000000..b484f8223aa7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_migrate_to_manual_throughput.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_migrate_to_manual_throughput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.begin_migrate_cassandra_view_to_manual_throughput( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewMigrateToManualThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py new file mode 100644 index 000000000000..cb7df494a3e1 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_get.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_throughput_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.get_cassandra_view_throughput( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewThroughputGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py new file mode 100644 index 000000000000..fe77f93fc2a6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_throughput_update.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_cassandra_view_throughput_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.cassandra_resources.begin_update_cassandra_view_throughput( + resource_group_name="rg1", + account_name="ddb1", + keyspace_name="keyspacename", + view_name="viewname", + update_throughput_parameters={"properties": {"resource": {"throughput": 400}}, "tags": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCassandraViewThroughputUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py index d7b7aa3041a5..1341b54214dc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metric_definitions.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py index d15a6b8071fb..b2e5c7a5f168 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_metrics.py @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py index 19248aeba582..7cd48a511f37 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_get_usages.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py index 5839ae545e4f..18c950fe6957 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_metrics.py @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionPartitionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionPartitionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py index aa4354fb6675..9cd2cd422d5e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_get_usages.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionPartitionGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionPartitionGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py index a56d5304f59a..eb545d5f91aa 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_collection_partition_region_get_metrics.py @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBCollectionPartitionRegionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBCollectionPartitionRegionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py index 5e1c9ab690ed..daef66e6d2da 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDataTransferServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDataTransferServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py index 42134b8b1fa5..00bb3b67dc53 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDataTransferServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDataTransferServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py index d16cdb26da0f..f7fbf41ef6bc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_service_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDataTransferServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDataTransferServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py index 3ca0f18a1a04..81508266e0a5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_check_name_exists.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountCheckNameExists.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountCheckNameExists.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py index 7a39c3c2a36c..d635c8926d87 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_max.py @@ -54,6 +54,7 @@ def main(): "type": "Periodic", }, "capacity": {"totalThroughputLimit": 2000}, + "capacityMode": "Provisioned", "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 10, @@ -63,10 +64,13 @@ def main(): "createMode": "Default", "databaseAccountOfferType": "Standard", "defaultIdentity": "FirstPartyIdentity", + "defaultPriorityLevel": "Low", "enableAnalyticalStorage": True, "enableBurstCapacity": True, "enableFreeTier": False, + "enableMaterializedViews": False, "enablePerRegionPerPartitionAutoscale": True, + "enablePriorityBasedExecution": True, "ipRules": [{"ipAddressOrRange": "23.43.230.120"}, {"ipAddressOrRange": "110.12.240.0/12"}], "isVirtualNetworkFilterEnabled": True, "keyVaultKeyUri": "https://myKeyVault.vault.azure.net", @@ -93,6 +97,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountCreateMax.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountCreateMax.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py index 6c0fd5f57481..e38b9b988bdc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_create_min.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountCreateMin.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountCreateMin.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py index 7c7c61efa36b..0862f09ffccd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py index c6c266fa2d4f..feb7653bfa7e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_failover_priority_change.py @@ -42,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountFailoverPriorityChange.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py index 6b37823fc5d6..88fb88dea3d1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py index 918fa68e84e8..1dcd5a3dc3fd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metric_definitions.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py index 58f97505d9f5..cb3672b2988d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_metrics.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py index 9ddf3c760fe1..b6140eb96eeb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_get_usages.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py index 2df3a49e4fda..85a742beada6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py index 7427a6272e6b..392d084fc51e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountListByResourceGroup.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py index b669f4d868c5..82ee2dcb8821 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountListConnectionStrings.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py index 9f3ad0c79aee..7d54d21687ba 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_connection_strings_mongo.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py index 4bf0f05387f0..c6bb75fd8253 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_keys.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountListKeys.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountListKeys.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py index 6d49c8996e59..6768d2d3810f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys.py @@ -30,13 +30,13 @@ def main(): subscription_id="subid", ) - response = client.database_accounts.get_read_only_keys( + response = client.database_accounts.list_read_only_keys( resource_group_name="rg1", account_name="ddb1", ) print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountListReadOnlyKeys.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py index 7218a99914ec..bd30f69c78de 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_offline_region.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountOfflineRegion.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountOfflineRegion.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py index bcde503fcbb3..97ce62546383 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_online_region.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountOnlineRegion.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountOnlineRegion.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py index c631cdce46f7..0962fdfd3222 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_patch.py @@ -47,22 +47,26 @@ def main(): "periodicModeProperties": { "backupIntervalInMinutes": 240, "backupRetentionIntervalInHours": 720, - "backupStorageRedundancy": "Local", + "backupStorageRedundancy": "Geo", }, "type": "Periodic", }, "capacity": {"totalThroughputLimit": 2000}, + "capacityMode": "Provisioned", "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 10, "maxStalenessPrefix": 200, }, "defaultIdentity": "FirstPartyIdentity", + "defaultPriorityLevel": "Low", + "diagnosticLogSettings": {"enableFullTextQuery": "True"}, "enableAnalyticalStorage": True, "enableBurstCapacity": True, "enableFreeTier": False, "enablePartitionMerge": True, "enablePerRegionPerPartitionAutoscale": True, + "enablePriorityBasedExecution": True, "ipRules": [{"ipAddressOrRange": "23.43.230.120"}, {"ipAddressOrRange": "110.12.240.0/12"}], "isVirtualNetworkFilterEnabled": True, "minimalTlsVersion": "Tls", @@ -83,6 +87,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py index c94a7339d944..6ab676945256 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_regenerate_key.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountRegenerateKey.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py index 8298be4ba2a8..118be9911789 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_region_get_metrics.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseAccountRegionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseAccountRegionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py index 8c03092fdbd4..23794fad4d0b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metric_definitions.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseGetMetricDefinitions.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseGetMetricDefinitions.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py index 78a70e43f68f..1c49fae868c8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_metrics.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py index 60c922653395..cb12d33c0aed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_get_usages.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBDatabaseGetUsages.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBDatabaseGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py index 7d0abdfbeaca..7c4e6337176c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGraphAPIComputeServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphAPIComputeServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py index 0b6d60a517b5..d3946a977e52 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGraphAPIComputeServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphAPIComputeServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py index ed3e38cbb2a6..0a98ba117778 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_api_compute_service_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGraphAPIComputeServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphAPIComputeServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_create_update.py new file mode 100644 index 000000000000..694d2ac43c6f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_create_update.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_graph_resource_create_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.graph_resources.begin_create_update_graph( + resource_group_name="rg1", + account_name="ddb1", + graph_name="graphName", + create_update_graph_parameters={ + "location": "West US", + "properties": {"options": {}, "resource": {"id": "graphName"}}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphResourceCreateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_delete.py new file mode 100644 index 000000000000..6386693bc541 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_delete.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_graph_resource_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.graph_resources.begin_delete_graph_resource( + resource_group_name="rg1", + account_name="ddb1", + graph_name="graphName", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphResourceDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_get.py new file mode 100644 index 000000000000..2cacfa42ec0b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_graph_resource_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.graph_resources.get_graph( + resource_group_name="rg1", + account_name="ddb1", + graph_name="graphName", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphResourceGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_list.py new file mode 100644 index 000000000000..5e9fb9c203d0 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_graph_resource_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_graph_resource_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.graph_resources.list_graphs( + resource_group_name="rgName", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGraphResourceList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py index 9f283c19f19c..d8f89568f7de 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py index c2698f2b87d7..621dd35634bc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py index d79fac01fa06..dc39fa9036b7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py index 2293e69cf344..e31419ea246e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py index c76714a06f4d..ea3072c8a45b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py index 96d130a78264..ebb5456e91e1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py index 25590f927210..3355dc5fe871 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py index df18868a623d..24342294e620 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_database_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py index 099af6b0689d..95476c06adf8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_backup_information.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py index d16373c68da1..f08c90e0669e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_create_update.py @@ -67,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py index 3e60a9d0efa6..30476d68033a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py index 4b054650c213..06836ba23a76 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py index 88f340af36e2..f007d2dbe957 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py index 5250f4a53f2a..8899375c50d3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_autoscale.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py index 6c47ad20805d..2df49be0e688 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_migrate_to_manual_throughput.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py index 47c90f55d0ca..c7dac17318d8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py index 44aac77ceb0e..16f646ce503d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_graph_throughput_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBGremlinGraphThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBGremlinGraphThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py index a564b0bdf3f7..e7a9e245f5ea 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBLocationGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py index 21293ebe05e2..d9caeab6577c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_location_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBLocationList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBLocationList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py new file mode 100644 index 000000000000..93747a09d8e7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backup.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_managed_cassandra_backup.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cassandra_clusters.get_backup( + resource_group_name="cassandra-prod-rg", + cluster_name="cassandra-prod", + backup_id="1611250348", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraBackup.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py new file mode 100644 index 000000000000..bba9f3eebfa4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_backups_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_managed_cassandra_backups_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cassandra_clusters.list_backups( + resource_group_name="cassandra-prod-rg", + cluster_name="cassandra-prod", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraBackupsList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py index a093657ded1c..9771e89620b4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_create.py @@ -27,7 +27,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.begin_create_update( @@ -60,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py index 930c84ce5a27..f941b3d3db4a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_deallocate.py @@ -27,7 +27,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.cassandra_clusters.begin_deallocate( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterDeallocate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterDeallocate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py index 97300164bd04..7c7cda2015e0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py index e8b7274c8d49..07699af51ecb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py index 853cb2b64827..04f16373d5b9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py index 4d2c7316f23e..a1c771618a60 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterListBySubscription.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py index 15d0bd3f83f3..dddfaf32551d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_patch.py @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py index 958f10cfe602..135e7f663f8d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_cluster_start.py @@ -27,7 +27,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + subscription_id="00000000-0000-0000-0000-000000000000", ) client.cassandra_clusters.begin_start( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraClusterStart.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraClusterStart.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py index 2450ea697b17..d3602d282cc7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command.py @@ -27,17 +27,17 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.begin_invoke_command( resource_group_name="cassandra-prod-rg", cluster_name="cassandra-prod", - body={"command": "nodetool status", "host": "10.0.1.12"}, + body={"arguments": {"status": ""}, "command": "nodetool", "host": "10.0.1.12"}, ).result() print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraCommand.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraCommand.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_async.py new file mode 100644 index 000000000000..bf4e7ec735a3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_async.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_managed_cassandra_command_async.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cassandra_clusters.begin_invoke_command_async( + resource_group_name="cassandra-prod-rg", + cluster_name="cassandra-prod", + body={"arguments": {"status": ""}, "command": "nodetool", "host": "10.0.1.12"}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraCommandAsync.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_result.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_result.py new file mode 100644 index 000000000000..9063fc72ae95 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_command_result.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_managed_cassandra_command_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cassandra_clusters.get_command_async( + resource_group_name="cassandra-prod-rg", + cluster_name="cassandra-prod", + command_id="318653d0-3da5-4814-b8f6-429f2af0b2a4", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraCommandResult.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py index 03a1342f89e7..8db47bd307b8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraDataCenterCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraDataCenterCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py index a09453311e90..9f1db99955e1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraDataCenterDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraDataCenterDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py index 8469a43bca84..089a235a9c43 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraDataCenterGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraDataCenterGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py index 5095926c9fad..ed3c309260f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraDataCenterList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraDataCenterList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py index 2ad973d6f4b7..41f5c3fb4800 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_data_center_patch.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraDataCenterPatch.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraDataCenterPatch.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_list_command.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_list_command.py new file mode 100644 index 000000000000..eeae7b9a910f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_list_command.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_managed_cassandra_list_command.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cassandra_clusters.list_command( + resource_group_name="cassandra-prod-rg", + cluster_name="cassandra-prod", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraListCommand.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py index 6c6c7ed4760d..fbbccac518a2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_managed_cassandra_status.py @@ -27,7 +27,7 @@ def main(): client = CosmosDBManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + subscription_id="00000000-0000-0000-0000-000000000000", ) response = client.cassandra_clusters.status( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBManagedCassandraStatus.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBManagedCassandraStatus.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py index 9b464a716869..cde713b49dcd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_create.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMaterializedViewsBuilderServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py index 3f74e7036e5d..9a0fb9fdfc50 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMaterializedViewsBuilderServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py index 1da932f1505f..e2f98feb0860 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_materialized_views_builder_service_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMaterializedViewsBuilderServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMaterializedViewsBuilderServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py index d7a395bc6f28..cfc86e7a32fc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_backup_information.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py index b0b47e971976..58f5ad515575 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py index 2473601909c4..1fd0d1fc2c66 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py index b881da8df86b..765e26ea5b05 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py index b43853050153..de1c81c976ee 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_autoscale.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py index ad96dbfb4b08..e4982b7cb381 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_migrate_to_manual_throughput.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py new file mode 100644 index 000000000000..a7c716375600 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_partition_merge.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_collection_partition_merge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_list_mongo_db_collection_partition_merge( + resource_group_name="rgName", + account_name="ddb1", + database_name="databaseName", + collection_name="collectionName", + merge_parameters={"isDryRun": False}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionPartitionMerge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py new file mode 100644 index 000000000000..b4243369d673 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_redistribute_throughput.py @@ -0,0 +1,56 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_collection_redistribute_throughput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_mongo_db_container_redistribute_throughput( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + collection_name="collectionName", + redistribute_throughput_parameters={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "0", "throughput": 5000}, + {"id": "1", "throughput": 5000}, + ], + "throughputPolicy": "custom", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py new file mode 100644 index 000000000000..204d54288cc7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_collection_retrieve_throughput_distribution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_mongo_db_container_retrieve_throughput_distribution( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + collection_name="collectionName", + retrieve_throughput_parameters={ + "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionRetrieveThroughputDistribution.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py index 66ccadb8a9f8..c6a925b23145 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py index e5b01728014c..32e8ce7c4e4b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_throughput_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBCollectionThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBCollectionThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py index 795d56fde772..de407301e9be 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py index c42c48319082..550c6cb5be43 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py index c43611480eec..c47fc0ef71be 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py index c9c6825ca13c..e85e18efe1ec 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py index 621982d8359c..3c656878fbbd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_partition_merge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_partition_merge.py new file mode 100644 index 000000000000..1bc8ae587bec --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_partition_merge.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_database_partition_merge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_mongo_db_database_partition_merge( + resource_group_name="rgName", + account_name="ddb1", + database_name="databaseName", + merge_parameters={"isDryRun": False}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabasePartitionMerge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py new file mode 100644 index 000000000000..f8a99354b189 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_redistribute_throughput.py @@ -0,0 +1,55 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_database_redistribute_throughput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_mongo_db_database_redistribute_throughput( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + redistribute_throughput_parameters={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "0", "throughput": 5000}, + {"id": "1", "throughput": 5000}, + ], + "throughputPolicy": "custom", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py new file mode 100644 index 000000000000..95527de542bc --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_retrieve_throughput_distribution.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_mongo_db_database_retrieve_throughput_distribution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.mongo_db_resources.begin_mongo_db_database_retrieve_throughput_distribution( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + retrieve_throughput_parameters={ + "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseRetrieveThroughputDistribution.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py index 2dde45ba0509..1a591f6311b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py index 7875cb7c01e7..57e980b816bf 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py index c6cf08544014..d349151a77c0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_create_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py index 4a806e9541df..72df42dbc5df 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBRoleDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py index a41aa725f6f2..1a675bb6e6f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBRoleDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py index 06cca352b290..193cae2fac18 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBRoleDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBRoleDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py index 432a58e88f61..cb652436ac2c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_create_update.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBUserDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py index 654d869b9ece..d5349ef86122 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBUserDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBUserDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py index 47b233af1a91..2c678f3fa5a4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBUserDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBUserDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py index 8afdcf082269..117d025ba3e3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_user_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBMongoDBUserDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBMongoDBUserDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py index 5761fbfc1d82..d668b21afa5d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py index 85f878d4dec2..768e33684182 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py index a9b1addb8326..406775ab117b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py index 0e0641bcb4e4..513c4160c866 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_list_connection_info.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py index fa24401017d2..309502baa6bc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_regenerate_auth_token.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py index 7c0bb9453ca9..2a14f5c8c886 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_start.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBNotebookWorkspaceStart.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBNotebookWorkspaceStart.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py index 97e065dfd7dc..2c326f145408 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBOperationsList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBOperationsList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py index 8db72d6ea5f6..762b2ed2ea9c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_get_metrics.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPercentileGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPercentileGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py index 7dba75a72b27..f6d8f3e60da0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_source_target_get_metrics.py @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPercentileSourceTargetGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPercentileSourceTargetGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py index 7e218af6b04e..f4379ba6d740 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_percentile_target_get_metrics.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPercentileTargetGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPercentileTargetGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py index 45370205c7d4..ab17ada1731f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateEndpointConnectionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py index 2a80f6462a0a..bb34a31c9c2b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateEndpointConnectionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py index 5d6254a91f13..8b5cac98eef6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_list_get.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateEndpointConnectionListGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateEndpointConnectionListGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py index a0d4ec5bb7f2..cf796105aba5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_endpoint_connection_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateEndpointConnectionUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateEndpointConnectionUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py index b68932b437ab..8e0e2e6591b4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateLinkResourceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateLinkResourceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py index 11ea0b004700..0b951204851a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_private_link_resource_list_get.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPrivateLinkResourceListGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPrivateLinkResourceListGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py index f8da6d195b2c..f52afa08bb79 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_region_collection_get_metrics.py @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRegionCollectionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRegionCollectionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py index e1a27b5ef54c..e52bb182cf55 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableDatabaseAccountGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableDatabaseAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py index f68e15a24052..ffae60673c3c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableDatabaseAccountList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableDatabaseAccountList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py index db024bd07355..f82893416f57 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_database_account_no_location_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableDatabaseAccountNoLocationList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py index 2be31618da52..d13a8b43c052 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableGremlinDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableGremlinDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py index aa6c269834a6..32153ec98c64 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_graph_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableGremlinGraphList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableGremlinGraphList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py index 41356d433473..f475a6462ebd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_gremlin_resource_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableGremlinResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableGremlinResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py index 41fa6db63ca0..854b41b03733 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_collection_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbCollectionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableMongodbCollectionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py index e174656bc863..0807abd047fd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableMongodbDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py index 56c11d475561..ceee6f435fb9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_mongodb_resource_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableMongodbResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableMongodbResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py index 8522f58e6732..03071c7e4b85 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_container_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableSqlContainerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableSqlContainerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py index 32b9b15afb2f..a0f4a18974f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableSqlDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableSqlDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py index d80af15b065c..6a912b3b6809 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_sql_resource_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableSqlResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableSqlResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py index c74ea017cc4d..bf12bc6ffb38 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py index 2021959e163a..69526d6028c8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restorable_table_resource_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestorableTableResourceList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestorableTableResourceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py index ecbd5eac5bb2..f65f27b5ecab 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_restore_database_account_create_update.py @@ -48,6 +48,7 @@ def main(): "databaseAccountOfferType": "Standard", "enableAnalyticalStorage": True, "enableFreeTier": False, + "enableMaterializedViews": False, "keyVaultKeyUri": "https://myKeyVault.vault.azure.net", "locations": [{"failoverPriority": 0, "isZoneRedundant": False, "locationName": "southcentralus"}], "minimalTlsVersion": "Tls", @@ -60,6 +61,7 @@ def main(): "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc", "restoreTimestampInUtc": "2021-03-11T22:05:09Z", "restoreWithTtlDisabled": False, + "sourceBackupLocation": "westus", }, }, "tags": {}, @@ -68,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBRestoreDatabaseAccountCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py index ba081c1a2a97..a018af7039ff 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_services_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBServicesList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBServicesList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py index 4b37010d6995..1f51fcccf3c9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_create_update.py @@ -46,7 +46,7 @@ def main(): "type": "AzureKeyVault", "value": "AzureKeyVault Key URL", }, - "wrappedDataEncryptionKey": "U3dhZ2dlciByb2Nrcw==", + "wrappedDataEncryptionKey": "VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU=", } } }, @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlClientEncryptionKeyCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py index 4d1d151e7b74..60606805fdf8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_key_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlClientEncryptionKeyGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlClientEncryptionKeyGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py index 538d8e60cdbd..c0c460b99d99 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_client_encryption_keys_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlClientEncryptionKeysList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlClientEncryptionKeysList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py index 731cb270b558..fd7c354eb882 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_backup_information.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py index 1fe38e15824a..7f8b179956ed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_create_update.py @@ -106,6 +106,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py index 5dc4ef80bcfc..072592bfe19d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py index e24d550a4b00..7b6303457bee 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py index 66343b556226..4d326508a2bc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py index 408e679f6850..59e5a9a7ae55 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_autoscale.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py index 9768c3f11b34..c8591e7ab507 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_migrate_to_manual_throughput.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py new file mode 100644 index 000000000000..c28a8125033e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_partition_merge.py @@ -0,0 +1,45 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_container_partition_merge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_list_sql_container_partition_merge( + resource_group_name="rgName", + account_name="ddb1", + database_name="databaseName", + container_name="containerName", + merge_parameters={"isDryRun": False}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerPartitionMerge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py new file mode 100644 index 000000000000..5839e26749bd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_redistribute_throughput.py @@ -0,0 +1,56 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_container_redistribute_throughput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_sql_container_redistribute_throughput( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + container_name="containerName", + redistribute_throughput_parameters={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "0", "throughput": 5000}, + {"id": "1", "throughput": 5000}, + ], + "throughputPolicy": "custom", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py new file mode 100644 index 000000000000..dc7d3c6060bf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py @@ -0,0 +1,60 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_container_restore.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_create_update_sql_container( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + container_name="containerName", + create_update_sql_container_parameters={ + "location": "West US", + "properties": { + "options": {}, + "resource": { + "createMode": "Restore", + "id": "containerName", + "restoreParameters": { + "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": True, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py new file mode 100644 index 000000000000..fae8dbc6d8b9 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_retrieve_throughput_distribution.py @@ -0,0 +1,47 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_container_retrieve_throughput_distribution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_sql_container_retrieve_throughput_distribution( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + container_name="containerName", + retrieve_throughput_parameters={ + "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerRetrieveThroughputDistribution.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py index aaab187c6a56..8062c7ce3a1f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py index 53044473def4..050f04f8b73b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_throughput_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlContainerThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlContainerThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py index e2ee6118b612..82e5047e5127 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py index b56a73310ed9..2dc66cda0858 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py index 93b1712974c2..e0c1cf72fae2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py index 7e993df9d70e..b01a490ca821 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py index 2830c1a09640..b4710f1a2b0a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py index ad69ed9ee607..b4c4e019d49d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_partition_merge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_partition_merge.py new file mode 100644 index 000000000000..f76ff97402bb --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_partition_merge.py @@ -0,0 +1,44 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_database_partition_merge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_sql_database_partition_merge( + resource_group_name="rgName", + account_name="ddb1", + database_name="databaseName", + merge_parameters={"isDryRun": False}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabasePartitionMerge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py new file mode 100644 index 000000000000..0a85f610a795 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_redistribute_throughput.py @@ -0,0 +1,55 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_database_redistribute_throughput.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_sql_database_redistribute_throughput( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + redistribute_throughput_parameters={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "2", "throughput": 5000}, {"id": "3"}], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "0", "throughput": 5000}, + {"id": "1", "throughput": 5000}, + ], + "throughputPolicy": "custom", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py new file mode 100644 index 000000000000..e1d8ee3ca826 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py @@ -0,0 +1,59 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_database_restore.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_create_update_sql_database( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + create_update_sql_database_parameters={ + "location": "West US", + "properties": { + "options": {}, + "resource": { + "createMode": "Restore", + "id": "databaseName", + "restoreParameters": { + "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": True, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py new file mode 100644 index 000000000000..cf1f9d55f014 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_retrieve_throughput_distribution.py @@ -0,0 +1,46 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_database_retrieve_throughput_distribution.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_sql_database_retrieve_throughput_distribution( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + retrieve_throughput_parameters={ + "properties": {"resource": {"physicalPartitionIds": [{"id": "0"}, {"id": "1"}]}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseRetrieveThroughputDistribution.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py index a529ed26bf06..41bd2fdbfd7a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py index e0f3a1d79a27..016074eb5c1d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlDatabaseThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_materialized_view_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_materialized_view_create_update.py new file mode 100644 index 000000000000..311e29181cf5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_materialized_view_create_update.py @@ -0,0 +1,73 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_sql_materialized_view_create_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.sql_resources.begin_create_update_sql_container( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + container_name="mvContainerName", + create_update_sql_container_parameters={ + "location": "West US", + "properties": { + "options": {}, + "resource": { + "id": "mvContainerName", + "indexingPolicy": { + "automatic": True, + "excludedPaths": [], + "includedPaths": [ + { + "indexes": [ + {"dataType": "String", "kind": "Range", "precision": -1}, + {"dataType": "Number", "kind": "Range", "precision": -1}, + ], + "path": "/*", + } + ], + "indexingMode": "consistent", + }, + "materializedViewDefinition": { + "definition": "select * from ROOT", + "sourceCollectionId": "sourceContainerName", + }, + "partitionKey": {"kind": "Hash", "paths": ["/mvpk"]}, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlMaterializedViewCreateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py index fc67f17a7708..2d0fa05dd251 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_create_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py index 271f3c35612c..5b66bd44410e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleAssignmentDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py index 603acdfa04fe..45174d66b681 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleAssignmentGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py index da61f9455563..c096498bfa8f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_assignment_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleAssignmentList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py index 6eff1f619bbb..e88283d5c382 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_create_update.py @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py index 37d17e2dd96b..97bb02f3f631 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleDefinitionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py index 1d5a33f34de3..7fac7289ef0c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleDefinitionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py index 2e1a7693d3d1..6c88173615a6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlRoleDefinitionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlRoleDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py index b19af635bb67..606f3b6b6037 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlStoredProcedureCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlStoredProcedureCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py index 0d99777c9f55..b7bb11e9e77d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlStoredProcedureDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlStoredProcedureDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py index 4ff024c4dd52..732b819bedf6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlStoredProcedureGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlStoredProcedureGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py index 8b06695dfb8c..2fb3ee58ef4d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_stored_procedure_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlStoredProcedureList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlStoredProcedureList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py index 9b4226afba0a..589d6e49bc55 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_create_update.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlTriggerCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlTriggerCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py index d4f5a1669c87..f7786f5798c6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlTriggerDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlTriggerDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py index 37319ad7bc66..521ad8878335 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlTriggerGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlTriggerGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py index 154288961b61..89921fe0ad9f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_trigger_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlTriggerList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlTriggerList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py index 338e991572a6..c025dedab3e7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlUserDefinedFunctionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py index 31e53eaa6edb..9158cb1f15b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_delete.py @@ -39,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlUserDefinedFunctionDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlUserDefinedFunctionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py index a71cef9b1918..19d76fef6cbd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_get.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlUserDefinedFunctionGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlUserDefinedFunctionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py index 3a8f6bb80161..5194d874c8d7 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_user_defined_function_list.py @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBSqlUserDefinedFunctionList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBSqlUserDefinedFunctionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py index eff1864af543..57fb4cbd69c5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_backup_information.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableBackupInformation.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py index 3d11430228e8..d56c657ae9e0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableCreateUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py index c7f24055f705..4169841cfaed 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py index b1d00c7b3fe7..214ac243dada 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py index 98adb679ab7c..d3c246294b93 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableList.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py index 97b4abc85a3a..892577e2703c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_autoscale.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableMigrateToAutoscale.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableMigrateToAutoscale.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py index 6571ddaa2bdc..7edb5de2ebbf 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_migrate_to_manual_throughput.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableMigrateToManualThroughput.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py index 072decdd7b8f..f9b7a544491c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableThroughputGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableThroughputGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py index b896542d4362..2c7be791cd31 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_throughput_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBTableThroughputUpdate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBTableThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py index 2adf8987466a..c1f3b1aeee21 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_get_metrics.py @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPKeyRangeIdGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPKeyRangeIdGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py index 0ef22666dcca..c9f1aa263116 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_dbp_key_range_id_region_get_metrics.py @@ -43,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/CosmosDBPKeyRangeIdRegionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_cancel.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_cancel.py new file mode 100644 index 000000000000..22195757d60e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_cancel.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_cancel.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.cancel( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobCancel.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_complete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_complete.py new file mode 100644 index 000000000000..1b136b45cbf9 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_complete.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_complete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="e35cc6eb-c8e3-447b-8de6-b83328cd0098", + ) + + response = client.data_transfer_jobs.complete( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobComplete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_create.py new file mode 100644 index 000000000000..8fc2debe67b9 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_create.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.create( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + job_create_parameters={ + "properties": { + "destination": { + "component": "AzureBlobStorage", + "containerName": "blob_container", + "endpointUrl": "https://blob.windows.net", + }, + "source": {"component": "CosmosDBCassandra", "keyspaceName": "keyspace", "tableName": "table"}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_feed.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_feed.py new file mode 100644 index 000000000000..9cf43ff90542 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_feed.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_feed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.list_by_database_account( + resource_group_name="rg1", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobFeed.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_get.py new file mode 100644 index 000000000000..98dd58066362 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.get( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_pause.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_pause.py new file mode 100644 index 000000000000..2e0b02952ef8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_pause.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_pause.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.pause( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobPause.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_resume.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_resume.py new file mode 100644 index 000000000000..587bccc8a438 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/datatransferservice/cosmos_db_data_transfer_job_resume.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_data_transfer_job_resume.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.data_transfer_jobs.resume( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/data-transfer-service/CosmosDBDataTransferJobResume.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_get.py new file mode 100644 index 000000000000..e02d8b70e736 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python network_security_perimeter_configuration_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.network_security_perimeter_configurations.get( + resource_group_name="res4410", + account_name="cosmosTest", + network_security_perimeter_configuration_name="dbedb4e0-40e6-4145-81f3-f1314c150774.resourceAssociation1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/NetworkSecurityPerimeterConfigurationGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_list.py new file mode 100644 index 000000000000..0621027f3c5e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python network_security_perimeter_configuration_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.network_security_perimeter_configurations.list( + resource_group_name="res4410", + account_name="cosmosTest", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/NetworkSecurityPerimeterConfigurationList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_reconcile.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_reconcile.py new file mode 100644 index 000000000000..380962a01164 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/network_security_perimeter_configuration_reconcile.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python network_security_perimeter_configuration_reconcile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.network_security_perimeter_configurations.begin_reconcile( + resource_group_name="res4410", + account_name="sto8607", + network_security_perimeter_configuration_name="dbedb4e0-40e6-4145-81f3-f1314c150774.resourceAssociation1", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/NetworkSecurityPerimeterConfigurationReconcile.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_create.py index 2f9752511f3c..f4f3f8f0aed9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceCreate.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_delete.py index f33aba441c6e..0405976d644a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceDelete.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_get.py index 1252e0a98db3..5bc2dc62ff76 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/services/sqldedicatedgateway/cosmos_db_sql_dedicated_gateway_service_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-11-15/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceGet.json +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_create_update.py new file mode 100644 index 000000000000..86b8bcc50e7c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_create_update.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_assignment_create_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.begin_create_update_table_role_assignment( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_assignment_id="myRoleAssignmentId", + create_update_table_role_assignment_parameters={ + "properties": { + "principalId": "myPrincipalId", + "roleDefinitionId": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/tableRoleDefinitions/myRoleDefinitionId", + "scope": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleAssignmentCreateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_delete.py new file mode 100644 index 000000000000..548b5e011dde --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_delete.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_assignment_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.table_resources.begin_delete_table_role_assignment( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_assignment_id="myRoleAssignmentId", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleAssignmentDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_get.py new file mode 100644 index 000000000000..af381fc3ba14 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_assignment_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.get_table_role_assignment( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_assignment_id="myRoleAssignmentId", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleAssignmentGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_list.py new file mode 100644 index 000000000000..4a7a4425a9a4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_assignment_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_assignment_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.list_table_role_assignments( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleAssignmentList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_create_update.py new file mode 100644 index 000000000000..7e18a273ed5e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_create_update.py @@ -0,0 +1,62 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_definition_create_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.begin_create_update_table_role_definition( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_definition_id="myRoleDefinitionId", + create_update_table_role_definition_parameters={ + "properties": { + "assignableScopes": [ + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases", + ], + "permissions": [ + { + "dataActions": [ + "Microsoft.DocumentDB/databaseAccounts/tableDatabases/containers/entities/create", + "Microsoft.DocumentDB/databaseAccounts/tableDatabases/containers/entities/read", + ], + "notDataActions": [], + } + ], + "roleName": "myRoleName", + "type": "CustomRole", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleDefinitionCreateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_delete.py new file mode 100644 index 000000000000..55bd7cf925bf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_delete.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_definition_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.table_resources.begin_delete_table_role_definition( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_definition_id="myRoleDefinitionId", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleDefinitionDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_get.py new file mode 100644 index 000000000000..a0b942da09c7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_definition_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.get_table_role_definition( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + role_definition_id="myRoleDefinitionId", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleDefinitionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_list.py new file mode 100644 index 000000000000..94602ee6e72f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/tablerbac/cosmos_db_table_role_definition_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_table_role_definition_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.table_resources.list_table_role_definitions( + resource_group_name="myResourceGroupName", + account_name="myAccountName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/tablerbac/CosmosDBTableRoleDefinitionList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_create.py new file mode 100644 index 000000000000..2034a31ed5f6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_create.py @@ -0,0 +1,49 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_account_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool_account.begin_create( + resource_group_name="rg1", + throughput_pool_name="tp1", + throughput_pool_account_name="db1", + body={ + "properties": { + "accountLocation": "West US", + "accountResourceIdentifier": "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/providers/Microsoft.DocumentDB/resourceGroup/rg1/databaseAccounts/db1/", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolAccountCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_delete.py new file mode 100644 index 000000000000..0d52497dca0e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_delete.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_account_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.throughput_pool_account.begin_delete( + resource_group_name="rgName", + throughput_pool_name="tp1", + throughput_pool_account_name="db1", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolAccountDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_get.py new file mode 100644 index 000000000000..08ef11a49a93 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_account_get.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_account_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool_account.get( + resource_group_name="rgName", + throughput_pool_name="tp1", + throughput_pool_account_name="db1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolAccountGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_accounts_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_accounts_list.py new file mode 100644 index 000000000000..3776e3805b27 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_accounts_list.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_accounts_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool_accounts.list( + resource_group_name="rgName", + throughput_pool_name="tp1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolAccountsList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_create.py new file mode 100644 index 000000000000..81e562ea622e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_create.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool.begin_create_or_update( + resource_group_name="rg1", + throughput_pool_name="tp1", + body={"location": "westus2", "properties": {"maxThroughput": 10000}, "tags": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_delete.py new file mode 100644 index 000000000000..a70b3fe2feef --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_delete.py @@ -0,0 +1,41 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + client.throughput_pool.begin_delete( + resource_group_name="rgName", + throughput_pool_name="tp1", + ).result() + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_get.py new file mode 100644 index 000000000000..76d676bc6243 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_get.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool.get( + resource_group_name="rgName", + throughput_pool_name="tp1", + ) + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_list.py new file mode 100644 index 000000000000..39ae1ec3d9f7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_list.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pools.list_by_resource_group( + resource_group_name="rgName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_update.py new file mode 100644 index 000000000000..639bb62cce05 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/throughput_pool/cosmos_db_throughput_pool_update.py @@ -0,0 +1,42 @@ +# 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 azure.identity import DefaultAzureCredential + +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-cosmosdb +# USAGE + python cosmos_db_throughput_pool_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CosmosDBManagementClient( + credential=DefaultAzureCredential(), + subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff", + ) + + response = client.throughput_pool.begin_update( + resource_group_name="rg1", + throughput_pool_name="tp1", + ).result() + print(response) + + +# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/preview/2024-12-01-preview/examples/throughputPool/CosmosDBThroughputPoolUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/conftest.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/conftest.py index c6d1ee70d05f..e7cc55656fbc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/conftest.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): cosmosdbmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations.py index 9577a7745fd8..abfdc2a0c2c6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_subscription(self, resource_group): + def test_cassandra_clusters_list_by_subscription(self, resource_group): response = self.client.cassandra_clusters.list_by_subscription( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_cassandra_clusters_list_by_resource_group(self, resource_group): response = self.client.cassandra_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,11 +41,11 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_cassandra_clusters_get(self, resource_group): response = self.client.cassandra_clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -53,11 +53,11 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_cassandra_clusters_begin_delete(self, resource_group): response = self.client.cassandra_clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update(self, resource_group): + def test_cassandra_clusters_begin_create_update(self, resource_group): response = self.client.cassandra_clusters.begin_create_update( resource_group_name=resource_group.name, cluster_name="str", @@ -76,13 +76,18 @@ def test_begin_create_update(self, resource_group): "name": "str", "properties": { "authenticationMethod": "str", + "autoReplicate": "str", "azureConnectionMethod": "str", + "backupSchedules": [{"cronExpression": "str", "retentionInHours": 0, "scheduleName": "str"}], "cassandraAuditLoggingEnabled": bool, "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", + "extensions": ["str"], + "externalDataCenters": ["str"], "externalGossipCertificates": [{"pem": "str"}], "externalSeedNodes": [{"ipAddress": "str"}], "gossipCertificates": [{"pem": "str"}], @@ -94,12 +99,13 @@ def test_begin_create_update(self, resource_group): "provisioningState": "str", "repairEnabled": bool, "restoreFromBackupId": "str", + "scheduledEventStrategy": "str", "seedNodes": [{"ipAddress": "str"}], }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -107,7 +113,7 @@ def test_begin_create_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_cassandra_clusters_begin_update(self, resource_group): response = self.client.cassandra_clusters.begin_update( resource_group_name=resource_group.name, cluster_name="str", @@ -118,13 +124,18 @@ def test_begin_update(self, resource_group): "name": "str", "properties": { "authenticationMethod": "str", + "autoReplicate": "str", "azureConnectionMethod": "str", + "backupSchedules": [{"cronExpression": "str", "retentionInHours": 0, "scheduleName": "str"}], "cassandraAuditLoggingEnabled": bool, "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", + "extensions": ["str"], + "externalDataCenters": ["str"], "externalGossipCertificates": [{"pem": "str"}], "externalSeedNodes": [{"ipAddress": "str"}], "gossipCertificates": [{"pem": "str"}], @@ -136,12 +147,13 @@ def test_begin_update(self, resource_group): "provisioningState": "str", "repairEnabled": bool, "restoreFromBackupId": "str", + "scheduledEventStrategy": "str", "seedNodes": [{"ipAddress": "str"}], }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -149,7 +161,7 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_invoke_command(self, resource_group): + def test_cassandra_clusters_begin_invoke_command(self, resource_group): response = self.client.cassandra_clusters.begin_invoke_command( resource_group_name=resource_group.name, cluster_name="str", @@ -160,7 +172,7 @@ def test_begin_invoke_command(self, resource_group): "cassandra-stop-start": bool, "readwrite": bool, }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -168,11 +180,74 @@ def test_begin_invoke_command(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_deallocate(self, resource_group): + def test_cassandra_clusters_begin_invoke_command_async(self, resource_group): + response = self.client.cassandra_clusters.begin_invoke_command_async( + resource_group_name=resource_group.name, + cluster_name="str", + body={"command": "str", "host": "str", "arguments": {}, "cassandra-stop-start": bool, "readWrite": bool}, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_list_command(self, resource_group): + response = self.client.cassandra_clusters.list_command( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_get_command_async(self, resource_group): + response = self.client.cassandra_clusters.get_command_async( + resource_group_name=resource_group.name, + cluster_name="str", + command_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_list_backups(self, resource_group): + response = self.client.cassandra_clusters.list_backups( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_get_backup(self, resource_group): + response = self.client.cassandra_clusters.get_backup( + resource_group_name=resource_group.name, + cluster_name="str", + backup_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_begin_deallocate(self, resource_group): response = self.client.cassandra_clusters.begin_deallocate( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -180,11 +255,11 @@ def test_begin_deallocate(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_start(self, resource_group): + def test_cassandra_clusters_begin_start(self, resource_group): response = self.client.cassandra_clusters.begin_start( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -192,11 +267,11 @@ def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_status(self, resource_group): + def test_cassandra_clusters_status(self, resource_group): response = self.client.cassandra_clusters.status( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations_async.py index c40607b62ef6..f09208559630 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_clusters_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_subscription(self, resource_group): + async def test_cassandra_clusters_list_by_subscription(self, resource_group): response = self.client.cassandra_clusters.list_by_subscription( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_cassandra_clusters_list_by_resource_group(self, resource_group): response = self.client.cassandra_clusters.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,11 +42,11 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_cassandra_clusters_get(self, resource_group): response = await self.client.cassandra_clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -54,12 +54,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_cassandra_clusters_begin_delete(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -68,7 +68,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update(self, resource_group): + async def test_cassandra_clusters_begin_create_update(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_create_update( resource_group_name=resource_group.name, @@ -80,13 +80,18 @@ async def test_begin_create_update(self, resource_group): "name": "str", "properties": { "authenticationMethod": "str", + "autoReplicate": "str", "azureConnectionMethod": "str", + "backupSchedules": [{"cronExpression": "str", "retentionInHours": 0, "scheduleName": "str"}], "cassandraAuditLoggingEnabled": bool, "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", + "extensions": ["str"], + "externalDataCenters": ["str"], "externalGossipCertificates": [{"pem": "str"}], "externalSeedNodes": [{"ipAddress": "str"}], "gossipCertificates": [{"pem": "str"}], @@ -103,12 +108,13 @@ async def test_begin_create_update(self, resource_group): "provisioningState": "str", "repairEnabled": bool, "restoreFromBackupId": "str", + "scheduledEventStrategy": "str", "seedNodes": [{"ipAddress": "str"}], }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -117,7 +123,7 @@ async def test_begin_create_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_cassandra_clusters_begin_update(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_update( resource_group_name=resource_group.name, @@ -129,13 +135,18 @@ async def test_begin_update(self, resource_group): "name": "str", "properties": { "authenticationMethod": "str", + "autoReplicate": "str", "azureConnectionMethod": "str", + "backupSchedules": [{"cronExpression": "str", "retentionInHours": 0, "scheduleName": "str"}], "cassandraAuditLoggingEnabled": bool, "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", + "extensions": ["str"], + "externalDataCenters": ["str"], "externalGossipCertificates": [{"pem": "str"}], "externalSeedNodes": [{"ipAddress": "str"}], "gossipCertificates": [{"pem": "str"}], @@ -152,12 +163,13 @@ async def test_begin_update(self, resource_group): "provisioningState": "str", "repairEnabled": bool, "restoreFromBackupId": "str", + "scheduledEventStrategy": "str", "seedNodes": [{"ipAddress": "str"}], }, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -166,7 +178,7 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_invoke_command(self, resource_group): + async def test_cassandra_clusters_begin_invoke_command(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_invoke_command( resource_group_name=resource_group.name, @@ -178,7 +190,7 @@ async def test_begin_invoke_command(self, resource_group): "cassandra-stop-start": bool, "readwrite": bool, }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -187,12 +199,83 @@ async def test_begin_invoke_command(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_deallocate(self, resource_group): + async def test_cassandra_clusters_begin_invoke_command_async(self, resource_group): + response = await ( + await self.client.cassandra_clusters.begin_invoke_command_async( + resource_group_name=resource_group.name, + cluster_name="str", + body={ + "command": "str", + "host": "str", + "arguments": {}, + "cassandra-stop-start": bool, + "readWrite": bool, + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_list_command(self, resource_group): + response = self.client.cassandra_clusters.list_command( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_get_command_async(self, resource_group): + response = await self.client.cassandra_clusters.get_command_async( + resource_group_name=resource_group.name, + cluster_name="str", + command_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_list_backups(self, resource_group): + response = self.client.cassandra_clusters.list_backups( + resource_group_name=resource_group.name, + cluster_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_get_backup(self, resource_group): + response = await self.client.cassandra_clusters.get_backup( + resource_group_name=resource_group.name, + cluster_name="str", + backup_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_begin_deallocate(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_deallocate( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -201,12 +284,12 @@ async def test_begin_deallocate(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_start(self, resource_group): + async def test_cassandra_clusters_begin_start(self, resource_group): response = await ( await self.client.cassandra_clusters.begin_start( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -215,11 +298,11 @@ async def test_begin_start(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_status(self, resource_group): + async def test_cassandra_clusters_status(self, resource_group): response = await self.client.cassandra_clusters.status( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations.py index bd525063a0bd..330875d726c9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_cassandra_data_centers_list(self, resource_group): response = self.client.cassandra_data_centers.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_cassandra_data_centers_get(self, resource_group): response = self.client.cassandra_data_centers.get( resource_group_name=resource_group.name, cluster_name="str", data_center_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_cassandra_data_centers_begin_delete(self, resource_group): response = self.client.cassandra_data_centers.begin_delete( resource_group_name=resource_group.name, cluster_name="str", data_center_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -58,7 +58,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update(self, resource_group): + def test_cassandra_data_centers_begin_create_update(self, resource_group): response = self.client.cassandra_data_centers.begin_create_update( resource_group_name=resource_group.name, cluster_name="str", @@ -95,7 +95,7 @@ def test_begin_create_update(self, resource_group): }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -103,7 +103,7 @@ def test_begin_create_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_cassandra_data_centers_begin_update(self, resource_group): response = self.client.cassandra_data_centers.begin_update( resource_group_name=resource_group.name, cluster_name="str", @@ -140,7 +140,7 @@ def test_begin_update(self, resource_group): }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations_async.py index f1148a933b48..d1a3277e598f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_data_centers_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_cassandra_data_centers_list(self, resource_group): response = self.client.cassandra_data_centers.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_cassandra_data_centers_get(self, resource_group): response = await self.client.cassandra_data_centers.get( resource_group_name=resource_group.name, cluster_name="str", data_center_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_cassandra_data_centers_begin_delete(self, resource_group): response = await ( await self.client.cassandra_data_centers.begin_delete( resource_group_name=resource_group.name, cluster_name="str", data_center_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -61,7 +61,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update(self, resource_group): + async def test_cassandra_data_centers_begin_create_update(self, resource_group): response = await ( await self.client.cassandra_data_centers.begin_create_update( resource_group_name=resource_group.name, @@ -104,7 +104,7 @@ async def test_begin_create_update(self, resource_group): }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -113,7 +113,7 @@ async def test_begin_create_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_cassandra_data_centers_begin_update(self, resource_group): response = await ( await self.client.cassandra_data_centers.begin_update( resource_group_name=resource_group.name, @@ -156,7 +156,7 @@ async def test_begin_update(self, resource_group): }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations.py index e651851e0ebe..865354b08f89 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_cassandra_keyspaces(self, resource_group): + def test_cassandra_resources_list_cassandra_keyspaces(self, resource_group): response = self.client.cassandra_resources.list_cassandra_keyspaces( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_cassandra_keyspaces(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_cassandra_keyspace(self, resource_group): + def test_cassandra_resources_get_cassandra_keyspace(self, resource_group): response = self.client.cassandra_resources.get_cassandra_keyspace( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_cassandra_keyspace(self, resource_group): + def test_cassandra_resources_begin_create_update_cassandra_keyspace(self, resource_group): response = self.client.cassandra_resources.begin_create_update_cassandra_keyspace( resource_group_name=resource_group.name, account_name="str", @@ -53,13 +53,19 @@ def test_begin_create_update_cassandra_keyspace(self, resource_group): create_update_cassandra_keyspace_parameters={ "resource": {"id": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -67,12 +73,12 @@ def test_begin_create_update_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_cassandra_keyspace(self, resource_group): + def test_cassandra_resources_begin_delete_cassandra_keyspace(self, resource_group): response = self.client.cassandra_resources.begin_delete_cassandra_keyspace( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -80,12 +86,12 @@ def test_begin_delete_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_cassandra_keyspace_throughput(self, resource_group): + def test_cassandra_resources_get_cassandra_keyspace_throughput(self, resource_group): response = self.client.cassandra_resources.get_cassandra_keyspace_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -93,7 +99,7 @@ def test_get_cassandra_keyspace_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_cassandra_keyspace_throughput(self, resource_group): + def test_cassandra_resources_begin_update_cassandra_keyspace_throughput(self, resource_group): response = self.client.cassandra_resources.begin_update_cassandra_keyspace_throughput( resource_group_name=resource_group.name, account_name="str", @@ -110,14 +116,21 @@ def test_begin_update_cassandra_keyspace_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -125,12 +138,12 @@ def test_begin_update_cassandra_keyspace_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_group): + def test_cassandra_resources_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_group): response = self.client.cassandra_resources.begin_migrate_cassandra_keyspace_to_autoscale( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -138,12 +151,12 @@ def test_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resource_group): + def test_cassandra_resources_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resource_group): response = self.client.cassandra_resources.begin_migrate_cassandra_keyspace_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -151,12 +164,12 @@ def test_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_cassandra_tables(self, resource_group): + def test_cassandra_resources_list_cassandra_tables(self, resource_group): response = self.client.cassandra_resources.list_cassandra_tables( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -164,13 +177,13 @@ def test_list_cassandra_tables(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_cassandra_table(self, resource_group): + def test_cassandra_resources_get_cassandra_table(self, resource_group): response = self.client.cassandra_resources.get_cassandra_table( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -178,7 +191,7 @@ def test_get_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_cassandra_table(self, resource_group): + def test_cassandra_resources_begin_create_update_cassandra_table(self, resource_group): response = self.client.cassandra_resources.begin_create_update_cassandra_table( resource_group_name=resource_group.name, account_name="str", @@ -196,13 +209,19 @@ def test_begin_create_update_cassandra_table(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -210,13 +229,13 @@ def test_begin_create_update_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_cassandra_table(self, resource_group): + def test_cassandra_resources_begin_delete_cassandra_table(self, resource_group): response = self.client.cassandra_resources.begin_delete_cassandra_table( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -224,13 +243,13 @@ def test_begin_delete_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_cassandra_table_throughput(self, resource_group): + def test_cassandra_resources_get_cassandra_table_throughput(self, resource_group): response = self.client.cassandra_resources.get_cassandra_table_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -238,7 +257,7 @@ def test_get_cassandra_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_cassandra_table_throughput(self, resource_group): + def test_cassandra_resources_begin_update_cassandra_table_throughput(self, resource_group): response = self.client.cassandra_resources.begin_update_cassandra_table_throughput( resource_group_name=resource_group.name, account_name="str", @@ -256,14 +275,21 @@ def test_begin_update_cassandra_table_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -271,13 +297,13 @@ def test_begin_update_cassandra_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_cassandra_table_to_autoscale(self, resource_group): + def test_cassandra_resources_begin_migrate_cassandra_table_to_autoscale(self, resource_group): response = self.client.cassandra_resources.begin_migrate_cassandra_table_to_autoscale( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -285,13 +311,165 @@ def test_begin_migrate_cassandra_table_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_cassandra_table_to_manual_throughput(self, resource_group): + def test_cassandra_resources_begin_migrate_cassandra_table_to_manual_throughput(self, resource_group): response = self.client.cassandra_resources.begin_migrate_cassandra_table_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_list_cassandra_views(self, resource_group): + response = self.client.cassandra_resources.list_cassandra_views( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_get_cassandra_view(self, resource_group): + response = self.client.cassandra_resources.get_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_begin_create_update_cassandra_view(self, resource_group): + response = self.client.cassandra_resources.begin_create_update_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + create_update_cassandra_view_parameters={ + "resource": {"id": "str", "viewDefinition": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_begin_delete_cassandra_view(self, resource_group): + response = self.client.cassandra_resources.begin_delete_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_get_cassandra_view_throughput(self, resource_group): + response = self.client.cassandra_resources.get_cassandra_view_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_begin_update_cassandra_view_throughput(self, resource_group): + response = self.client.cassandra_resources.begin_update_cassandra_view_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + update_throughput_parameters={ + "resource": { + "autoscaleSettings": { + "maxThroughput": 0, + "autoUpgradePolicy": {"throughputPolicy": {"incrementPercent": 0, "isEnabled": bool}}, + "targetMaxThroughput": 0, + }, + "instantMaximumThroughput": "str", + "minimumThroughput": "str", + "offerReplacePending": "str", + "softAllowedMaximumThroughput": "str", + "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_begin_migrate_cassandra_view_to_autoscale(self, resource_group): + response = self.client.cassandra_resources.begin_migrate_cassandra_view_to_autoscale( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_resources_begin_migrate_cassandra_view_to_manual_throughput(self, resource_group): + response = self.client.cassandra_resources.begin_migrate_cassandra_view_to_manual_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations_async.py index b9b5b5ff4797..80f4a0fe52ef 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_cassandra_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_cassandra_keyspaces(self, resource_group): + async def test_cassandra_resources_list_cassandra_keyspaces(self, resource_group): response = self.client.cassandra_resources.list_cassandra_keyspaces( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_cassandra_keyspaces(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_cassandra_keyspace(self, resource_group): + async def test_cassandra_resources_get_cassandra_keyspace(self, resource_group): response = await self.client.cassandra_resources.get_cassandra_keyspace( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_cassandra_keyspace(self, resource_group): + async def test_cassandra_resources_begin_create_update_cassandra_keyspace(self, resource_group): response = await ( await self.client.cassandra_resources.begin_create_update_cassandra_keyspace( resource_group_name=resource_group.name, @@ -55,13 +55,19 @@ async def test_begin_create_update_cassandra_keyspace(self, resource_group): create_update_cassandra_keyspace_parameters={ "resource": {"id": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -70,13 +76,13 @@ async def test_begin_create_update_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_cassandra_keyspace(self, resource_group): + async def test_cassandra_resources_begin_delete_cassandra_keyspace(self, resource_group): response = await ( await self.client.cassandra_resources.begin_delete_cassandra_keyspace( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -85,12 +91,12 @@ async def test_begin_delete_cassandra_keyspace(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_cassandra_keyspace_throughput(self, resource_group): + async def test_cassandra_resources_get_cassandra_keyspace_throughput(self, resource_group): response = await self.client.cassandra_resources.get_cassandra_keyspace_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -98,7 +104,7 @@ async def test_get_cassandra_keyspace_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_cassandra_keyspace_throughput(self, resource_group): + async def test_cassandra_resources_begin_update_cassandra_keyspace_throughput(self, resource_group): response = await ( await self.client.cassandra_resources.begin_update_cassandra_keyspace_throughput( resource_group_name=resource_group.name, @@ -116,14 +122,21 @@ async def test_begin_update_cassandra_keyspace_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -132,13 +145,13 @@ async def test_begin_update_cassandra_keyspace_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_group): + async def test_cassandra_resources_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_group): response = await ( await self.client.cassandra_resources.begin_migrate_cassandra_keyspace_to_autoscale( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -147,13 +160,13 @@ async def test_begin_migrate_cassandra_keyspace_to_autoscale(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resource_group): + async def test_cassandra_resources_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resource_group): response = await ( await self.client.cassandra_resources.begin_migrate_cassandra_keyspace_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -162,12 +175,12 @@ async def test_begin_migrate_cassandra_keyspace_to_manual_throughput(self, resou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_cassandra_tables(self, resource_group): + async def test_cassandra_resources_list_cassandra_tables(self, resource_group): response = self.client.cassandra_resources.list_cassandra_tables( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -175,13 +188,13 @@ async def test_list_cassandra_tables(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_cassandra_table(self, resource_group): + async def test_cassandra_resources_get_cassandra_table(self, resource_group): response = await self.client.cassandra_resources.get_cassandra_table( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -189,7 +202,7 @@ async def test_get_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_cassandra_table(self, resource_group): + async def test_cassandra_resources_begin_create_update_cassandra_table(self, resource_group): response = await ( await self.client.cassandra_resources.begin_create_update_cassandra_table( resource_group_name=resource_group.name, @@ -208,13 +221,19 @@ async def test_begin_create_update_cassandra_table(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -223,14 +242,14 @@ async def test_begin_create_update_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_cassandra_table(self, resource_group): + async def test_cassandra_resources_begin_delete_cassandra_table(self, resource_group): response = await ( await self.client.cassandra_resources.begin_delete_cassandra_table( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -239,13 +258,13 @@ async def test_begin_delete_cassandra_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_cassandra_table_throughput(self, resource_group): + async def test_cassandra_resources_get_cassandra_table_throughput(self, resource_group): response = await self.client.cassandra_resources.get_cassandra_table_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -253,7 +272,7 @@ async def test_get_cassandra_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_cassandra_table_throughput(self, resource_group): + async def test_cassandra_resources_begin_update_cassandra_table_throughput(self, resource_group): response = await ( await self.client.cassandra_resources.begin_update_cassandra_table_throughput( resource_group_name=resource_group.name, @@ -272,14 +291,21 @@ async def test_begin_update_cassandra_table_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -288,14 +314,14 @@ async def test_begin_update_cassandra_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_cassandra_table_to_autoscale(self, resource_group): + async def test_cassandra_resources_begin_migrate_cassandra_table_to_autoscale(self, resource_group): response = await ( await self.client.cassandra_resources.begin_migrate_cassandra_table_to_autoscale( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -304,14 +330,176 @@ async def test_begin_migrate_cassandra_table_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_cassandra_table_to_manual_throughput(self, resource_group): + async def test_cassandra_resources_begin_migrate_cassandra_table_to_manual_throughput(self, resource_group): response = await ( await self.client.cassandra_resources.begin_migrate_cassandra_table_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", keyspace_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_list_cassandra_views(self, resource_group): + response = self.client.cassandra_resources.list_cassandra_views( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_get_cassandra_view(self, resource_group): + response = await self.client.cassandra_resources.get_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_begin_create_update_cassandra_view(self, resource_group): + response = await ( + await self.client.cassandra_resources.begin_create_update_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + create_update_cassandra_view_parameters={ + "resource": {"id": "str", "viewDefinition": "str"}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_begin_delete_cassandra_view(self, resource_group): + response = await ( + await self.client.cassandra_resources.begin_delete_cassandra_view( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_get_cassandra_view_throughput(self, resource_group): + response = await self.client.cassandra_resources.get_cassandra_view_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_begin_update_cassandra_view_throughput(self, resource_group): + response = await ( + await self.client.cassandra_resources.begin_update_cassandra_view_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + update_throughput_parameters={ + "resource": { + "autoscaleSettings": { + "maxThroughput": 0, + "autoUpgradePolicy": {"throughputPolicy": {"incrementPercent": 0, "isEnabled": bool}}, + "targetMaxThroughput": 0, + }, + "instantMaximumThroughput": "str", + "minimumThroughput": "str", + "offerReplacePending": "str", + "softAllowedMaximumThroughput": "str", + "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_begin_migrate_cassandra_view_to_autoscale(self, resource_group): + response = await ( + await self.client.cassandra_resources.begin_migrate_cassandra_view_to_autoscale( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_resources_begin_migrate_cassandra_view_to_manual_throughput(self, resource_group): + response = await ( + await self.client.cassandra_resources.begin_migrate_cassandra_view_to_manual_throughput( + resource_group_name=resource_group.name, + account_name="str", + keyspace_name="str", + view_name="str", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations.py index 4eceb039f001..e4db60df6095 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_chaos_fault_list(self, resource_group): response = self.client.chaos_fault.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,7 +32,7 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_enable_disable(self, resource_group): + def test_chaos_fault_begin_enable_disable(self, resource_group): response = self.client.chaos_fault.begin_enable_disable( resource_group_name=resource_group.name, account_name="str", @@ -55,7 +55,7 @@ def test_begin_enable_disable(self, resource_group): }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,12 +63,12 @@ def test_begin_enable_disable(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_chaos_fault_get(self, resource_group): response = self.client.chaos_fault.get( resource_group_name=resource_group.name, account_name="str", chaos_fault="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py index aab4e8a0bab9..9db73046327c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_chaos_fault_list(self, resource_group): response = self.client.chaos_fault.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_enable_disable(self, resource_group): + async def test_chaos_fault_begin_enable_disable(self, resource_group): response = await ( await self.client.chaos_fault.begin_enable_disable( resource_group_name=resource_group.name, @@ -57,7 +57,7 @@ async def test_begin_enable_disable(self, resource_group): }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -66,12 +66,12 @@ async def test_begin_enable_disable(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_chaos_fault_get(self, resource_group): response = await self.client.chaos_fault.get( resource_group_name=resource_group.name, account_name="str", chaos_fault="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations.py index ecddb5614de4..6a6c9ff4b3b2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations.py @@ -20,14 +20,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_collection_list_metrics(self, resource_group): response = self.client.collection.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -35,13 +35,13 @@ def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_collection_list_usages(self, resource_group): response = self.client.collection.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -49,13 +49,13 @@ def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metric_definitions(self, resource_group): + def test_collection_list_metric_definitions(self, resource_group): response = self.client.collection.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations_async.py index 3ab453887d27..6a0404f21dfb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_operations_async.py @@ -21,14 +21,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_collection_list_metrics(self, resource_group): response = self.client.collection.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -36,13 +36,13 @@ async def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_collection_list_usages(self, resource_group): response = self.client.collection.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -50,13 +50,13 @@ async def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metric_definitions(self, resource_group): + async def test_collection_list_metric_definitions(self, resource_group): response = self.client.collection.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations.py index 780c065f2179..e7602a86f2f6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations.py @@ -20,14 +20,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_collection_partition_list_metrics(self, resource_group): response = self.client.collection_partition.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -35,13 +35,13 @@ def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_collection_partition_list_usages(self, resource_group): response = self.client.collection_partition.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations_async.py index 8fe82dbac138..f2a09acc16cc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_operations_async.py @@ -21,14 +21,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_collection_partition_list_metrics(self, resource_group): response = self.client.collection_partition.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -36,13 +36,13 @@ async def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_collection_partition_list_usages(self, resource_group): response = self.client.collection_partition.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", collection_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations.py index 1b0b98c9f206..6fa86fc36690 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_collection_partition_region_list_metrics(self, resource_group): response = self.client.collection_partition_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -28,7 +28,7 @@ def test_list_metrics(self, resource_group): database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations_async.py index 2f7000829714..d5060c7d9624 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_partition_region_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_collection_partition_region_list_metrics(self, resource_group): response = self.client.collection_partition_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -29,7 +29,7 @@ async def test_list_metrics(self, resource_group): database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations.py index 7cff405abe14..fac97912af91 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_collection_region_list_metrics(self, resource_group): response = self.client.collection_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -28,7 +28,7 @@ def test_list_metrics(self, resource_group): database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations_async.py index 03543c18fd8a..cb7aaffc0aa6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_collection_region_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_collection_region_list_metrics(self, resource_group): response = self.client.collection_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -29,7 +29,7 @@ async def test_list_metrics(self, resource_group): database_rid="str", collection_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py index 25195b10c171..49137efc816c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create(self, resource_group): + def test_data_transfer_jobs_create(self, resource_group): response = self.client.data_transfer_jobs.create( resource_group_name=resource_group.name, account_name="str", @@ -43,7 +43,7 @@ def test_create(self, resource_group): "name": "str", "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -51,12 +51,12 @@ def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_data_transfer_jobs_get(self, resource_group): response = self.client.data_transfer_jobs.get( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -64,12 +64,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_pause(self, resource_group): + def test_data_transfer_jobs_pause(self, resource_group): response = self.client.data_transfer_jobs.pause( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -77,12 +77,12 @@ def test_pause(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_resume(self, resource_group): + def test_data_transfer_jobs_resume(self, resource_group): response = self.client.data_transfer_jobs.resume( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -90,12 +90,12 @@ def test_resume(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_cancel(self, resource_group): + def test_data_transfer_jobs_cancel(self, resource_group): response = self.client.data_transfer_jobs.cancel( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -103,12 +103,12 @@ def test_cancel(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_complete(self, resource_group): + def test_data_transfer_jobs_complete(self, resource_group): response = self.client.data_transfer_jobs.complete( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -116,11 +116,11 @@ def test_complete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_database_account(self, resource_group): + def test_data_transfer_jobs_list_by_database_account(self, resource_group): response = self.client.data_transfer_jobs.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py index 66e0a4344b2b..54a8ffe58f90 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create(self, resource_group): + async def test_data_transfer_jobs_create(self, resource_group): response = await self.client.data_transfer_jobs.create( resource_group_name=resource_group.name, account_name="str", @@ -44,7 +44,7 @@ async def test_create(self, resource_group): "name": "str", "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -52,12 +52,12 @@ async def test_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_data_transfer_jobs_get(self, resource_group): response = await self.client.data_transfer_jobs.get( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -65,12 +65,12 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_pause(self, resource_group): + async def test_data_transfer_jobs_pause(self, resource_group): response = await self.client.data_transfer_jobs.pause( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -78,12 +78,12 @@ async def test_pause(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_resume(self, resource_group): + async def test_data_transfer_jobs_resume(self, resource_group): response = await self.client.data_transfer_jobs.resume( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -91,12 +91,12 @@ async def test_resume(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_cancel(self, resource_group): + async def test_data_transfer_jobs_cancel(self, resource_group): response = await self.client.data_transfer_jobs.cancel( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -104,12 +104,12 @@ async def test_cancel(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_complete(self, resource_group): + async def test_data_transfer_jobs_complete(self, resource_group): response = await self.client.data_transfer_jobs.complete( resource_group_name=resource_group.name, account_name="str", job_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -117,11 +117,11 @@ async def test_complete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_database_account(self, resource_group): + async def test_data_transfer_jobs_list_by_database_account(self, resource_group): response = self.client.data_transfer_jobs.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations.py index 8050b645be38..567878f3e9c2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_database_account_region_list_metrics(self, resource_group): response = self.client.database_account_region.list_metrics( resource_group_name=resource_group.name, account_name="str", region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations_async.py index 05040120b7bf..d2d220283e65 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_account_region_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_database_account_region_list_metrics(self, resource_group): response = self.client.database_account_region.list_metrics( resource_group_name=resource_group.name, account_name="str", region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations.py index 8fdcdbf231cf..9393fcbaecc5 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_database_accounts_get(self, resource_group): response = self.client.database_accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -32,7 +32,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_database_accounts_begin_update(self, resource_group): response = self.client.database_accounts.begin_update( resource_group_name=resource_group.name, account_name="str", @@ -42,6 +42,7 @@ def test_begin_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -59,6 +60,8 @@ def test_begin_update(self, resource_group): ], "customerManagedKeyStatus": "str", "defaultIdentity": "str", + "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, "enableAnalyticalStorage": bool, @@ -66,9 +69,11 @@ def test_begin_update(self, resource_group): "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, + "enablePriorityBasedExecution": bool, "identity": { "principalId": "str", "tenantId": "str", @@ -102,7 +107,7 @@ def test_begin_update(self, resource_group): "tags": {"str": "str"}, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -110,7 +115,7 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_database_accounts_begin_create_or_update(self, resource_group): response = self.client.database_accounts.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -131,6 +136,7 @@ def test_begin_create_or_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -149,6 +155,8 @@ def test_begin_create_or_update(self, resource_group): "createMode": "Default", "customerManagedKeyStatus": "str", "defaultIdentity": "str", + "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, "enableAnalyticalStorage": bool, @@ -156,9 +164,11 @@ def test_begin_create_or_update(self, resource_group): "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, + "enablePriorityBasedExecution": bool, "id": "str", "identity": { "principalId": "str", @@ -189,13 +199,14 @@ def test_begin_create_or_update(self, resource_group): "restoreSource": "str", "restoreTimestampInUtc": "2020-02-20 00:00:00", "restoreWithTtlDisabled": bool, + "sourceBackupLocation": "str", "tablesToRestore": ["str"], }, "tags": {"str": "str"}, "type": "str", "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -203,11 +214,11 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_database_accounts_begin_delete(self, resource_group): response = self.client.database_accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -215,12 +226,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_failover_priority_change(self, resource_group): + def test_database_accounts_begin_failover_priority_change(self, resource_group): response = self.client.database_accounts.begin_failover_priority_change( resource_group_name=resource_group.name, account_name="str", failover_parameters={"failoverPolicies": [{"failoverPriority": 0, "id": "str", "locationName": "str"}]}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -228,9 +239,9 @@ def test_begin_failover_priority_change(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_database_accounts_list(self, resource_group): response = self.client.database_accounts.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -238,10 +249,10 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_database_accounts_list_by_resource_group(self, resource_group): response = self.client.database_accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -249,11 +260,11 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_keys(self, resource_group): + def test_database_accounts_list_keys(self, resource_group): response = self.client.database_accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -261,11 +272,11 @@ def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_connection_strings(self, resource_group): + def test_database_accounts_list_connection_strings(self, resource_group): response = self.client.database_accounts.list_connection_strings( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -273,12 +284,12 @@ def test_list_connection_strings(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_offline_region(self, resource_group): + def test_database_accounts_begin_offline_region(self, resource_group): response = self.client.database_accounts.begin_offline_region( resource_group_name=resource_group.name, account_name="str", region_parameter_for_offline={"region": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -286,12 +297,12 @@ def test_begin_offline_region(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_online_region(self, resource_group): + def test_database_accounts_begin_online_region(self, resource_group): response = self.client.database_accounts.begin_online_region( resource_group_name=resource_group.name, account_name="str", region_parameter_for_online={"region": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -299,11 +310,11 @@ def test_begin_online_region(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_read_only_keys(self, resource_group): + def test_database_accounts_get_read_only_keys(self, resource_group): response = self.client.database_accounts.get_read_only_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -311,11 +322,11 @@ def test_get_read_only_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_read_only_keys(self, resource_group): + def test_database_accounts_list_read_only_keys(self, resource_group): response = self.client.database_accounts.list_read_only_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -323,12 +334,12 @@ def test_list_read_only_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_regenerate_key(self, resource_group): + def test_database_accounts_begin_regenerate_key(self, resource_group): response = self.client.database_accounts.begin_regenerate_key( resource_group_name=resource_group.name, account_name="str", key_to_regenerate={"keyKind": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -336,10 +347,10 @@ def test_begin_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_check_name_exists(self, resource_group): + def test_database_accounts_check_name_exists(self, resource_group): response = self.client.database_accounts.check_name_exists( account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -347,12 +358,12 @@ def test_check_name_exists(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_database_accounts_list_metrics(self, resource_group): response = self.client.database_accounts.list_metrics( resource_group_name=resource_group.name, account_name="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -360,11 +371,11 @@ def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_database_accounts_list_usages(self, resource_group): response = self.client.database_accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -372,11 +383,11 @@ def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metric_definitions(self, resource_group): + def test_database_accounts_list_metric_definitions(self, resource_group): response = self.client.database_accounts.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations_async.py index 7327e450c8d0..696502d7c76a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_database_accounts_get(self, resource_group): response = await self.client.database_accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -33,7 +33,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_database_accounts_begin_update(self, resource_group): response = await ( await self.client.database_accounts.begin_update( resource_group_name=resource_group.name, @@ -44,6 +44,7 @@ async def test_begin_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -61,6 +62,8 @@ async def test_begin_update(self, resource_group): ], "customerManagedKeyStatus": "str", "defaultIdentity": "str", + "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, "enableAnalyticalStorage": bool, @@ -68,9 +71,11 @@ async def test_begin_update(self, resource_group): "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, + "enablePriorityBasedExecution": bool, "identity": { "principalId": "str", "tenantId": "str", @@ -104,7 +109,7 @@ async def test_begin_update(self, resource_group): "tags": {"str": "str"}, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -113,7 +118,7 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_database_accounts_begin_create_or_update(self, resource_group): response = await ( await self.client.database_accounts.begin_create_or_update( resource_group_name=resource_group.name, @@ -135,6 +140,7 @@ async def test_begin_create_or_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -153,6 +159,8 @@ async def test_begin_create_or_update(self, resource_group): "createMode": "Default", "customerManagedKeyStatus": "str", "defaultIdentity": "str", + "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, "enableAnalyticalStorage": bool, @@ -160,9 +168,11 @@ async def test_begin_create_or_update(self, resource_group): "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, + "enablePriorityBasedExecution": bool, "id": "str", "identity": { "principalId": "str", @@ -193,13 +203,14 @@ async def test_begin_create_or_update(self, resource_group): "restoreSource": "str", "restoreTimestampInUtc": "2020-02-20 00:00:00", "restoreWithTtlDisabled": bool, + "sourceBackupLocation": "str", "tablesToRestore": ["str"], }, "tags": {"str": "str"}, "type": "str", "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -208,12 +219,12 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_database_accounts_begin_delete(self, resource_group): response = await ( await self.client.database_accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -222,13 +233,13 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_failover_priority_change(self, resource_group): + async def test_database_accounts_begin_failover_priority_change(self, resource_group): response = await ( await self.client.database_accounts.begin_failover_priority_change( resource_group_name=resource_group.name, account_name="str", failover_parameters={"failoverPolicies": [{"failoverPriority": 0, "id": "str", "locationName": "str"}]}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -237,9 +248,9 @@ async def test_begin_failover_priority_change(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_database_accounts_list(self, resource_group): response = self.client.database_accounts.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -247,10 +258,10 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_database_accounts_list_by_resource_group(self, resource_group): response = self.client.database_accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -258,11 +269,11 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_keys(self, resource_group): + async def test_database_accounts_list_keys(self, resource_group): response = await self.client.database_accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -270,11 +281,11 @@ async def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_connection_strings(self, resource_group): + async def test_database_accounts_list_connection_strings(self, resource_group): response = await self.client.database_accounts.list_connection_strings( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -282,13 +293,13 @@ async def test_list_connection_strings(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_offline_region(self, resource_group): + async def test_database_accounts_begin_offline_region(self, resource_group): response = await ( await self.client.database_accounts.begin_offline_region( resource_group_name=resource_group.name, account_name="str", region_parameter_for_offline={"region": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -297,13 +308,13 @@ async def test_begin_offline_region(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_online_region(self, resource_group): + async def test_database_accounts_begin_online_region(self, resource_group): response = await ( await self.client.database_accounts.begin_online_region( resource_group_name=resource_group.name, account_name="str", region_parameter_for_online={"region": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -312,11 +323,11 @@ async def test_begin_online_region(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_read_only_keys(self, resource_group): + async def test_database_accounts_get_read_only_keys(self, resource_group): response = await self.client.database_accounts.get_read_only_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -324,11 +335,11 @@ async def test_get_read_only_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_read_only_keys(self, resource_group): + async def test_database_accounts_list_read_only_keys(self, resource_group): response = await self.client.database_accounts.list_read_only_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -336,13 +347,13 @@ async def test_list_read_only_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_regenerate_key(self, resource_group): + async def test_database_accounts_begin_regenerate_key(self, resource_group): response = await ( await self.client.database_accounts.begin_regenerate_key( resource_group_name=resource_group.name, account_name="str", key_to_regenerate={"keyKind": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -351,10 +362,10 @@ async def test_begin_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_check_name_exists(self, resource_group): + async def test_database_accounts_check_name_exists(self, resource_group): response = await self.client.database_accounts.check_name_exists( account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -362,12 +373,12 @@ async def test_check_name_exists(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_database_accounts_list_metrics(self, resource_group): response = self.client.database_accounts.list_metrics( resource_group_name=resource_group.name, account_name="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -375,11 +386,11 @@ async def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_database_accounts_list_usages(self, resource_group): response = self.client.database_accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -387,11 +398,11 @@ async def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metric_definitions(self, resource_group): + async def test_database_accounts_list_metric_definitions(self, resource_group): response = self.client.database_accounts.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations.py index 1161d2c8e0be..1eed32c3501b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_database_list_metrics(self, resource_group): response = self.client.database.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -34,12 +34,12 @@ def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_database_list_usages(self, resource_group): response = self.client.database.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -47,12 +47,12 @@ def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metric_definitions(self, resource_group): + def test_database_list_metric_definitions(self, resource_group): response = self.client.database.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", database_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations_async.py index 629f47b1cd8b..c892c47af6f4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_database_list_metrics(self, resource_group): response = self.client.database.list_metrics( resource_group_name=resource_group.name, account_name="str", database_rid="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -35,12 +35,12 @@ async def test_list_metrics(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_database_list_usages(self, resource_group): response = self.client.database.list_usages( resource_group_name=resource_group.name, account_name="str", database_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -48,12 +48,12 @@ async def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metric_definitions(self, resource_group): + async def test_database_list_metric_definitions(self, resource_group): response = self.client.database.list_metric_definitions( resource_group_name=resource_group.name, account_name="str", database_rid="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py index 634ff72f5e92..9152afba5ca6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_graphs(self, resource_group): + def test_graph_resources_list_graphs(self, resource_group): response = self.client.graph_resources.list_graphs( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_graphs(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_graph(self, resource_group): + def test_graph_resources_get_graph(self, resource_group): response = self.client.graph_resources.get_graph( resource_group_name=resource_group.name, account_name="str", graph_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_graph(self, resource_group): + def test_graph_resources_begin_create_update_graph(self, resource_group): response = self.client.graph_resources.begin_create_update_graph( resource_group_name=resource_group.name, account_name="str", @@ -65,7 +65,7 @@ def test_begin_create_update_graph(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -73,12 +73,12 @@ def test_begin_create_update_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_graph_resource(self, resource_group): + def test_graph_resources_begin_delete_graph_resource(self, resource_group): response = self.client.graph_resources.begin_delete_graph_resource( resource_group_name=resource_group.name, account_name="str", graph_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py index eb16f1699349..13644035dad2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_graphs(self, resource_group): + async def test_graph_resources_list_graphs(self, resource_group): response = self.client.graph_resources.list_graphs( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_graphs(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_graph(self, resource_group): + async def test_graph_resources_get_graph(self, resource_group): response = await self.client.graph_resources.get_graph( resource_group_name=resource_group.name, account_name="str", graph_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_graph(self, resource_group): + async def test_graph_resources_begin_create_update_graph(self, resource_group): response = await ( await self.client.graph_resources.begin_create_update_graph( resource_group_name=resource_group.name, @@ -67,7 +67,7 @@ async def test_begin_create_update_graph(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -76,13 +76,13 @@ async def test_begin_create_update_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_graph_resource(self, resource_group): + async def test_graph_resources_begin_delete_graph_resource(self, resource_group): response = await ( await self.client.graph_resources.begin_delete_graph_resource( resource_group_name=resource_group.name, account_name="str", graph_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations.py index f5c44c5b6c1d..631cc09e9387 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_gremlin_databases(self, resource_group): + def test_gremlin_resources_list_gremlin_databases(self, resource_group): response = self.client.gremlin_resources.list_gremlin_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_gremlin_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_gremlin_database(self, resource_group): + def test_gremlin_resources_get_gremlin_database(self, resource_group): response = self.client.gremlin_resources.get_gremlin_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_gremlin_database(self, resource_group): + def test_gremlin_resources_begin_create_update_gremlin_database(self, resource_group): response = self.client.gremlin_resources.begin_create_update_gremlin_database( resource_group_name=resource_group.name, account_name="str", @@ -61,13 +61,19 @@ def test_begin_create_update_gremlin_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,12 +81,12 @@ def test_begin_create_update_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_gremlin_database(self, resource_group): + def test_gremlin_resources_begin_delete_gremlin_database(self, resource_group): response = self.client.gremlin_resources.begin_delete_gremlin_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,12 +94,12 @@ def test_begin_delete_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_gremlin_database_throughput(self, resource_group): + def test_gremlin_resources_get_gremlin_database_throughput(self, resource_group): response = self.client.gremlin_resources.get_gremlin_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -101,7 +107,7 @@ def test_get_gremlin_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_gremlin_database_throughput(self, resource_group): + def test_gremlin_resources_begin_update_gremlin_database_throughput(self, resource_group): response = self.client.gremlin_resources.begin_update_gremlin_database_throughput( resource_group_name=resource_group.name, account_name="str", @@ -118,14 +124,21 @@ def test_begin_update_gremlin_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -133,12 +146,12 @@ def test_begin_update_gremlin_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_gremlin_database_to_autoscale(self, resource_group): + def test_gremlin_resources_begin_migrate_gremlin_database_to_autoscale(self, resource_group): response = self.client.gremlin_resources.begin_migrate_gremlin_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -146,12 +159,12 @@ def test_begin_migrate_gremlin_database_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_gremlin_database_to_manual_throughput(self, resource_group): + def test_gremlin_resources_begin_migrate_gremlin_database_to_manual_throughput(self, resource_group): response = self.client.gremlin_resources.begin_migrate_gremlin_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -159,12 +172,12 @@ def test_begin_migrate_gremlin_database_to_manual_throughput(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_gremlin_graphs(self, resource_group): + def test_gremlin_resources_list_gremlin_graphs(self, resource_group): response = self.client.gremlin_resources.list_gremlin_graphs( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -172,13 +185,13 @@ def test_list_gremlin_graphs(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_gremlin_graph(self, resource_group): + def test_gremlin_resources_get_gremlin_graph(self, resource_group): response = self.client.gremlin_resources.get_gremlin_graph( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -186,7 +199,7 @@ def test_get_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_gremlin_graph(self, resource_group): + def test_gremlin_resources_begin_create_update_gremlin_graph(self, resource_group): response = self.client.gremlin_resources.begin_create_update_gremlin_graph( resource_group_name=resource_group.name, account_name="str", @@ -223,13 +236,19 @@ def test_begin_create_update_gremlin_graph(self, resource_group): "uniqueKeyPolicy": {"uniqueKeys": [{"paths": ["str"]}]}, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -237,13 +256,13 @@ def test_begin_create_update_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_gremlin_graph(self, resource_group): + def test_gremlin_resources_begin_delete_gremlin_graph(self, resource_group): response = self.client.gremlin_resources.begin_delete_gremlin_graph( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -251,13 +270,13 @@ def test_begin_delete_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_gremlin_graph_throughput(self, resource_group): + def test_gremlin_resources_get_gremlin_graph_throughput(self, resource_group): response = self.client.gremlin_resources.get_gremlin_graph_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -265,7 +284,7 @@ def test_get_gremlin_graph_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_gremlin_graph_throughput(self, resource_group): + def test_gremlin_resources_begin_update_gremlin_graph_throughput(self, resource_group): response = self.client.gremlin_resources.begin_update_gremlin_graph_throughput( resource_group_name=resource_group.name, account_name="str", @@ -283,14 +302,21 @@ def test_begin_update_gremlin_graph_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -298,13 +324,13 @@ def test_begin_update_gremlin_graph_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): + def test_gremlin_resources_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): response = self.client.gremlin_resources.begin_migrate_gremlin_graph_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -312,13 +338,13 @@ def test_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_group): + def test_gremlin_resources_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_group): response = self.client.gremlin_resources.begin_migrate_gremlin_graph_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -326,14 +352,14 @@ def test_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_retrieve_continuous_backup_information(self, resource_group): + def test_gremlin_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = self.client.gremlin_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations_async.py index 701b31f914ff..43f593abaeb6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_gremlin_databases(self, resource_group): + async def test_gremlin_resources_list_gremlin_databases(self, resource_group): response = self.client.gremlin_resources.list_gremlin_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_gremlin_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_gremlin_database(self, resource_group): + async def test_gremlin_resources_get_gremlin_database(self, resource_group): response = await self.client.gremlin_resources.get_gremlin_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_gremlin_database(self, resource_group): + async def test_gremlin_resources_begin_create_update_gremlin_database(self, resource_group): response = await ( await self.client.gremlin_resources.begin_create_update_gremlin_database( resource_group_name=resource_group.name, @@ -63,13 +63,19 @@ async def test_begin_create_update_gremlin_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,13 +84,13 @@ async def test_begin_create_update_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_gremlin_database(self, resource_group): + async def test_gremlin_resources_begin_delete_gremlin_database(self, resource_group): response = await ( await self.client.gremlin_resources.begin_delete_gremlin_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -93,12 +99,12 @@ async def test_begin_delete_gremlin_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_gremlin_database_throughput(self, resource_group): + async def test_gremlin_resources_get_gremlin_database_throughput(self, resource_group): response = await self.client.gremlin_resources.get_gremlin_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -106,7 +112,7 @@ async def test_get_gremlin_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_gremlin_database_throughput(self, resource_group): + async def test_gremlin_resources_begin_update_gremlin_database_throughput(self, resource_group): response = await ( await self.client.gremlin_resources.begin_update_gremlin_database_throughput( resource_group_name=resource_group.name, @@ -124,14 +130,21 @@ async def test_begin_update_gremlin_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -140,13 +153,13 @@ async def test_begin_update_gremlin_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_gremlin_database_to_autoscale(self, resource_group): + async def test_gremlin_resources_begin_migrate_gremlin_database_to_autoscale(self, resource_group): response = await ( await self.client.gremlin_resources.begin_migrate_gremlin_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -155,13 +168,13 @@ async def test_begin_migrate_gremlin_database_to_autoscale(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_gremlin_database_to_manual_throughput(self, resource_group): + async def test_gremlin_resources_begin_migrate_gremlin_database_to_manual_throughput(self, resource_group): response = await ( await self.client.gremlin_resources.begin_migrate_gremlin_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -170,12 +183,12 @@ async def test_begin_migrate_gremlin_database_to_manual_throughput(self, resourc @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_gremlin_graphs(self, resource_group): + async def test_gremlin_resources_list_gremlin_graphs(self, resource_group): response = self.client.gremlin_resources.list_gremlin_graphs( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -183,13 +196,13 @@ async def test_list_gremlin_graphs(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_gremlin_graph(self, resource_group): + async def test_gremlin_resources_get_gremlin_graph(self, resource_group): response = await self.client.gremlin_resources.get_gremlin_graph( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -197,7 +210,7 @@ async def test_get_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_gremlin_graph(self, resource_group): + async def test_gremlin_resources_begin_create_update_gremlin_graph(self, resource_group): response = await ( await self.client.gremlin_resources.begin_create_update_gremlin_graph( resource_group_name=resource_group.name, @@ -235,13 +248,19 @@ async def test_begin_create_update_gremlin_graph(self, resource_group): "uniqueKeyPolicy": {"uniqueKeys": [{"paths": ["str"]}]}, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -250,14 +269,14 @@ async def test_begin_create_update_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_gremlin_graph(self, resource_group): + async def test_gremlin_resources_begin_delete_gremlin_graph(self, resource_group): response = await ( await self.client.gremlin_resources.begin_delete_gremlin_graph( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -266,13 +285,13 @@ async def test_begin_delete_gremlin_graph(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_gremlin_graph_throughput(self, resource_group): + async def test_gremlin_resources_get_gremlin_graph_throughput(self, resource_group): response = await self.client.gremlin_resources.get_gremlin_graph_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -280,7 +299,7 @@ async def test_get_gremlin_graph_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_gremlin_graph_throughput(self, resource_group): + async def test_gremlin_resources_begin_update_gremlin_graph_throughput(self, resource_group): response = await ( await self.client.gremlin_resources.begin_update_gremlin_graph_throughput( resource_group_name=resource_group.name, @@ -299,14 +318,21 @@ async def test_begin_update_gremlin_graph_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -315,14 +341,14 @@ async def test_begin_update_gremlin_graph_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): + async def test_gremlin_resources_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): response = await ( await self.client.gremlin_resources.begin_migrate_gremlin_graph_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -331,14 +357,14 @@ async def test_begin_migrate_gremlin_graph_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_group): + async def test_gremlin_resources_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_group): response = await ( await self.client.gremlin_resources.begin_migrate_gremlin_graph_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", graph_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -347,7 +373,7 @@ async def test_begin_migrate_gremlin_graph_to_manual_throughput(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_retrieve_continuous_backup_information(self, resource_group): + async def test_gremlin_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = await ( await self.client.gremlin_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, @@ -355,7 +381,7 @@ async def test_begin_retrieve_continuous_backup_information(self, resource_group database_name="str", graph_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations.py index b55eb24f8584..5cb97b7d64af 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_locations_list(self, resource_group): response = self.client.locations.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_locations_get(self, resource_group): response = self.client.locations.get( location="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations_async.py index 8a2eafbe4643..6b76bba49255 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_locations_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_locations_list(self, resource_group): response = self.client.locations.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_locations_get(self, resource_group): response = await self.client.locations.get( location="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations.py index 2a00d53d47e1..72baf8ed5d3d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_mongo_db_databases(self, resource_group): + def test_mongo_db_resources_list_mongo_db_databases(self, resource_group): response = self.client.mongo_db_resources.list_mongo_db_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_mongo_db_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_db_database(self, resource_group): + def test_mongo_db_resources_get_mongo_db_database(self, resource_group): response = self.client.mongo_db_resources.get_mongo_db_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_mongo_db_database(self, resource_group): + def test_mongo_db_resources_begin_create_update_mongo_db_database(self, resource_group): response = self.client.mongo_db_resources.begin_create_update_mongo_db_database( resource_group_name=resource_group.name, account_name="str", @@ -61,13 +61,19 @@ def test_begin_create_update_mongo_db_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,12 +81,12 @@ def test_begin_create_update_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_mongo_db_database(self, resource_group): + def test_mongo_db_resources_begin_delete_mongo_db_database(self, resource_group): response = self.client.mongo_db_resources.begin_delete_mongo_db_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,12 +94,12 @@ def test_begin_delete_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_db_database_throughput(self, resource_group): + def test_mongo_db_resources_get_mongo_db_database_throughput(self, resource_group): response = self.client.mongo_db_resources.get_mongo_db_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -101,7 +107,7 @@ def test_get_mongo_db_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_mongo_db_database_throughput(self, resource_group): + def test_mongo_db_resources_begin_update_mongo_db_database_throughput(self, resource_group): response = self.client.mongo_db_resources.begin_update_mongo_db_database_throughput( resource_group_name=resource_group.name, account_name="str", @@ -118,14 +124,21 @@ def test_begin_update_mongo_db_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -133,12 +146,12 @@ def test_begin_update_mongo_db_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_mongo_db_database_to_autoscale(self, resource_group): + def test_mongo_db_resources_begin_migrate_mongo_db_database_to_autoscale(self, resource_group): response = self.client.mongo_db_resources.begin_migrate_mongo_db_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -146,12 +159,70 @@ def test_begin_migrate_mongo_db_database_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_mongo_db_database_to_manual_throughput(self, resource_group): + def test_mongo_db_resources_begin_migrate_mongo_db_database_to_manual_throughput(self, resource_group): response = self.client.mongo_db_resources.begin_migrate_mongo_db_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_begin_mongo_db_database_retrieve_throughput_distribution(self, resource_group): + response = self.client.mongo_db_resources.begin_mongo_db_database_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_begin_mongo_db_database_redistribute_throughput(self, resource_group): + response = self.client.mongo_db_resources.begin_mongo_db_database_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -159,12 +230,72 @@ def test_begin_migrate_mongo_db_database_to_manual_throughput(self, resource_gro @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_mongo_db_collections(self, resource_group): + def test_mongo_db_resources_begin_mongo_db_container_retrieve_throughput_distribution(self, resource_group): + response = self.client.mongo_db_resources.begin_mongo_db_container_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_begin_mongo_db_container_redistribute_throughput(self, resource_group): + response = self.client.mongo_db_resources.begin_mongo_db_container_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_list_mongo_db_collections(self, resource_group): response = self.client.mongo_db_resources.list_mongo_db_collections( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -172,13 +303,13 @@ def test_list_mongo_db_collections(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_db_collection(self, resource_group): + def test_mongo_db_resources_get_mongo_db_collection(self, resource_group): response = self.client.mongo_db_resources.get_mongo_db_collection( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -186,7 +317,7 @@ def test_get_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_mongo_db_collection(self, resource_group): + def test_mongo_db_resources_begin_create_update_mongo_db_collection(self, resource_group): response = self.client.mongo_db_resources.begin_create_update_mongo_db_collection( resource_group_name=resource_group.name, account_name="str", @@ -206,13 +337,19 @@ def test_begin_create_update_mongo_db_collection(self, resource_group): "shardKey": {"str": "str"}, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -220,13 +357,42 @@ def test_begin_create_update_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_mongo_db_collection(self, resource_group): + def test_mongo_db_resources_begin_delete_mongo_db_collection(self, resource_group): response = self.client.mongo_db_resources.begin_delete_mongo_db_collection( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_begin_mongo_db_database_partition_merge(self, resource_group): + response = self.client.mongo_db_resources.begin_mongo_db_database_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_mongo_db_resources_begin_list_mongo_db_collection_partition_merge(self, resource_group): + response = self.client.mongo_db_resources.begin_list_mongo_db_collection_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -234,13 +400,13 @@ def test_begin_delete_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_db_collection_throughput(self, resource_group): + def test_mongo_db_resources_get_mongo_db_collection_throughput(self, resource_group): response = self.client.mongo_db_resources.get_mongo_db_collection_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -248,7 +414,7 @@ def test_get_mongo_db_collection_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_mongo_db_collection_throughput(self, resource_group): + def test_mongo_db_resources_begin_update_mongo_db_collection_throughput(self, resource_group): response = self.client.mongo_db_resources.begin_update_mongo_db_collection_throughput( resource_group_name=resource_group.name, account_name="str", @@ -266,14 +432,21 @@ def test_begin_update_mongo_db_collection_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -281,13 +454,13 @@ def test_begin_update_mongo_db_collection_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_mongo_db_collection_to_autoscale(self, resource_group): + def test_mongo_db_resources_begin_migrate_mongo_db_collection_to_autoscale(self, resource_group): response = self.client.mongo_db_resources.begin_migrate_mongo_db_collection_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -295,13 +468,13 @@ def test_begin_migrate_mongo_db_collection_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_mongo_db_collection_to_manual_throughput(self, resource_group): + def test_mongo_db_resources_begin_migrate_mongo_db_collection_to_manual_throughput(self, resource_group): response = self.client.mongo_db_resources.begin_migrate_mongo_db_collection_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -309,12 +482,12 @@ def test_begin_migrate_mongo_db_collection_to_manual_throughput(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_role_definition(self, resource_group): + def test_mongo_db_resources_get_mongo_role_definition(self, resource_group): response = self.client.mongo_db_resources.get_mongo_role_definition( mongo_role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -322,7 +495,7 @@ def test_get_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_mongo_role_definition(self, resource_group): + def test_mongo_db_resources_begin_create_update_mongo_role_definition(self, resource_group): response = self.client.mongo_db_resources.begin_create_update_mongo_role_definition( mongo_role_definition_id="str", resource_group_name=resource_group.name, @@ -334,7 +507,7 @@ def test_begin_create_update_mongo_role_definition(self, resource_group): "roles": [{"db": "str", "role": "str"}], "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -342,12 +515,12 @@ def test_begin_create_update_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_mongo_role_definition(self, resource_group): + def test_mongo_db_resources_begin_delete_mongo_role_definition(self, resource_group): response = self.client.mongo_db_resources.begin_delete_mongo_role_definition( mongo_role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -355,11 +528,11 @@ def test_begin_delete_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_mongo_role_definitions(self, resource_group): + def test_mongo_db_resources_list_mongo_role_definitions(self, resource_group): response = self.client.mongo_db_resources.list_mongo_role_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -367,12 +540,12 @@ def test_list_mongo_role_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_mongo_user_definition(self, resource_group): + def test_mongo_db_resources_get_mongo_user_definition(self, resource_group): response = self.client.mongo_db_resources.get_mongo_user_definition( mongo_user_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -380,7 +553,7 @@ def test_get_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_mongo_user_definition(self, resource_group): + def test_mongo_db_resources_begin_create_update_mongo_user_definition(self, resource_group): response = self.client.mongo_db_resources.begin_create_update_mongo_user_definition( mongo_user_definition_id="str", resource_group_name=resource_group.name, @@ -393,7 +566,7 @@ def test_begin_create_update_mongo_user_definition(self, resource_group): "roles": [{"db": "str", "role": "str"}], "userName": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -401,12 +574,12 @@ def test_begin_create_update_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_mongo_user_definition(self, resource_group): + def test_mongo_db_resources_begin_delete_mongo_user_definition(self, resource_group): response = self.client.mongo_db_resources.begin_delete_mongo_user_definition( mongo_user_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -414,11 +587,11 @@ def test_begin_delete_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_mongo_user_definitions(self, resource_group): + def test_mongo_db_resources_list_mongo_user_definitions(self, resource_group): response = self.client.mongo_db_resources.list_mongo_user_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -426,14 +599,14 @@ def test_list_mongo_user_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_retrieve_continuous_backup_information(self, resource_group): + def test_mongo_db_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = self.client.mongo_db_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations_async.py index e48b72f9119b..0cea589b6a70 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_mongo_db_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_mongo_db_databases(self, resource_group): + async def test_mongo_db_resources_list_mongo_db_databases(self, resource_group): response = self.client.mongo_db_resources.list_mongo_db_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_mongo_db_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_db_database(self, resource_group): + async def test_mongo_db_resources_get_mongo_db_database(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_db_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_mongo_db_database(self, resource_group): + async def test_mongo_db_resources_begin_create_update_mongo_db_database(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_create_update_mongo_db_database( resource_group_name=resource_group.name, @@ -63,13 +63,19 @@ async def test_begin_create_update_mongo_db_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,13 +84,13 @@ async def test_begin_create_update_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_mongo_db_database(self, resource_group): + async def test_mongo_db_resources_begin_delete_mongo_db_database(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_delete_mongo_db_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -93,12 +99,12 @@ async def test_begin_delete_mongo_db_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_db_database_throughput(self, resource_group): + async def test_mongo_db_resources_get_mongo_db_database_throughput(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_db_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -106,7 +112,7 @@ async def test_get_mongo_db_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_mongo_db_database_throughput(self, resource_group): + async def test_mongo_db_resources_begin_update_mongo_db_database_throughput(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_update_mongo_db_database_throughput( resource_group_name=resource_group.name, @@ -124,14 +130,21 @@ async def test_begin_update_mongo_db_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -140,13 +153,13 @@ async def test_begin_update_mongo_db_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_mongo_db_database_to_autoscale(self, resource_group): + async def test_mongo_db_resources_begin_migrate_mongo_db_database_to_autoscale(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_migrate_mongo_db_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -155,13 +168,75 @@ async def test_begin_migrate_mongo_db_database_to_autoscale(self, resource_group @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_mongo_db_database_to_manual_throughput(self, resource_group): + async def test_mongo_db_resources_begin_migrate_mongo_db_database_to_manual_throughput(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_migrate_mongo_db_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_begin_mongo_db_database_retrieve_throughput_distribution(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_mongo_db_database_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_begin_mongo_db_database_redistribute_throughput(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_mongo_db_database_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -170,12 +245,76 @@ async def test_begin_migrate_mongo_db_database_to_manual_throughput(self, resour @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_mongo_db_collections(self, resource_group): + async def test_mongo_db_resources_begin_mongo_db_container_retrieve_throughput_distribution(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_mongo_db_container_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_begin_mongo_db_container_redistribute_throughput(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_mongo_db_container_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_list_mongo_db_collections(self, resource_group): response = self.client.mongo_db_resources.list_mongo_db_collections( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -183,13 +322,13 @@ async def test_list_mongo_db_collections(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_db_collection(self, resource_group): + async def test_mongo_db_resources_get_mongo_db_collection(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_db_collection( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -197,7 +336,7 @@ async def test_get_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_mongo_db_collection(self, resource_group): + async def test_mongo_db_resources_begin_create_update_mongo_db_collection(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_create_update_mongo_db_collection( resource_group_name=resource_group.name, @@ -218,13 +357,19 @@ async def test_begin_create_update_mongo_db_collection(self, resource_group): "shardKey": {"str": "str"}, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -233,14 +378,30 @@ async def test_begin_create_update_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_mongo_db_collection(self, resource_group): + async def test_mongo_db_resources_begin_delete_mongo_db_collection(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_delete_mongo_db_collection( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_begin_mongo_db_database_partition_merge(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_mongo_db_database_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -249,13 +410,30 @@ async def test_begin_delete_mongo_db_collection(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_db_collection_throughput(self, resource_group): + async def test_mongo_db_resources_begin_list_mongo_db_collection_partition_merge(self, resource_group): + response = await ( + await self.client.mongo_db_resources.begin_list_mongo_db_collection_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + collection_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_mongo_db_resources_get_mongo_db_collection_throughput(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_db_collection_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -263,7 +441,7 @@ async def test_get_mongo_db_collection_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_mongo_db_collection_throughput(self, resource_group): + async def test_mongo_db_resources_begin_update_mongo_db_collection_throughput(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_update_mongo_db_collection_throughput( resource_group_name=resource_group.name, @@ -282,14 +460,21 @@ async def test_begin_update_mongo_db_collection_throughput(self, resource_group) "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -298,14 +483,14 @@ async def test_begin_update_mongo_db_collection_throughput(self, resource_group) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_mongo_db_collection_to_autoscale(self, resource_group): + async def test_mongo_db_resources_begin_migrate_mongo_db_collection_to_autoscale(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_migrate_mongo_db_collection_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -314,14 +499,14 @@ async def test_begin_migrate_mongo_db_collection_to_autoscale(self, resource_gro @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_mongo_db_collection_to_manual_throughput(self, resource_group): + async def test_mongo_db_resources_begin_migrate_mongo_db_collection_to_manual_throughput(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_migrate_mongo_db_collection_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", collection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -330,12 +515,12 @@ async def test_begin_migrate_mongo_db_collection_to_manual_throughput(self, reso @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_role_definition(self, resource_group): + async def test_mongo_db_resources_get_mongo_role_definition(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_role_definition( mongo_role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -343,7 +528,7 @@ async def test_get_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_mongo_role_definition(self, resource_group): + async def test_mongo_db_resources_begin_create_update_mongo_role_definition(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_create_update_mongo_role_definition( mongo_role_definition_id="str", @@ -356,7 +541,7 @@ async def test_begin_create_update_mongo_role_definition(self, resource_group): "roles": [{"db": "str", "role": "str"}], "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -365,13 +550,13 @@ async def test_begin_create_update_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_mongo_role_definition(self, resource_group): + async def test_mongo_db_resources_begin_delete_mongo_role_definition(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_delete_mongo_role_definition( mongo_role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -380,11 +565,11 @@ async def test_begin_delete_mongo_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_mongo_role_definitions(self, resource_group): + async def test_mongo_db_resources_list_mongo_role_definitions(self, resource_group): response = self.client.mongo_db_resources.list_mongo_role_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -392,12 +577,12 @@ async def test_list_mongo_role_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_mongo_user_definition(self, resource_group): + async def test_mongo_db_resources_get_mongo_user_definition(self, resource_group): response = await self.client.mongo_db_resources.get_mongo_user_definition( mongo_user_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -405,7 +590,7 @@ async def test_get_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_mongo_user_definition(self, resource_group): + async def test_mongo_db_resources_begin_create_update_mongo_user_definition(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_create_update_mongo_user_definition( mongo_user_definition_id="str", @@ -419,7 +604,7 @@ async def test_begin_create_update_mongo_user_definition(self, resource_group): "roles": [{"db": "str", "role": "str"}], "userName": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -428,13 +613,13 @@ async def test_begin_create_update_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_mongo_user_definition(self, resource_group): + async def test_mongo_db_resources_begin_delete_mongo_user_definition(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_delete_mongo_user_definition( mongo_user_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -443,11 +628,11 @@ async def test_begin_delete_mongo_user_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_mongo_user_definitions(self, resource_group): + async def test_mongo_db_resources_list_mongo_user_definitions(self, resource_group): response = self.client.mongo_db_resources.list_mongo_user_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -455,7 +640,7 @@ async def test_list_mongo_user_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_retrieve_continuous_backup_information(self, resource_group): + async def test_mongo_db_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = await ( await self.client.mongo_db_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, @@ -463,7 +648,7 @@ async def test_begin_retrieve_continuous_backup_information(self, resource_group database_name="str", collection_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.py index c95169f69c05..762ceffd3e3d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_network_security_perimeter_configurations_get(self, resource_group): response = self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", network_security_perimeter_configuration_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_reconcile(self, resource_group): + def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", network_security_perimeter_configuration_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py index 44e65e41dc1a..b746902e3d1c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_network_security_perimeter_configurations_get(self, resource_group): response = await self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", network_security_perimeter_configuration_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_reconcile(self, resource_group): + async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = await ( await self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", network_security_perimeter_configuration_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations.py index 3c76bb33a6f1..b3a87cbfb23b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_database_account(self, resource_group): + def test_notebook_workspaces_list_by_database_account(self, resource_group): response = self.client.notebook_workspaces.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_notebook_workspaces_get(self, resource_group): response = self.client.notebook_workspaces.get( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,13 +45,13 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_notebook_workspaces_begin_create_or_update(self, resource_group): response = self.client.notebook_workspaces.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", notebook_create_update_parameters={"id": "str", "name": "str", "type": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -59,12 +59,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_notebook_workspaces_begin_delete(self, resource_group): response = self.client.notebook_workspaces.begin_delete( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -72,12 +72,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_connection_info(self, resource_group): + def test_notebook_workspaces_list_connection_info(self, resource_group): response = self.client.notebook_workspaces.list_connection_info( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -85,12 +85,12 @@ def test_list_connection_info(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_regenerate_auth_token(self, resource_group): + def test_notebook_workspaces_begin_regenerate_auth_token(self, resource_group): response = self.client.notebook_workspaces.begin_regenerate_auth_token( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -98,12 +98,12 @@ def test_begin_regenerate_auth_token(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_start(self, resource_group): + def test_notebook_workspaces_begin_start(self, resource_group): response = self.client.notebook_workspaces.begin_start( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations_async.py index 3e8c9b6ad402..b9156bfbb2a3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_notebook_workspaces_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_database_account(self, resource_group): + async def test_notebook_workspaces_list_by_database_account(self, resource_group): response = self.client.notebook_workspaces.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_notebook_workspaces_get(self, resource_group): response = await self.client.notebook_workspaces.get( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,14 +46,14 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_notebook_workspaces_begin_create_or_update(self, resource_group): response = await ( await self.client.notebook_workspaces.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", notebook_create_update_parameters={"id": "str", "name": "str", "type": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -62,13 +62,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_notebook_workspaces_begin_delete(self, resource_group): response = await ( await self.client.notebook_workspaces.begin_delete( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -77,12 +77,12 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_connection_info(self, resource_group): + async def test_notebook_workspaces_list_connection_info(self, resource_group): response = await self.client.notebook_workspaces.list_connection_info( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -90,13 +90,13 @@ async def test_list_connection_info(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_regenerate_auth_token(self, resource_group): + async def test_notebook_workspaces_begin_regenerate_auth_token(self, resource_group): response = await ( await self.client.notebook_workspaces.begin_regenerate_auth_token( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -105,13 +105,13 @@ async def test_begin_regenerate_auth_token(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_start(self, resource_group): + async def test_notebook_workspaces_begin_start(self, resource_group): response = await ( await self.client.notebook_workspaces.begin_start( resource_group_name=resource_group.name, account_name="str", notebook_workspace_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations.py index 11ffdf2a2eca..363b3e07d527 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations_async.py index 4b3dbe3ab389..bd0894193196 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations.py index a036f2c39db4..8c3b88505f44 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_partition_key_range_id_list_metrics(self, resource_group): response = self.client.partition_key_range_id.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -28,7 +28,7 @@ def test_list_metrics(self, resource_group): collection_rid="str", partition_key_range_id="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations_async.py index 73b0c8afc3f0..3f18ca68819c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_partition_key_range_id_list_metrics(self, resource_group): response = self.client.partition_key_range_id.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -29,7 +29,7 @@ async def test_list_metrics(self, resource_group): collection_rid="str", partition_key_range_id="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations.py index 63b2934382fa..9d405c67f1ae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_partition_key_range_id_region_list_metrics(self, resource_group): response = self.client.partition_key_range_id_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -29,7 +29,7 @@ def test_list_metrics(self, resource_group): collection_rid="str", partition_key_range_id="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations_async.py index 3a4d4deaf297..07ceee0ae667 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_partition_key_range_id_region_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_partition_key_range_id_region_list_metrics(self, resource_group): response = self.client.partition_key_range_id_region.list_metrics( resource_group_name=resource_group.name, account_name="str", @@ -30,7 +30,7 @@ async def test_list_metrics(self, resource_group): collection_rid="str", partition_key_range_id="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations.py index 16c4a1d1b701..02879fa3891d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_percentile_list_metrics(self, resource_group): response = self.client.percentile.list_metrics( resource_group_name=resource_group.name, account_name="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations_async.py index 2663deaaa330..8e1fab53b1ff 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_percentile_list_metrics(self, resource_group): response = self.client.percentile.list_metrics( resource_group_name=resource_group.name, account_name="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations.py index 5c9d5b53c552..4508234b89d3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations.py @@ -20,14 +20,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_percentile_source_target_list_metrics(self, resource_group): response = self.client.percentile_source_target.list_metrics( resource_group_name=resource_group.name, account_name="str", source_region="str", target_region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations_async.py index 4004d022e1ae..eef9986f0bc8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_source_target_operations_async.py @@ -21,14 +21,14 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_percentile_source_target_list_metrics(self, resource_group): response = self.client.percentile_source_target.list_metrics( resource_group_name=resource_group.name, account_name="str", source_region="str", target_region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations.py index b3554e6871f4..d3c794d36f5d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_metrics(self, resource_group): + def test_percentile_target_list_metrics(self, resource_group): response = self.client.percentile_target.list_metrics( resource_group_name=resource_group.name, account_name="str", target_region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations_async.py index f63b873d27af..14a676974ff1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_percentile_target_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_metrics(self, resource_group): + async def test_percentile_target_list_metrics(self, resource_group): response = self.client.percentile_target.list_metrics( resource_group_name=resource_group.name, account_name="str", target_region="str", filter="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations.py index 01c984f96853..e2eb5e42329c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_database_account(self, resource_group): + def test_private_endpoint_connections_list_by_database_account(self, resource_group): response = self.client.private_endpoint_connections.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_private_endpoint_connections_get(self, resource_group): response = self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -57,9 +57,17 @@ def test_begin_create_or_update(self, resource_group): "privateEndpoint": {"id": "str"}, "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -67,12 +75,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations_async.py index 5b0e9088436b..7182b0c2d9fa 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_endpoint_connections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_database_account(self, resource_group): + async def test_private_endpoint_connections_list_by_database_account(self, resource_group): response = self.client.private_endpoint_connections.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_endpoint_connections_get(self, resource_group): response = await self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, @@ -63,9 +63,17 @@ async def test_begin_create_or_update(self, resource_group): "status": "str", }, "provisioningState": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -74,13 +82,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations.py index b7250620192e..45912ca5876e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_database_account(self, resource_group): + def test_private_link_resources_list_by_database_account(self, resource_group): response = self.client.private_link_resources.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_private_link_resources_get(self, resource_group): response = self.client.private_link_resources.get( resource_group_name=resource_group.name, account_name="str", group_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations_async.py index 8c3e4183ef0c..0b790c70a44e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_private_link_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_database_account(self, resource_group): + async def test_private_link_resources_list_by_database_account(self, resource_group): response = self.client.private_link_resources.list_by_database_account( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_by_database_account(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_link_resources_get(self, resource_group): response = await self.client.private_link_resources.get( resource_group_name=resource_group.name, account_name="str", group_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations.py index 4697175f8814..e4f28c3cb1fb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_location(self, resource_group): + def test_restorable_database_accounts_list_by_location(self, resource_group): response = self.client.restorable_database_accounts.list_by_location( location="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -31,9 +31,9 @@ def test_list_by_location(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_database_accounts_list(self, resource_group): response = self.client.restorable_database_accounts.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -41,11 +41,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_by_location(self, resource_group): + def test_restorable_database_accounts_get_by_location(self, resource_group): response = self.client.restorable_database_accounts.get_by_location( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations_async.py index eb81bbca5a26..d26d9e24c8e1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_database_accounts_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_location(self, resource_group): + async def test_restorable_database_accounts_list_by_location(self, resource_group): response = self.client.restorable_database_accounts.list_by_location( location="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -32,9 +32,9 @@ async def test_list_by_location(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_database_accounts_list(self, resource_group): response = self.client.restorable_database_accounts.list( - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -42,11 +42,11 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_by_location(self, resource_group): + async def test_restorable_database_accounts_get_by_location(self, resource_group): response = await self.client.restorable_database_accounts.get_by_location( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations.py index bad0d3c132a4..5290e335f70c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_gremlin_databases_list(self, resource_group): response = self.client.restorable_gremlin_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations_async.py index 71eafe6719ca..467c8788c182 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_databases_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_gremlin_databases_list(self, resource_group): response = self.client.restorable_gremlin_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations.py index db3577a189ae..12fce510beae 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_gremlin_graphs_list(self, resource_group): response = self.client.restorable_gremlin_graphs.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations_async.py index cea6220e264a..2c3190b0b779 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_graphs_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_gremlin_graphs_list(self, resource_group): response = self.client.restorable_gremlin_graphs.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations.py index 03d19c158871..55110a1fd8b8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_gremlin_resources_list(self, resource_group): response = self.client.restorable_gremlin_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations_async.py index 2faf49792fd1..fe862175aa7c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_gremlin_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_gremlin_resources_list(self, resource_group): response = self.client.restorable_gremlin_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations.py index 0d6441113d65..9c696b3cae2b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_mongodb_collections_list(self, resource_group): response = self.client.restorable_mongodb_collections.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations_async.py index ecf5c87f97ef..a7c7c9a12e31 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_collections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_mongodb_collections_list(self, resource_group): response = self.client.restorable_mongodb_collections.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations.py index 0c48acddd267..7ea2d2cf5708 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_mongodb_databases_list(self, resource_group): response = self.client.restorable_mongodb_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations_async.py index 0b79da67be65..4ee2f741f503 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_databases_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_mongodb_databases_list(self, resource_group): response = self.client.restorable_mongodb_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations.py index 6bd94df31f13..d07c3de80a03 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_mongodb_resources_list(self, resource_group): response = self.client.restorable_mongodb_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations_async.py index 326c6a56fed1..9ac06361e857 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_mongodb_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_mongodb_resources_list(self, resource_group): response = self.client.restorable_mongodb_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations.py index 9928046a0aae..4e9ceb6b5d04 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_sql_containers_list(self, resource_group): response = self.client.restorable_sql_containers.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations_async.py index aea8602846bb..96c04670cc85 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_containers_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_sql_containers_list(self, resource_group): response = self.client.restorable_sql_containers.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations.py index d360464ff79c..79dc5b6921dc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_sql_databases_list(self, resource_group): response = self.client.restorable_sql_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations_async.py index efcc1bacc266..aa1baa626414 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_databases_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_sql_databases_list(self, resource_group): response = self.client.restorable_sql_databases.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations.py index 9fef660d2fe1..46040b9fca9e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_sql_resources_list(self, resource_group): response = self.client.restorable_sql_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations_async.py index 7d1222a60f7a..8a5e44c8178f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_sql_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_sql_resources_list(self, resource_group): response = self.client.restorable_sql_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations.py index 3fb0866e2b2f..c245ad711bf2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_table_resources_list(self, resource_group): response = self.client.restorable_table_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations_async.py index 7f8e18b26ff1..25cdc0813a74 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_table_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_table_resources_list(self, resource_group): response = self.client.restorable_table_resources.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations.py index afb637790e23..1701308013ec 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_restorable_tables_list(self, resource_group): response = self.client.restorable_tables.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations_async.py index cf6a44cb4489..e70ac5568888 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_restorable_tables_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_restorable_tables_list(self, resource_group): response = self.client.restorable_tables.list( location="str", instance_id="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations.py index 147c295357f3..0fc86f80fa8e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_service_list(self, resource_group): response = self.client.service.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,13 +32,13 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_service_begin_create(self, resource_group): response = self.client.service.begin_create( resource_group_name=resource_group.name, account_name="str", service_name="str", create_update_parameters={"properties": "service_resource_create_update_properties"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -46,12 +46,12 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_service_get(self, resource_group): response = self.client.service.get( resource_group_name=resource_group.name, account_name="str", service_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -59,12 +59,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_service_begin_delete(self, resource_group): response = self.client.service.begin_delete( resource_group_name=resource_group.name, account_name="str", service_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations_async.py index 1ac03fa8b352..fde5ecb6faa6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_service_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_service_list(self, resource_group): response = self.client.service.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,14 +33,14 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_service_begin_create(self, resource_group): response = await ( await self.client.service.begin_create( resource_group_name=resource_group.name, account_name="str", service_name="str", create_update_parameters={"properties": "service_resource_create_update_properties"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -49,12 +49,12 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_service_get(self, resource_group): response = await self.client.service.get( resource_group_name=resource_group.name, account_name="str", service_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -62,13 +62,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_service_begin_delete(self, resource_group): response = await ( await self.client.service.begin_delete( resource_group_name=resource_group.name, account_name="str", service_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations.py index da9f7f63ae05..7488e7904d72 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_databases(self, resource_group): + def test_sql_resources_list_sql_databases(self, resource_group): response = self.client.sql_resources.list_sql_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_sql_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_database(self, resource_group): + def test_sql_resources_get_sql_database(self, resource_group): response = self.client.sql_resources.get_sql_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_database(self, resource_group): + def test_sql_resources_begin_create_update_sql_database(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_database( resource_group_name=resource_group.name, account_name="str", @@ -61,13 +61,19 @@ def test_begin_create_update_sql_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,12 +81,12 @@ def test_begin_create_update_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_database(self, resource_group): + def test_sql_resources_begin_delete_sql_database(self, resource_group): response = self.client.sql_resources.begin_delete_sql_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,12 +94,12 @@ def test_begin_delete_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_database_throughput(self, resource_group): + def test_sql_resources_get_sql_database_throughput(self, resource_group): response = self.client.sql_resources.get_sql_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -101,7 +107,7 @@ def test_get_sql_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_sql_database_throughput(self, resource_group): + def test_sql_resources_begin_update_sql_database_throughput(self, resource_group): response = self.client.sql_resources.begin_update_sql_database_throughput( resource_group_name=resource_group.name, account_name="str", @@ -118,14 +124,21 @@ def test_begin_update_sql_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -133,12 +146,12 @@ def test_begin_update_sql_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_sql_database_to_autoscale(self, resource_group): + def test_sql_resources_begin_migrate_sql_database_to_autoscale(self, resource_group): response = self.client.sql_resources.begin_migrate_sql_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -146,12 +159,61 @@ def test_begin_migrate_sql_database_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_sql_database_to_manual_throughput(self, resource_group): + def test_sql_resources_begin_migrate_sql_database_to_manual_throughput(self, resource_group): response = self.client.sql_resources.begin_migrate_sql_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_list_client_encryption_keys(self, resource_group): + response = self.client.sql_resources.list_client_encryption_keys( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_get_client_encryption_key(self, resource_group): + response = self.client.sql_resources.get_client_encryption_key( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + client_encryption_key_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_begin_create_update_client_encryption_key(self, resource_group): + response = self.client.sql_resources.begin_create_update_client_encryption_key( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + client_encryption_key_name="str", + create_update_client_encryption_key_parameters={ + "resource": { + "encryptionAlgorithm": "str", + "id": "str", + "keyWrapMetadata": {"algorithm": "str", "name": "str", "type": "str", "value": "str"}, + "wrappedDataEncryptionKey": bytes("bytes", encoding="utf-8"), + } + }, + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -159,12 +221,12 @@ def test_begin_migrate_sql_database_to_manual_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_containers(self, resource_group): + def test_sql_resources_list_sql_containers(self, resource_group): response = self.client.sql_resources.list_sql_containers( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -172,13 +234,13 @@ def test_list_sql_containers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_container(self, resource_group): + def test_sql_resources_get_sql_container(self, resource_group): response = self.client.sql_resources.get_sql_container( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -186,7 +248,7 @@ def test_get_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_container(self, resource_group): + def test_sql_resources_begin_create_update_sql_container(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_container( resource_group_name=resource_group.name, account_name="str", @@ -226,6 +288,11 @@ def test_begin_create_update_sql_container(self, resource_group): "spatialIndexes": [{"path": "str", "types": ["str"]}], "vectorIndexes": [{"path": "str", "type": "str"}], }, + "materializedViewDefinition": { + "definition": "str", + "sourceCollectionId": "str", + "sourceCollectionRid": "str", + }, "partitionKey": {"kind": "Hash", "paths": ["str"], "systemKey": bool, "version": 0}, "restoreParameters": { "restoreSource": "str", @@ -240,13 +307,19 @@ def test_begin_create_update_sql_container(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -254,13 +327,13 @@ def test_begin_create_update_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_container(self, resource_group): + def test_sql_resources_begin_delete_sql_container(self, resource_group): response = self.client.sql_resources.begin_delete_sql_container( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -268,13 +341,42 @@ def test_begin_delete_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_container_throughput(self, resource_group): + def test_sql_resources_begin_sql_database_partition_merge(self, resource_group): + response = self.client.sql_resources.begin_sql_database_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_begin_list_sql_container_partition_merge(self, resource_group): + response = self.client.sql_resources.begin_list_sql_container_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + container_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_get_sql_container_throughput(self, resource_group): response = self.client.sql_resources.get_sql_container_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -282,7 +384,7 @@ def test_get_sql_container_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_sql_container_throughput(self, resource_group): + def test_sql_resources_begin_update_sql_container_throughput(self, resource_group): response = self.client.sql_resources.begin_update_sql_container_throughput( resource_group_name=resource_group.name, account_name="str", @@ -300,14 +402,21 @@ def test_begin_update_sql_container_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -315,13 +424,13 @@ def test_begin_update_sql_container_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_sql_container_to_autoscale(self, resource_group): + def test_sql_resources_begin_migrate_sql_container_to_autoscale(self, resource_group): response = self.client.sql_resources.begin_migrate_sql_container_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -329,13 +438,13 @@ def test_begin_migrate_sql_container_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_sql_container_to_manual_throughput(self, resource_group): + def test_sql_resources_begin_migrate_sql_container_to_manual_throughput(self, resource_group): response = self.client.sql_resources.begin_migrate_sql_container_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -343,48 +452,117 @@ def test_begin_migrate_sql_container_to_manual_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_client_encryption_keys(self, resource_group): - response = self.client.sql_resources.list_client_encryption_keys( + def test_sql_resources_begin_sql_database_retrieve_throughput_distribution(self, resource_group): + response = self.client.sql_resources.begin_sql_database_retrieve_throughput_distribution( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", - ) - result = [r for r in response] + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_client_encryption_key(self, resource_group): - response = self.client.sql_resources.get_client_encryption_key( + def test_sql_resources_begin_sql_database_redistribute_throughput(self, resource_group): + response = self.client.sql_resources.begin_sql_database_redistribute_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - client_encryption_key_name="str", - api_version="2024-11-15", - ) + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_client_encryption_key(self, resource_group): - response = self.client.sql_resources.begin_create_update_client_encryption_key( + def test_sql_resources_begin_sql_container_retrieve_throughput_distribution(self, resource_group): + response = self.client.sql_resources.begin_sql_container_retrieve_throughput_distribution( resource_group_name=resource_group.name, account_name="str", database_name="str", - client_encryption_key_name="str", - create_update_client_encryption_key_parameters={ + container_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_sql_resources_begin_sql_container_redistribute_throughput(self, resource_group): + response = self.client.sql_resources.begin_sql_container_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + container_name="str", + redistribute_throughput_parameters={ "resource": { - "encryptionAlgorithm": "str", - "id": "str", - "keyWrapMetadata": {"algorithm": "str", "name": "str", "type": "str", "value": "str"}, - "wrappedDataEncryptionKey": bytes("bytes", encoding="utf-8"), - } + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -392,13 +570,13 @@ def test_begin_create_update_client_encryption_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_stored_procedures(self, resource_group): + def test_sql_resources_list_sql_stored_procedures(self, resource_group): response = self.client.sql_resources.list_sql_stored_procedures( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -406,14 +584,14 @@ def test_list_sql_stored_procedures(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_stored_procedure(self, resource_group): + def test_sql_resources_get_sql_stored_procedure(self, resource_group): response = self.client.sql_resources.get_sql_stored_procedure( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", stored_procedure_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -421,7 +599,7 @@ def test_get_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_stored_procedure(self, resource_group): + def test_sql_resources_begin_create_update_sql_stored_procedure(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_stored_procedure( resource_group_name=resource_group.name, account_name="str", @@ -431,13 +609,19 @@ def test_begin_create_update_sql_stored_procedure(self, resource_group): create_update_sql_stored_procedure_parameters={ "resource": {"id": "str", "body": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -445,14 +629,14 @@ def test_begin_create_update_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_stored_procedure(self, resource_group): + def test_sql_resources_begin_delete_sql_stored_procedure(self, resource_group): response = self.client.sql_resources.begin_delete_sql_stored_procedure( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", stored_procedure_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -460,13 +644,13 @@ def test_begin_delete_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_user_defined_functions(self, resource_group): + def test_sql_resources_list_sql_user_defined_functions(self, resource_group): response = self.client.sql_resources.list_sql_user_defined_functions( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -474,14 +658,14 @@ def test_list_sql_user_defined_functions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_user_defined_function(self, resource_group): + def test_sql_resources_get_sql_user_defined_function(self, resource_group): response = self.client.sql_resources.get_sql_user_defined_function( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", user_defined_function_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -489,7 +673,7 @@ def test_get_sql_user_defined_function(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_user_defined_function(self, resource_group): + def test_sql_resources_begin_create_update_sql_user_defined_function(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_user_defined_function( resource_group_name=resource_group.name, account_name="str", @@ -499,13 +683,19 @@ def test_begin_create_update_sql_user_defined_function(self, resource_group): create_update_sql_user_defined_function_parameters={ "resource": {"id": "str", "body": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -513,14 +703,14 @@ def test_begin_create_update_sql_user_defined_function(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_user_defined_function(self, resource_group): + def test_sql_resources_begin_delete_sql_user_defined_function(self, resource_group): response = self.client.sql_resources.begin_delete_sql_user_defined_function( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", user_defined_function_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -528,13 +718,13 @@ def test_begin_delete_sql_user_defined_function(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_triggers(self, resource_group): + def test_sql_resources_list_sql_triggers(self, resource_group): response = self.client.sql_resources.list_sql_triggers( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -542,14 +732,14 @@ def test_list_sql_triggers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_trigger(self, resource_group): + def test_sql_resources_get_sql_trigger(self, resource_group): response = self.client.sql_resources.get_sql_trigger( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", trigger_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -557,7 +747,7 @@ def test_get_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_trigger(self, resource_group): + def test_sql_resources_begin_create_update_sql_trigger(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_trigger( resource_group_name=resource_group.name, account_name="str", @@ -567,13 +757,19 @@ def test_begin_create_update_sql_trigger(self, resource_group): create_update_sql_trigger_parameters={ "resource": {"id": "str", "body": "str", "triggerOperation": "str", "triggerType": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -581,14 +777,14 @@ def test_begin_create_update_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_trigger(self, resource_group): + def test_sql_resources_begin_delete_sql_trigger(self, resource_group): response = self.client.sql_resources.begin_delete_sql_trigger( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", trigger_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -596,12 +792,12 @@ def test_begin_delete_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_role_definition(self, resource_group): + def test_sql_resources_get_sql_role_definition(self, resource_group): response = self.client.sql_resources.get_sql_role_definition( role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -609,7 +805,7 @@ def test_get_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_role_definition(self, resource_group): + def test_sql_resources_begin_create_update_sql_role_definition(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_role_definition( role_definition_id="str", resource_group_name=resource_group.name, @@ -620,7 +816,7 @@ def test_begin_create_update_sql_role_definition(self, resource_group): "roleName": "str", "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -628,12 +824,12 @@ def test_begin_create_update_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_role_definition(self, resource_group): + def test_sql_resources_begin_delete_sql_role_definition(self, resource_group): response = self.client.sql_resources.begin_delete_sql_role_definition( role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -641,11 +837,11 @@ def test_begin_delete_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_role_definitions(self, resource_group): + def test_sql_resources_list_sql_role_definitions(self, resource_group): response = self.client.sql_resources.list_sql_role_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -653,12 +849,12 @@ def test_list_sql_role_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_sql_role_assignment(self, resource_group): + def test_sql_resources_get_sql_role_assignment(self, resource_group): response = self.client.sql_resources.get_sql_role_assignment( role_assignment_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -666,7 +862,7 @@ def test_get_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_sql_role_assignment(self, resource_group): + def test_sql_resources_begin_create_update_sql_role_assignment(self, resource_group): response = self.client.sql_resources.begin_create_update_sql_role_assignment( role_assignment_id="str", resource_group_name=resource_group.name, @@ -676,7 +872,7 @@ def test_begin_create_update_sql_role_assignment(self, resource_group): "roleDefinitionId": "str", "scope": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -684,12 +880,12 @@ def test_begin_create_update_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_sql_role_assignment(self, resource_group): + def test_sql_resources_begin_delete_sql_role_assignment(self, resource_group): response = self.client.sql_resources.begin_delete_sql_role_assignment( role_assignment_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -697,11 +893,11 @@ def test_begin_delete_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_sql_role_assignments(self, resource_group): + def test_sql_resources_list_sql_role_assignments(self, resource_group): response = self.client.sql_resources.list_sql_role_assignments( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -709,14 +905,14 @@ def test_list_sql_role_assignments(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_retrieve_continuous_backup_information(self, resource_group): + def test_sql_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = self.client.sql_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations_async.py index 3e809eba654a..158028d4ee1f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_databases(self, resource_group): + async def test_sql_resources_list_sql_databases(self, resource_group): response = self.client.sql_resources.list_sql_databases( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_sql_databases(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_database(self, resource_group): + async def test_sql_resources_get_sql_database(self, resource_group): response = await self.client.sql_resources.get_sql_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_database(self, resource_group): + async def test_sql_resources_begin_create_update_sql_database(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_database( resource_group_name=resource_group.name, @@ -63,13 +63,19 @@ async def test_begin_create_update_sql_database(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,13 +84,13 @@ async def test_begin_create_update_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_database(self, resource_group): + async def test_sql_resources_begin_delete_sql_database(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_database( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -93,12 +99,12 @@ async def test_begin_delete_sql_database(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_database_throughput(self, resource_group): + async def test_sql_resources_get_sql_database_throughput(self, resource_group): response = await self.client.sql_resources.get_sql_database_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -106,7 +112,7 @@ async def test_get_sql_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_sql_database_throughput(self, resource_group): + async def test_sql_resources_begin_update_sql_database_throughput(self, resource_group): response = await ( await self.client.sql_resources.begin_update_sql_database_throughput( resource_group_name=resource_group.name, @@ -124,14 +130,21 @@ async def test_begin_update_sql_database_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -140,13 +153,13 @@ async def test_begin_update_sql_database_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_sql_database_to_autoscale(self, resource_group): + async def test_sql_resources_begin_migrate_sql_database_to_autoscale(self, resource_group): response = await ( await self.client.sql_resources.begin_migrate_sql_database_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -155,13 +168,64 @@ async def test_begin_migrate_sql_database_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_sql_database_to_manual_throughput(self, resource_group): + async def test_sql_resources_begin_migrate_sql_database_to_manual_throughput(self, resource_group): response = await ( await self.client.sql_resources.begin_migrate_sql_database_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_list_client_encryption_keys(self, resource_group): + response = self.client.sql_resources.list_client_encryption_keys( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_get_client_encryption_key(self, resource_group): + response = await self.client.sql_resources.get_client_encryption_key( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + client_encryption_key_name="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_begin_create_update_client_encryption_key(self, resource_group): + response = await ( + await self.client.sql_resources.begin_create_update_client_encryption_key( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + client_encryption_key_name="str", + create_update_client_encryption_key_parameters={ + "resource": { + "encryptionAlgorithm": "str", + "id": "str", + "keyWrapMetadata": {"algorithm": "str", "name": "str", "type": "str", "value": "str"}, + "wrappedDataEncryptionKey": bytes("bytes", encoding="utf-8"), + } + }, + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -170,12 +234,12 @@ async def test_begin_migrate_sql_database_to_manual_throughput(self, resource_gr @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_containers(self, resource_group): + async def test_sql_resources_list_sql_containers(self, resource_group): response = self.client.sql_resources.list_sql_containers( resource_group_name=resource_group.name, account_name="str", database_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -183,13 +247,13 @@ async def test_list_sql_containers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_container(self, resource_group): + async def test_sql_resources_get_sql_container(self, resource_group): response = await self.client.sql_resources.get_sql_container( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -197,7 +261,7 @@ async def test_get_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_container(self, resource_group): + async def test_sql_resources_begin_create_update_sql_container(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_container( resource_group_name=resource_group.name, @@ -238,6 +302,11 @@ async def test_begin_create_update_sql_container(self, resource_group): "spatialIndexes": [{"path": "str", "types": ["str"]}], "vectorIndexes": [{"path": "str", "type": "str"}], }, + "materializedViewDefinition": { + "definition": "str", + "sourceCollectionId": "str", + "sourceCollectionRid": "str", + }, "partitionKey": {"kind": "Hash", "paths": ["str"], "systemKey": bool, "version": 0}, "restoreParameters": { "restoreSource": "str", @@ -252,13 +321,19 @@ async def test_begin_create_update_sql_container(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -267,14 +342,14 @@ async def test_begin_create_update_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_container(self, resource_group): + async def test_sql_resources_begin_delete_sql_container(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_container( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -283,13 +358,46 @@ async def test_begin_delete_sql_container(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_container_throughput(self, resource_group): + async def test_sql_resources_begin_sql_database_partition_merge(self, resource_group): + response = await ( + await self.client.sql_resources.begin_sql_database_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_begin_list_sql_container_partition_merge(self, resource_group): + response = await ( + await self.client.sql_resources.begin_list_sql_container_partition_merge( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + container_name="str", + merge_parameters={"isDryRun": bool}, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_get_sql_container_throughput(self, resource_group): response = await self.client.sql_resources.get_sql_container_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -297,7 +405,7 @@ async def test_get_sql_container_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_sql_container_throughput(self, resource_group): + async def test_sql_resources_begin_update_sql_container_throughput(self, resource_group): response = await ( await self.client.sql_resources.begin_update_sql_container_throughput( resource_group_name=resource_group.name, @@ -316,14 +424,21 @@ async def test_begin_update_sql_container_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -332,14 +447,14 @@ async def test_begin_update_sql_container_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_sql_container_to_autoscale(self, resource_group): + async def test_sql_resources_begin_migrate_sql_container_to_autoscale(self, resource_group): response = await ( await self.client.sql_resources.begin_migrate_sql_container_to_autoscale( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -348,14 +463,14 @@ async def test_begin_migrate_sql_container_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_sql_container_to_manual_throughput(self, resource_group): + async def test_sql_resources_begin_migrate_sql_container_to_manual_throughput(self, resource_group): response = await ( await self.client.sql_resources.begin_migrate_sql_container_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -364,49 +479,124 @@ async def test_begin_migrate_sql_container_to_manual_throughput(self, resource_g @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_client_encryption_keys(self, resource_group): - response = self.client.sql_resources.list_client_encryption_keys( - resource_group_name=resource_group.name, - account_name="str", - database_name="str", - api_version="2024-11-15", - ) - result = [r async for r in response] + async def test_sql_resources_begin_sql_database_retrieve_throughput_distribution(self, resource_group): + response = await ( + await self.client.sql_resources.begin_sql_database_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_client_encryption_key(self, resource_group): - response = await self.client.sql_resources.get_client_encryption_key( - resource_group_name=resource_group.name, - account_name="str", - database_name="str", - client_encryption_key_name="str", - api_version="2024-11-15", - ) + async def test_sql_resources_begin_sql_database_redistribute_throughput(self, resource_group): + response = await ( + await self.client.sql_resources.begin_sql_database_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + redistribute_throughput_parameters={ + "resource": { + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_client_encryption_key(self, resource_group): + async def test_sql_resources_begin_sql_container_retrieve_throughput_distribution(self, resource_group): response = await ( - await self.client.sql_resources.begin_create_update_client_encryption_key( + await self.client.sql_resources.begin_sql_container_retrieve_throughput_distribution( resource_group_name=resource_group.name, account_name="str", database_name="str", - client_encryption_key_name="str", - create_update_client_encryption_key_parameters={ + container_name="str", + retrieve_throughput_parameters={ + "resource": {"physicalPartitionIds": [{"id": "str"}]}, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_begin_sql_container_redistribute_throughput(self, resource_group): + response = await ( + await self.client.sql_resources.begin_sql_container_redistribute_throughput( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + container_name="str", + redistribute_throughput_parameters={ "resource": { - "encryptionAlgorithm": "str", - "id": "str", - "keyWrapMetadata": {"algorithm": "str", "name": "str", "type": "str", "value": "str"}, - "wrappedDataEncryptionKey": bytes("bytes", encoding="utf-8"), - } + "sourcePhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "targetPhysicalPartitionThroughputInfo": [{"id": "str", "throughput": 0.0}], + "throughputPolicy": "str", + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -415,13 +605,13 @@ async def test_begin_create_update_client_encryption_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_stored_procedures(self, resource_group): + async def test_sql_resources_list_sql_stored_procedures(self, resource_group): response = self.client.sql_resources.list_sql_stored_procedures( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -429,14 +619,14 @@ async def test_list_sql_stored_procedures(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_stored_procedure(self, resource_group): + async def test_sql_resources_get_sql_stored_procedure(self, resource_group): response = await self.client.sql_resources.get_sql_stored_procedure( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", stored_procedure_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -444,7 +634,7 @@ async def test_get_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_stored_procedure(self, resource_group): + async def test_sql_resources_begin_create_update_sql_stored_procedure(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_stored_procedure( resource_group_name=resource_group.name, @@ -455,13 +645,19 @@ async def test_begin_create_update_sql_stored_procedure(self, resource_group): create_update_sql_stored_procedure_parameters={ "resource": {"id": "str", "body": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -470,7 +666,7 @@ async def test_begin_create_update_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_stored_procedure(self, resource_group): + async def test_sql_resources_begin_delete_sql_stored_procedure(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_stored_procedure( resource_group_name=resource_group.name, @@ -478,7 +674,7 @@ async def test_begin_delete_sql_stored_procedure(self, resource_group): database_name="str", container_name="str", stored_procedure_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -487,13 +683,13 @@ async def test_begin_delete_sql_stored_procedure(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_user_defined_functions(self, resource_group): + async def test_sql_resources_list_sql_user_defined_functions(self, resource_group): response = self.client.sql_resources.list_sql_user_defined_functions( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -501,14 +697,14 @@ async def test_list_sql_user_defined_functions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_user_defined_function(self, resource_group): + async def test_sql_resources_get_sql_user_defined_function(self, resource_group): response = await self.client.sql_resources.get_sql_user_defined_function( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", user_defined_function_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -516,7 +712,7 @@ async def test_get_sql_user_defined_function(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_user_defined_function(self, resource_group): + async def test_sql_resources_begin_create_update_sql_user_defined_function(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_user_defined_function( resource_group_name=resource_group.name, @@ -527,13 +723,19 @@ async def test_begin_create_update_sql_user_defined_function(self, resource_grou create_update_sql_user_defined_function_parameters={ "resource": {"id": "str", "body": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -542,7 +744,7 @@ async def test_begin_create_update_sql_user_defined_function(self, resource_grou @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_user_defined_function(self, resource_group): + async def test_sql_resources_begin_delete_sql_user_defined_function(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_user_defined_function( resource_group_name=resource_group.name, @@ -550,7 +752,7 @@ async def test_begin_delete_sql_user_defined_function(self, resource_group): database_name="str", container_name="str", user_defined_function_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -559,13 +761,13 @@ async def test_begin_delete_sql_user_defined_function(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_triggers(self, resource_group): + async def test_sql_resources_list_sql_triggers(self, resource_group): response = self.client.sql_resources.list_sql_triggers( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -573,14 +775,14 @@ async def test_list_sql_triggers(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_trigger(self, resource_group): + async def test_sql_resources_get_sql_trigger(self, resource_group): response = await self.client.sql_resources.get_sql_trigger( resource_group_name=resource_group.name, account_name="str", database_name="str", container_name="str", trigger_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -588,7 +790,7 @@ async def test_get_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_trigger(self, resource_group): + async def test_sql_resources_begin_create_update_sql_trigger(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_trigger( resource_group_name=resource_group.name, @@ -599,13 +801,19 @@ async def test_begin_create_update_sql_trigger(self, resource_group): create_update_sql_trigger_parameters={ "resource": {"id": "str", "body": "str", "triggerOperation": "str", "triggerType": "str"}, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -614,7 +822,7 @@ async def test_begin_create_update_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_trigger(self, resource_group): + async def test_sql_resources_begin_delete_sql_trigger(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_trigger( resource_group_name=resource_group.name, @@ -622,7 +830,7 @@ async def test_begin_delete_sql_trigger(self, resource_group): database_name="str", container_name="str", trigger_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -631,12 +839,12 @@ async def test_begin_delete_sql_trigger(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_role_definition(self, resource_group): + async def test_sql_resources_get_sql_role_definition(self, resource_group): response = await self.client.sql_resources.get_sql_role_definition( role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -644,7 +852,7 @@ async def test_get_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_role_definition(self, resource_group): + async def test_sql_resources_begin_create_update_sql_role_definition(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_role_definition( role_definition_id="str", @@ -656,7 +864,7 @@ async def test_begin_create_update_sql_role_definition(self, resource_group): "roleName": "str", "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -665,13 +873,13 @@ async def test_begin_create_update_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_role_definition(self, resource_group): + async def test_sql_resources_begin_delete_sql_role_definition(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_role_definition( role_definition_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -680,11 +888,11 @@ async def test_begin_delete_sql_role_definition(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_role_definitions(self, resource_group): + async def test_sql_resources_list_sql_role_definitions(self, resource_group): response = self.client.sql_resources.list_sql_role_definitions( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -692,12 +900,12 @@ async def test_list_sql_role_definitions(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_sql_role_assignment(self, resource_group): + async def test_sql_resources_get_sql_role_assignment(self, resource_group): response = await self.client.sql_resources.get_sql_role_assignment( role_assignment_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -705,7 +913,7 @@ async def test_get_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_sql_role_assignment(self, resource_group): + async def test_sql_resources_begin_create_update_sql_role_assignment(self, resource_group): response = await ( await self.client.sql_resources.begin_create_update_sql_role_assignment( role_assignment_id="str", @@ -716,7 +924,7 @@ async def test_begin_create_update_sql_role_assignment(self, resource_group): "roleDefinitionId": "str", "scope": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -725,13 +933,13 @@ async def test_begin_create_update_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_sql_role_assignment(self, resource_group): + async def test_sql_resources_begin_delete_sql_role_assignment(self, resource_group): response = await ( await self.client.sql_resources.begin_delete_sql_role_assignment( role_assignment_id="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -740,11 +948,11 @@ async def test_begin_delete_sql_role_assignment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_sql_role_assignments(self, resource_group): + async def test_sql_resources_list_sql_role_assignments(self, resource_group): response = self.client.sql_resources.list_sql_role_assignments( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -752,7 +960,7 @@ async def test_list_sql_role_assignments(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_retrieve_continuous_backup_information(self, resource_group): + async def test_sql_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = await ( await self.client.sql_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, @@ -760,7 +968,7 @@ async def test_begin_retrieve_continuous_backup_information(self, resource_group database_name="str", container_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations.py index ca16471d9ad3..10958ac2998e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_tables(self, resource_group): + def test_table_resources_list_tables(self, resource_group): response = self.client.table_resources.list_tables( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list_tables(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_table(self, resource_group): + def test_table_resources_get_table(self, resource_group): response = self.client.table_resources.get_table( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_update_table(self, resource_group): + def test_table_resources_begin_create_update_table(self, resource_group): response = self.client.table_resources.begin_create_update_table( resource_group_name=resource_group.name, account_name="str", @@ -61,13 +61,19 @@ def test_begin_create_update_table(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -75,12 +81,12 @@ def test_begin_create_update_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_table(self, resource_group): + def test_table_resources_begin_delete_table(self, resource_group): response = self.client.table_resources.begin_delete_table( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,12 +94,12 @@ def test_begin_delete_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_table_throughput(self, resource_group): + def test_table_resources_get_table_throughput(self, resource_group): response = self.client.table_resources.get_table_throughput( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -101,7 +107,7 @@ def test_get_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_table_throughput(self, resource_group): + def test_table_resources_begin_update_table_throughput(self, resource_group): response = self.client.table_resources.begin_update_table_throughput( resource_group_name=resource_group.name, account_name="str", @@ -118,14 +124,21 @@ def test_begin_update_table_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -133,12 +146,12 @@ def test_begin_update_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_table_to_autoscale(self, resource_group): + def test_table_resources_begin_migrate_table_to_autoscale(self, resource_group): response = self.client.table_resources.begin_migrate_table_to_autoscale( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -146,12 +159,12 @@ def test_begin_migrate_table_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_migrate_table_to_manual_throughput(self, resource_group): + def test_table_resources_begin_migrate_table_to_manual_throughput(self, resource_group): response = self.client.table_resources.begin_migrate_table_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -159,14 +172,149 @@ def test_begin_migrate_table_to_manual_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_retrieve_continuous_backup_information(self, resource_group): + def test_table_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = self.client.table_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, account_name="str", table_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_get_table_role_definition(self, resource_group): + response = self.client.table_resources.get_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_begin_create_update_table_role_definition(self, resource_group): + response = self.client.table_resources.begin_create_update_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + create_update_table_role_definition_parameters={ + "assignableScopes": ["str"], + "id": "str", + "name": "str", + "permissions": [{"dataActions": ["str"], "id": "str", "notDataActions": ["str"]}], + "roleName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_begin_delete_table_role_definition(self, resource_group): + response = self.client.table_resources.begin_delete_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_list_table_role_definitions(self, resource_group): + response = self.client.table_resources.list_table_role_definitions( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_get_table_role_assignment(self, resource_group): + response = self.client.table_resources.get_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_begin_create_update_table_role_assignment(self, resource_group): + response = self.client.table_resources.begin_create_update_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + create_update_table_role_assignment_parameters={ + "id": "str", + "name": "str", + "principalId": "str", + "provisioningState": "str", + "roleDefinitionId": "str", + "scope": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_begin_delete_table_role_assignment(self, resource_group): + response = self.client.table_resources.begin_delete_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + api_version="2024-12-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_table_resources_list_table_role_assignments(self, resource_group): + response = self.client.table_resources.list_table_role_assignments( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-12-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations_async.py index 04678872661b..dc6e0fd058bb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_table_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_tables(self, resource_group): + async def test_table_resources_list_tables(self, resource_group): response = self.client.table_resources.list_tables( resource_group_name=resource_group.name, account_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list_tables(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_table(self, resource_group): + async def test_table_resources_get_table(self, resource_group): response = await self.client.table_resources.get_table( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_update_table(self, resource_group): + async def test_table_resources_begin_create_update_table(self, resource_group): response = await ( await self.client.table_resources.begin_create_update_table( resource_group_name=resource_group.name, @@ -63,13 +63,19 @@ async def test_begin_create_update_table(self, resource_group): }, }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 0}, "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,13 +84,13 @@ async def test_begin_create_update_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_table(self, resource_group): + async def test_table_resources_begin_delete_table(self, resource_group): response = await ( await self.client.table_resources.begin_delete_table( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -93,12 +99,12 @@ async def test_begin_delete_table(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_table_throughput(self, resource_group): + async def test_table_resources_get_table_throughput(self, resource_group): response = await self.client.table_resources.get_table_throughput( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -106,7 +112,7 @@ async def test_get_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_table_throughput(self, resource_group): + async def test_table_resources_begin_update_table_throughput(self, resource_group): response = await ( await self.client.table_resources.begin_update_table_throughput( resource_group_name=resource_group.name, @@ -124,14 +130,21 @@ async def test_begin_update_table_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0}], }, "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "location": "str", "name": "str", "tags": {"str": "str"}, "type": "str", }, - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -140,13 +153,13 @@ async def test_begin_update_table_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_table_to_autoscale(self, resource_group): + async def test_table_resources_begin_migrate_table_to_autoscale(self, resource_group): response = await ( await self.client.table_resources.begin_migrate_table_to_autoscale( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -155,13 +168,13 @@ async def test_begin_migrate_table_to_autoscale(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_migrate_table_to_manual_throughput(self, resource_group): + async def test_table_resources_begin_migrate_table_to_manual_throughput(self, resource_group): response = await ( await self.client.table_resources.begin_migrate_table_to_manual_throughput( resource_group_name=resource_group.name, account_name="str", table_name="str", - api_version="2024-11-15", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -170,16 +183,159 @@ async def test_begin_migrate_table_to_manual_throughput(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_retrieve_continuous_backup_information(self, resource_group): + async def test_table_resources_begin_retrieve_continuous_backup_information(self, resource_group): response = await ( await self.client.table_resources.begin_retrieve_continuous_backup_information( resource_group_name=resource_group.name, account_name="str", table_name="str", location={"location": "str"}, - api_version="2024-11-15", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_get_table_role_definition(self, resource_group): + response = await self.client.table_resources.get_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_begin_create_update_table_role_definition(self, resource_group): + response = await ( + await self.client.table_resources.begin_create_update_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + create_update_table_role_definition_parameters={ + "assignableScopes": ["str"], + "id": "str", + "name": "str", + "permissions": [{"dataActions": ["str"], "id": "str", "notDataActions": ["str"]}], + "roleName": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_begin_delete_table_role_definition(self, resource_group): + response = await ( + await self.client.table_resources.begin_delete_table_role_definition( + resource_group_name=resource_group.name, + account_name="str", + role_definition_id="str", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_list_table_role_definitions(self, resource_group): + response = self.client.table_resources.list_table_role_definitions( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_get_table_role_assignment(self, resource_group): + response = await self.client.table_resources.get_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + api_version="2024-12-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_begin_create_update_table_role_assignment(self, resource_group): + response = await ( + await self.client.table_resources.begin_create_update_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + create_update_table_role_assignment_parameters={ + "id": "str", + "name": "str", + "principalId": "str", + "provisioningState": "str", + "roleDefinitionId": "str", + "scope": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_begin_delete_table_role_assignment(self, resource_group): + response = await ( + await self.client.table_resources.begin_delete_table_role_assignment( + resource_group_name=resource_group.name, + account_name="str", + role_assignment_id="str", + api_version="2024-12-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_table_resources_list_table_role_assignments(self, resource_group): + response = self.client.table_resources.list_table_role_assignments( + resource_group_name=resource_group.name, + account_name="str", + api_version="2024-12-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py index 9b7f006a611d..61ae26555145 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_throughput_pool_account_get(self, resource_group): response = self.client.throughput_pool_account.get( resource_group_name=resource_group.name, throughput_pool_name="str", throughput_pool_account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_throughput_pool_account_begin_create(self, resource_group): response = self.client.throughput_pool_account.begin_create( resource_group_name=resource_group.name, throughput_pool_name="str", @@ -55,7 +55,7 @@ def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -63,12 +63,12 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_throughput_pool_account_begin_delete(self, resource_group): response = self.client.throughput_pool_account.begin_delete( resource_group_name=resource_group.name, throughput_pool_name="str", throughput_pool_account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py index 1a285eb09eb1..3da26cbed61a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_throughput_pool_account_get(self, resource_group): response = await self.client.throughput_pool_account.get( resource_group_name=resource_group.name, throughput_pool_name="str", throughput_pool_account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_throughput_pool_account_begin_create(self, resource_group): response = await ( await self.client.throughput_pool_account.begin_create( resource_group_name=resource_group.name, @@ -57,7 +57,7 @@ async def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -66,13 +66,13 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_throughput_pool_account_begin_delete(self, resource_group): response = await ( await self.client.throughput_pool_account.begin_delete( resource_group_name=resource_group.name, throughput_pool_name="str", throughput_pool_account_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py index e8c705b89156..c987badcfd3a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_throughput_pool_accounts_list(self, resource_group): response = self.client.throughput_pool_accounts.list( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py index 5a65ca9c6f34..0fd2b23fb2e0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_throughput_pool_accounts_list(self, resource_group): response = self.client.throughput_pool_accounts.list( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py index baadaa802c40..ad01419f07c6 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_throughput_pool_get(self, resource_group): response = self.client.throughput_pool.get( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -32,7 +32,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_throughput_pool_begin_create_or_update(self, resource_group): response = self.client.throughput_pool.begin_create_or_update( resource_group_name=resource_group.name, throughput_pool_name="str", @@ -53,7 +53,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -61,11 +61,11 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_throughput_pool_begin_update(self, resource_group): response = self.client.throughput_pool.begin_update( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -73,11 +73,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_throughput_pool_begin_delete(self, resource_group): response = self.client.throughput_pool.begin_delete( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py index 870772500d2e..8d6aed7ad5b2 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_throughput_pool_get(self, resource_group): response = await self.client.throughput_pool.get( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) # please add some check logic here by yourself @@ -33,7 +33,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_throughput_pool_begin_create_or_update(self, resource_group): response = await ( await self.client.throughput_pool.begin_create_or_update( resource_group_name=resource_group.name, @@ -55,7 +55,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -64,12 +64,12 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_throughput_pool_begin_update(self, resource_group): response = await ( await self.client.throughput_pool.begin_update( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,12 +78,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_throughput_pool_begin_delete(self, resource_group): response = await ( await self.client.throughput_pool.begin_delete( resource_group_name=resource_group.name, throughput_pool_name="str", - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py index f859ce7127f3..1d7251b8cc69 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_throughput_pools_list(self, resource_group): response = self.client.throughput_pools.list( - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -30,10 +30,10 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_throughput_pools_list_by_resource_group(self, resource_group): response = self.client.throughput_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py index 0f8a825d7441..0797bd516b3d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_throughput_pools_list(self, resource_group): response = self.client.throughput_pools.list( - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -31,10 +31,10 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_throughput_pools_list_by_resource_group(self, resource_group): response = self.client.throughput_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-09-01-preview", + api_version="2024-12-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/sdk_packaging.toml b/sdk/cosmos/azure-mgmt-cosmosdb/sdk_packaging.toml index 4a4ab4d8cbce..86347b41f19b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/sdk_packaging.toml +++ b/sdk/cosmos/azure-mgmt-cosmosdb/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-cosmosdb" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Cosmos DB Management" package_doc_id = "cosmosdb" -is_stable = true +is_stable = false is_arm = true sample_link = "" title = "CosmosDBManagementClient" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py index 48bd1cd0c28e..1c3e0324429f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/setup.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -51,7 +49,7 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/conftest.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/conftest.py index c6d1ee70d05f..e7cc55656fbc 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/tests/conftest.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): cosmosdbmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_async_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_async_test.py new file mode 100644 index 000000000000..944f18708f9f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_async_test.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb.aio import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementCassandraClustersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_list_by_subscription(self, resource_group): + response = self.client.cassandra_clusters.list_by_subscription() + result = [r async for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cassandra_clusters_list_by_resource_group(self, resource_group): + response = self.client.cassandra_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_test.py new file mode 100644 index 000000000000..95622e35e021 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_cassandra_clusters_operations_test.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementCassandraClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_list_by_subscription(self, resource_group): + response = self.client.cassandra_clusters.list_by_subscription() + result = [r for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cassandra_clusters_list_by_resource_group(self, resource_group): + response = self.client.cassandra_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_async_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_async_test.py new file mode 100644 index 000000000000..a47e3fd3e432 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb.aio import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementLocationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_locations_list(self, resource_group): + response = self.client.locations.list() + result = [r async for r in response] + assert result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_test.py new file mode 100644 index 000000000000..f20dccbec4d4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_locations_operations_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementLocationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_locations_list(self, resource_group): + response = self.client.locations.list() + result = [r for r in response] + assert result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_async_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_async_test.py new file mode 100644 index 000000000000..ea0c20989af4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_async_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb.aio import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementRestorableDatabaseAccountsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_restorable_database_accounts_list(self, resource_group): + response = self.client.restorable_database_accounts.list() + result = [r async for r in response] + assert response diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_test.py new file mode 100644 index 000000000000..50cb43824fbe --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_restorable_database_accounts_operations_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementRestorableDatabaseAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_restorable_database_accounts_list(self, resource_group): + response = self.client.restorable_database_accounts.list() + result = [r for r in response] + assert response diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_async_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_async_test.py new file mode 100644 index 000000000000..0f476ea629f0 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_async_test.py @@ -0,0 +1,36 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb.aio import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementThroughputPoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_throughput_pools_list(self, resource_group): + response = self.client.throughput_pools.list() + result = [r async for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_throughput_pools_list_by_resource_group(self, resource_group): + response = self.client.throughput_pools.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_test.py b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_test.py new file mode 100644 index 000000000000..c71c7bd19c77 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tests/test_cosmos_db_management_throughput_pools_operations_test.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.cosmosdb import CosmosDBManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestCosmosDBManagementThroughputPoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_throughput_pools_list(self, resource_group): + response = self.client.throughput_pools.list() + result = [r for r in response] + assert response + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_throughput_pools_list_by_resource_group(self, resource_group): + response = self.client.throughput_pools.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == []