From 8326bd51c488db3f4c246e64d0c487bfe888ea1a Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 20 Aug 2026 19:15:21 +0000 Subject: [PATCH 1/2] Configurations: 'specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB/tspconfig.yaml', API Version: 2026-04-01-preview, SDK Release Type: beta, and CommitSHA: '9f5271b1ab4f354780443f12755bd097f148f9bc' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6726932 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md | 2162 +- sdk/cosmos/azure-mgmt-cosmosdb/_metadata.json | 10 +- sdk/cosmos/azure-mgmt-cosmosdb/api.md | 10058 ++-- .../azure-mgmt-cosmosdb/api.metadata.yml | 6 +- .../apiview-properties.json | 304 +- .../azure/mgmt/cosmosdb/_client.py | 89 +- .../azure/mgmt/cosmosdb/_configuration.py | 12 +- .../azure/mgmt/cosmosdb/_patch.py | 1 - .../azure/mgmt/cosmosdb/_utils/model_base.py | 37 +- .../mgmt/cosmosdb/_utils/serialization.py | 6 +- .../azure/mgmt/cosmosdb/_validation.py | 66 + .../azure/mgmt/cosmosdb/_version.py | 2 +- .../azure/mgmt/cosmosdb/aio/_client.py | 89 +- .../azure/mgmt/cosmosdb/aio/_configuration.py | 12 +- .../azure/mgmt/cosmosdb/aio/_patch.py | 1 - .../mgmt/cosmosdb/aio/operations/__init__.py | 28 + .../cosmosdb/aio/operations/_operations.py | 35348 +++++++++----- .../mgmt/cosmosdb/aio/operations/_patch.py | 1 - .../azure/mgmt/cosmosdb/models/__init__.py | 273 + .../azure/mgmt/cosmosdb/models/_enums.py | 290 + .../azure/mgmt/cosmosdb/models/_models.py | 17576 ++++--- .../azure/mgmt/cosmosdb/models/_patch.py | 1 - .../mgmt/cosmosdb/operations/__init__.py | 28 + .../mgmt/cosmosdb/operations/_operations.py | 39093 +++++++++++----- .../azure/mgmt/cosmosdb/operations/_patch.py | 1 - .../azure/mgmt/cosmosdb/types.py | 6813 +-- .../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 +- ...cassandra_role_assignment_create_update.py | 2 +- ...mos_db_cassandra_role_assignment_delete.py | 2 +- ...cosmos_db_cassandra_role_assignment_get.py | 2 +- ...osmos_db_cassandra_role_assignment_list.py | 2 +- ...cassandra_role_definition_create_update.py | 2 +- ...mos_db_cassandra_role_definition_delete.py | 2 +- ...cosmos_db_cassandra_role_definition_get.py | 2 +- ...osmos_db_cassandra_role_definition_list.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 | 55 + .../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_copy_job_cancel.py | 43 + .../cosmos_db_copy_job_complete.py | 43 + .../cosmos_db_copy_job_create.py | 61 + .../cosmos_db_copy_job_feed.py | 43 + .../cosmos_db_copy_job_get.py | 43 + .../cosmos_db_copy_job_pause.py | 43 + .../cosmos_db_copy_job_resume.py | 43 + .../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 + .../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 | 5 +- .../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 | 2 +- ..._list_read_only_keys_get_read_only_keys.py | 2 +- ...smos_db_database_account_offline_region.py | 2 +- ...osmos_db_database_account_online_region.py | 2 +- .../cosmos_db_database_account_patch.py | 6 +- ...smos_db_database_account_regenerate_key.py | 4 +- ..._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 +- .../cosmos_db_fleet_analytics_create.py | 50 + .../cosmos_db_fleet_analytics_delete.py | 42 + .../cosmos_db_fleet_analytics_get.py | 43 + .../cosmos_db_fleet_analytics_list.py | 43 + .../cosmos_db_fleet_create.py | 2 +- .../cosmos_db_fleet_delete.py | 2 +- .../generated_samples/cosmos_db_fleet_get.py | 2 +- .../generated_samples/cosmos_db_fleet_list.py | 2 +- ...os_db_fleet_list_list_by_resource_group.py | 2 +- .../cosmos_db_fleet_update.py | 2 +- .../cosmos_db_fleetspace_account_create.py | 2 +- .../cosmos_db_fleetspace_account_delete.py | 2 +- .../cosmos_db_fleetspace_account_get.py | 2 +- .../cosmos_db_fleetspace_account_list.py | 2 +- .../cosmos_db_fleetspace_create.py | 2 +- .../cosmos_db_fleetspace_delete.py | 2 +- .../cosmos_db_fleetspace_get.py | 2 +- .../cosmos_db_fleetspace_list.py | 2 +- .../cosmos_db_fleetspace_update.py | 2 +- .../cosmos_db_garnet_cluster_create.py | 55 + .../cosmos_db_garnet_cluster_delete.py | 41 + .../cosmos_db_garnet_cluster_get.py | 42 + ...b_garnet_cluster_list_by_resource_group.py | 42 + ..._db_garnet_cluster_list_by_subscription.py | 40 + .../cosmos_db_garnet_cluster_patch.py | 43 + ...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 +- ...b_gremlin_role_assignment_create_update.py | 2 +- ...osmos_db_gremlin_role_assignment_delete.py | 2 +- .../cosmos_db_gremlin_role_assignment_get.py | 2 +- .../cosmos_db_gremlin_role_assignment_list.py | 2 +- ...b_gremlin_role_definition_create_update.py | 2 +- ...osmos_db_gremlin_role_definition_delete.py | 2 +- .../cosmos_db_gremlin_role_definition_get.py | 2 +- .../cosmos_db_gremlin_role_definition_list.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 | 2 +- ...db_managed_cassandra_cluster_deallocate.py | 2 +- ...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 | 2 +- .../cosmos_db_managed_cassandra_command.py | 4 +- ...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 | 2 +- ...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 +- ...os_db_mongo_db_collection_create_update.py | 3 +- .../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 + .../cosmos_db_mongo_db_collection_restore.py | 61 + ...ection_retrieve_throughput_distribution.py | 47 + ...s_db_mongo_db_collection_throughput_get.py | 2 +- ...b_mongo_db_collection_throughput_update.py | 2 +- ...smos_db_mongo_db_database_create_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 + .../cosmos_db_mongo_db_database_restore.py | 60 + ...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 +- ..._mongo_mi_role_assignment_create_update.py | 2 +- ...smos_db_mongo_mi_role_assignment_delete.py | 2 +- .../cosmos_db_mongo_mi_role_assignment_get.py | 2 +- ...cosmos_db_mongo_mi_role_assignment_list.py | 2 +- ..._mongo_mi_role_definition_create_update.py | 2 +- ...smos_db_mongo_mi_role_definition_delete.py | 2 +- .../cosmos_db_mongo_mi_role_definition_get.py | 2 +- ...cosmos_db_mongo_mi_role_definition_list.py | 2 +- .../cosmos_db_notebook_workspace_create.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 | 5 +- .../cosmos_db_services_list.py | 2 +- ...os_db_soft_deleted_database_account_get.py | 43 + ...leted_database_account_list_by_location.py | 41 + ...unt_list_by_resource_group_and_location.py | 42 + ..._db_soft_deleted_database_account_purge.py | 42 + ...b_soft_deleted_database_account_restore.py | 42 + ...osmos_db_soft_deleted_sql_container_get.py | 45 + ...smos_db_soft_deleted_sql_container_list.py | 44 + ...mos_db_soft_deleted_sql_container_purge.py | 44 + ...s_db_soft_deleted_sql_container_restore.py | 44 + ...cosmos_db_soft_deleted_sql_database_get.py | 44 + ...osmos_db_soft_deleted_sql_database_list.py | 43 + ...smos_db_soft_deleted_sql_database_purge.py | 43 + ...os_db_soft_deleted_sql_database_restore.py | 43 + ...sql_client_encryption_key_create_update.py | 5 +- ...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 | 10 +- .../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 | 61 + ...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 | 60 + ...tabase_retrieve_throughput_distribution.py | 46 + .../cosmos_db_sql_database_throughput_get.py | 2 +- ...osmos_db_sql_database_throughput_update.py | 2 +- ...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_sql_materialized_view_create_update.py | 74 + ...os_db_sql_role_assignment_create_update.py | 6 +- .../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 | 6 +- .../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 +- ..._db_table_role_assignment_create_update.py | 2 +- .../cosmos_db_table_role_assignment_delete.py | 2 +- .../cosmos_db_table_role_assignment_get.py | 2 +- .../cosmos_db_table_role_assignment_list.py | 2 +- ..._db_table_role_definition_create_update.py | 2 +- .../cosmos_db_table_role_definition_delete.py | 2 +- .../cosmos_db_table_role_definition_get.py | 2 +- .../cosmos_db_table_role_definition_list.py | 2 +- .../cosmos_db_table_throughput_get.py | 2 +- .../cosmos_db_table_throughput_update.py | 2 +- ...osmos_db_throughput_pool_account_create.py | 50 + ...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 | 40 + ...ughput_pool_list_list_by_resource_group.py | 42 + .../cosmos_db_throughput_pool_update.py | 42 + .../cosmos_dbp_key_range_id_get_metrics.py | 2 +- ...mos_dbp_key_range_id_region_get_metrics.py | 2 +- ...rk_security_perimeter_configuration_get.py | 43 + ...k_security_perimeter_configuration_list.py | 43 + ...urity_perimeter_configuration_reconcile.py | 42 + ...anagement_cassandra_clusters_operations.py | 60 + ...ent_cassandra_clusters_operations_async.py | 68 + ...nagement_cassandra_resources_operations.py | 150 + ...nt_cassandra_resources_operations_async.py | 160 + ...os_db_management_chaos_fault_operations.py | 74 + ...management_chaos_fault_operations_async.py | 77 + ...smos_db_management_copy_jobs_operations.py | 134 + ...b_management_copy_jobs_operations_async.py | 135 + ...anagement_data_transfer_jobs_operations.py | 120 + ...ent_data_transfer_jobs_operations_async.py | 121 + ...management_database_accounts_operations.py | 60 +- ...ment_database_accounts_operations_async.py | 60 +- ...b_management_fleet_analytics_operations.py | 80 + ...gement_fleet_analytics_operations_async.py | 83 + ...b_management_garnet_clusters_operations.py | 126 + ...gement_garnet_clusters_operations_async.py | 133 + ...b_management_graph_resources_operations.py | 83 + ...gement_graph_resources_operations_async.py | 88 + ...management_gremlin_resources_operations.py | 2 + ...ment_gremlin_resources_operations_async.py | 2 + ...anagement_mongo_db_resources_operations.py | 155 + ...ent_mongo_db_resources_operations_async.py | 167 + ...ity_perimeter_configurations_operations.py | 54 + ...rimeter_configurations_operations_async.py | 57 + ...ft_deleted_database_accounts_operations.py | 76 + ...eted_database_accounts_operations_async.py | 81 + ..._soft_deleted_sql_containers_operations.py | 74 + ...deleted_sql_containers_operations_async.py | 79 + ...t_soft_deleted_sql_databases_operations.py | 70 + ..._deleted_sql_databases_operations_async.py | 75 + ..._db_management_sql_resources_operations.py | 168 + ...nagement_sql_resources_operations_async.py | 180 + ...b_management_table_resources_operations.py | 1 + ...gement_table_resources_operations_async.py | 1 + ...ment_throughput_pool_account_operations.py | 74 + ...hroughput_pool_account_operations_async.py | 79 + ...ent_throughput_pool_accounts_operations.py | 30 + ...roughput_pool_accounts_operations_async.py | 31 + ...b_management_throughput_pool_operations.py | 79 + ...gement_throughput_pool_operations_async.py | 86 + ..._management_throughput_pools_operations.py | 37 + ...ement_throughput_pools_operations_async.py | 38 + sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml | 4 +- .../azure-mgmt-cosmosdb/tsp-location.yaml | 2 +- 406 files changed, 82191 insertions(+), 38143 deletions(-) create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_validation.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_copy_job_cancel.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_complete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_feed.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_pause.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_resume.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_cancel.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_complete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_resume.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_resource_group.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_subscription.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_patch.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_restore.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_restore.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_soft_deleted_database_account_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_location.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_resource_group_and_location.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_purge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_restore.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_purge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_restore.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_purge.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_restore.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/cosmos_db_throughput_pool_account_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_accounts_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_create.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_delete.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_get.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list_list_by_resource_group.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_update.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_tests/test_cosmos_db_management_chaos_fault_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py create mode 100644 sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md index 6f47c24fec26..82a42833826c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md @@ -1,5 +1,235 @@ # Release History +## 10.1.0b1 (2026-08-20) + +### Features Added + + - Client `CosmosDBManagementClient` added operation group `chaos_fault` + - Client `CosmosDBManagementClient` added operation group `copy_jobs` + - Client `CosmosDBManagementClient` added operation group `data_transfer_jobs` + - Client `CosmosDBManagementClient` added operation group `fleet_analytics` + - Client `CosmosDBManagementClient` added operation group `garnet_clusters` + - Client `CosmosDBManagementClient` added operation group `graph_resources` + - Client `CosmosDBManagementClient` added operation group `network_security_perimeter_configurations` + - Client `CosmosDBManagementClient` added operation group `soft_deleted_database_accounts` + - Client `CosmosDBManagementClient` added operation group `soft_deleted_sql_containers` + - Client `CosmosDBManagementClient` added operation group `soft_deleted_sql_databases` + - Client `CosmosDBManagementClient` added operation group `throughput_pool` + - Client `CosmosDBManagementClient` added operation group `throughput_pool_account` + - Client `CosmosDBManagementClient` added operation group `throughput_pool_accounts` + - Client `CosmosDBManagementClient` added operation group `throughput_pools` + - Model `AccountKeyMetadata` added property `approximate_last_usage_time` + - Model `ClusterResourceProperties` added property `cluster_type` + - Enum `ContinuousTier` added member `CONTINUOUS35_DAYS` + - Model `DatabaseAccountCreateUpdateProperties` added property `capacity_mode` + - Model `DatabaseAccountCreateUpdateProperties` added property `diagnostic_log_settings` + - Model `DatabaseAccountCreateUpdateProperties` added property `enable_all_versions_and_deletes_change_feed` + - Model `DatabaseAccountCreateUpdateProperties` added property `enable_materialized_views` + - Model `DatabaseAccountCreateUpdateProperties` added property `soft_delete_configuration` + - Model `DatabaseAccountGetProperties` added property `capacity_mode` + - Model `DatabaseAccountGetProperties` added property `capacity_mode_change_transition_state` + - Model `DatabaseAccountGetProperties` added property `diagnostic_log_settings` + - Model `DatabaseAccountGetProperties` added property `enable_all_versions_and_deletes_change_feed` + - Model `DatabaseAccountGetProperties` added property `enable_materialized_views` + - Model `DatabaseAccountGetProperties` added property `soft_delete_configuration` + - Model `DatabaseAccountGetProperties` added property `throughput_pool_dedicated_r_us` + - Model `DatabaseAccountGetProperties` added property `throughput_pool_max_consumable_r_us` + - Model `DatabaseAccountRegenerateKeyParameters` added property `skip_account_keys_last_usage_check` + - Model `DatabaseAccountUpdateProperties` added property `capacity_mode` + - Model `DatabaseAccountUpdateProperties` added property `diagnostic_log_settings` + - Model `DatabaseAccountUpdateProperties` added property `enable_all_versions_and_deletes_change_feed` + - Model `DatabaseAccountUpdateProperties` added property `enable_materialized_views` + - Model `DatabaseAccountUpdateProperties` added property `soft_delete_configuration` + - Model `RestorableSqlContainerPropertiesResourceContainer` added property `data_masking_policy` + - Model `RestorableSqlContainerPropertiesResourceContainer` added property `materialized_view_definition` + - Model `RestorableSqlContainerPropertiesResourceContainer` added property `materialized_views` + - Model `RestorableSqlContainerPropertiesResourceContainer` added property `materialized_views_properties` + - Model `SqlContainerGetPropertiesResource` added property `data_masking_policy` + - Model `SqlContainerGetPropertiesResource` added property `materialized_view_definition` + - Model `SqlContainerGetPropertiesResource` added property `materialized_views` + - Model `SqlContainerGetPropertiesResource` added property `materialized_views_properties` + - Model `SqlContainerResource` added property `data_masking_policy` + - Model `SqlContainerResource` added property `materialized_view_definition` + - Model `SqlContainerResource` added property `materialized_views` + - Model `SqlContainerResource` added property `materialized_views_properties` + - Model `ThroughputSettingsGetPropertiesResource` added property `throughput_buckets` + - Model `ThroughputSettingsResource` added property `throughput_buckets` + - Added model `AccessRule` + - Added enum `AccessRuleDirection` + - Added model `AccessRuleProperties` + - Added model `AccessRulePropertiesSubscriptionsItem` + - Added enum `AllocationState` + - Added model `AzureBlobContainer` + - Added model `AzureBlobDataTransferDataSourceSink` + - Added model `AzureBlobSourceSinkDetails` + - Added model `BackupResource` + - Added enum `BackupState` + - Added model `BaseCopyJobProperties` + - Added model `BaseCopyJobTask` + - Added model `BaseCosmosDataTransferDataSourceSink` + - Added model `BlobToCassandraRUCopyJobProperties` + - Added model `BlobToCassandraRUCopyJobTask` + - Added enum `CapacityMode` + - Added model `CapacityModeChangeTransitionState` + - Added enum `CapacityModeTransitionStatus` + - Added model `CassandraRUToBlobCopyJobProperties` + - Added model `CassandraRUToBlobCopyJobTask` + - Added model `CassandraRUToCassandraRUCopyJobProperties` + - Added model `CassandraRUToCassandraRUCopyJobTask` + - Added model `CassandraViewCreateUpdateParameters` + - Added model `CassandraViewCreateUpdateProperties` + - Added model `CassandraViewGetProperties` + - Added model `CassandraViewGetPropertiesOptions` + - Added model `CassandraViewGetPropertiesResource` + - Added model `CassandraViewGetResults` + - Added model `CassandraViewResource` + - Added model `ChaosFaultProperties` + - Added model `ChaosFaultResource` + - Added enum `ClusterType` + - Added model `CommandAsyncPostBody` + - Added model `CommandPublicResource` + - Added enum `CommandStatus` + - Added model `CopyJobGetResults` + - Added enum `CopyJobMode` + - Added model `CopyJobProperties` + - Added enum `CopyJobStatus` + - Added enum `CopyJobType` + - Added model `CosmosCassandraDataTransferDataSourceSink` + - Added model `CosmosDBCassandraTable` + - Added model `CosmosDBMongoCollection` + - Added model `CosmosDBMongoVCoreCollection` + - Added model `CosmosDBNoSqlContainer` + - Added model `CosmosDBSourceSinkDetails` + - Added model `CosmosMongoDataTransferDataSourceSink` + - Added model `CosmosMongoVCoreDataTransferDataSourceSink` + - Added model `CosmosSqlDataTransferDataSourceSink` + - Added model `CreateJobRequest` + - Added model `DataMaskingPolicy` + - Added model `DataMaskingPolicyExcludedPathsItem` + - Added model `DataMaskingPolicyIncludedPathsItem` + - Added enum `DataTransferComponent` + - Added model `DataTransferDataSourceSink` + - Added model `DataTransferJobGetResults` + - Added enum `DataTransferJobMode` + - Added model `DataTransferJobProperties` + - Added model `DiagnosticLogSettings` + - Added enum `EnableFullTextQuery` + - Added model `FleetAnalyticsProperties` + - Added enum `FleetAnalyticsPropertiesStorageLocationType` + - Added model `FleetAnalyticsResource` + - Added enum `GarnetAuthenticationType` + - Added enum `GarnetCacheProvisioningState` + - Added model `GarnetClusterResource` + - Added model `GarnetClusterResourcePatch` + - Added model `GarnetClusterResourcePatchProperties` + - Added model `GarnetClusterResourceProperties` + - Added model `GarnetClusterResourcePropertiesEndPointsItem` + - Added model `GraphResource` + - Added model `GraphResourceCreateUpdateParameters` + - Added model `GraphResourceCreateUpdateProperties` + - Added model `GraphResourceGetProperties` + - Added model `GraphResourceGetPropertiesOptions` + - Added model `GraphResourceGetPropertiesResource` + - Added model `GraphResourceGetResults` + - Added enum `IssueType` + - Added model `MaterializedViewDefinition` + - Added model `MaterializedViewDetails` + - Added model `MaterializedViewsProperties` + - Added model `MergeParameters` + - Added model `MongoRUToMongoRUCopyJobProperties` + - Added model `MongoRUToMongoRUCopyJobTask` + - Added model `MongoRUToMongoVCoreCopyJobProperties` + - Added model `MongoRUToMongoVCoreCopyJobTask` + - Added model `MongoVCoreSourceSinkDetails` + - Added model `NetworkSecurityPerimeter` + - Added model `NetworkSecurityPerimeterConfiguration` + - Added model `NetworkSecurityPerimeterConfigurationProperties` + - Added enum `NetworkSecurityPerimeterConfigurationProvisioningState` + - Added model `NetworkSecurityProfile` + - Added model `NoSqlRUToNoSqlRUCopyJobProperties` + - Added model `NoSqlRUToNoSqlRUCopyJobTask` + - Added model `PhysicalPartitionId` + - Added model `PhysicalPartitionStorageInfo` + - Added model `PhysicalPartitionStorageInfoCollection` + - Added model `PhysicalPartitionThroughputInfoProperties` + - Added model `PhysicalPartitionThroughputInfoResource` + - Added model `PhysicalPartitionThroughputInfoResult` + - Added model `PhysicalPartitionThroughputInfoResultProperties` + - Added model `PhysicalPartitionThroughputInfoResultPropertiesResource` + - Added model `ProvisioningIssue` + - Added model `ProvisioningIssueProperties` + - Added model `RedistributeThroughputParameters` + - Added model `RedistributeThroughputProperties` + - Added model `RedistributeThroughputPropertiesResource` + - Added model `ResourceAssociation` + - Added enum `ResourceAssociationAccessMode` + - Added model `RetrieveThroughputParameters` + - Added model `RetrieveThroughputProperties` + - Added model `RetrieveThroughputPropertiesResource` + - Added enum `Severity` + - Added enum `SoftDeleteActionKind` + - Added model `SoftDeleteConfiguration` + - Added model `SoftDeletedDatabaseAccountGetResult` + - Added model `SoftDeletedDatabaseAccountProperties` + - Added model `SoftDeletedDatabaseAccountResource` + - Added model `SoftDeletedDatabaseAccountsListResult` + - Added model `SoftDeletedSqlContainerGetResult` + - Added model `SoftDeletedSqlContainerProperties` + - Added model `SoftDeletedSqlContainerResource` + - Added model `SoftDeletedSqlContainersListResult` + - Added model `SoftDeletedSqlDatabaseGetResult` + - Added model `SoftDeletedSqlDatabaseProperties` + - Added model `SoftDeletedSqlDatabaseResource` + - Added model `SoftDeletedSqlDatabasesListResult` + - Added model `SoftDeletionMetadata` + - Added enum `SupportedActions` + - Added model `ThroughputBucketResource` + - Added enum `ThroughputPolicyType` + - Added model `ThroughputPoolAccountProperties` + - Added model `ThroughputPoolAccountResource` + - Added model `ThroughputPoolProperties` + - Added model `ThroughputPoolResource` + - Added model `ThroughputPoolUpdate` + - Model `CassandraClustersOperations` added method `begin_invoke_command_async` + - Model `CassandraClustersOperations` added method `get_backup` + - Model `CassandraClustersOperations` added method `get_command_async` + - Model `CassandraClustersOperations` added method `list_backups` + - Model `CassandraClustersOperations` added method `list_command` + - Model `CassandraResourcesOperations` added method `begin_create_update_cassandra_view` + - Model `CassandraResourcesOperations` added method `begin_delete_cassandra_view` + - Model `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_autoscale` + - Model `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_manual_throughput` + - Model `CassandraResourcesOperations` added method `begin_update_cassandra_view_throughput` + - Model `CassandraResourcesOperations` added method `get_cassandra_view` + - Model `CassandraResourcesOperations` added method `get_cassandra_view_throughput` + - Model `CassandraResourcesOperations` added method `list_cassandra_views` + - Model `MongoDBResourcesOperations` added method `begin_list_mongo_db_collection_partition_merge` + - Model `MongoDBResourcesOperations` added method `begin_mongo_db_container_redistribute_throughput` + - Model `MongoDBResourcesOperations` added method `begin_mongo_db_container_retrieve_throughput_distribution` + - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_partition_merge` + - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_redistribute_throughput` + - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_retrieve_throughput_distribution` + - Model `SqlResourcesOperations` added method `begin_list_sql_container_partition_merge` + - Model `SqlResourcesOperations` added method `begin_sql_container_redistribute_throughput` + - Model `SqlResourcesOperations` added method `begin_sql_container_retrieve_throughput_distribution` + - Model `SqlResourcesOperations` added method `begin_sql_database_partition_merge` + - Model `SqlResourcesOperations` added method `begin_sql_database_redistribute_throughput` + - Model `SqlResourcesOperations` added method `begin_sql_database_retrieve_throughput_distribution` + - Added operation group `ChaosFaultOperations` + - Added operation group `CopyJobsOperations` + - Added operation group `DataTransferJobsOperations` + - Added operation group `FleetAnalyticsOperations` + - Added operation group `GarnetClustersOperations` + - Added operation group `GraphResourcesOperations` + - Added operation group `NetworkSecurityPerimeterConfigurationsOperations` + - Added operation group `SoftDeletedDatabaseAccountsOperations` + - Added operation group `SoftDeletedSqlContainersOperations` + - Added operation group `SoftDeletedSqlDatabasesOperations` + - Added operation group `ThroughputPoolAccountOperations` + - Added operation group `ThroughputPoolAccountsOperations` + - Added operation group `ThroughputPoolOperations` + - Added operation group `ThroughputPoolsOperations` + ## 10.0.0 (2026-07-02) ### Features Added @@ -512,1934 +742,4 @@ - Added model `FullTextPath` - Added model `FullTextPolicy` -## 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 - - - Model `DatabaseAccountCreateUpdateParameters` added property `enable_per_region_per_partition_autoscale` - - Model `DatabaseAccountGetResults` added property `enable_per_region_per_partition_autoscale` - - Model `DatabaseAccountUpdateParameters` added property `enable_per_region_per_partition_autoscale` - - 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` - - Added enum `DistanceFunction` - - Added enum `VectorDataType` - - Added model `VectorEmbedding` - - Added model `VectorEmbeddingPolicy` - - Added model `VectorIndex` - - Added enum `VectorIndexType` - -## 10.0.0b4 (2024-09-23) - -### Features Added - - - Client `CosmosDBManagementClient` added operation group `network_security_perimeter_configurations` - - Client `CosmosDBManagementClient` added operation group `chaos_fault` - - Enum `DataTransferComponent` added member `COSMOS_DB_MONGO_V_CORE` - - Model `DatabaseAccountCreateUpdateParameters` added property `capacity_mode` - - Model `DatabaseAccountGetResults` added property `capacity_mode` - - Model `DatabaseAccountGetResults` added property `capacity_mode_change_transition_state` - - Model `DatabaseAccountUpdateParameters` added property `capacity_mode` - - Enum `ServerVersion` added member `FIVE0` - - Enum `ServerVersion` added member `SEVEN0` - - Enum `ServerVersion` added member `SIX0` - - Model `ServiceResourceCreateUpdateParameters` added parameter `properties` in method `__init__` - - Model `SqlDedicatedGatewayServiceResourceProperties` added property `dedicated_gateway_type` - - Added model `AccessRule` - - Added enum `AccessRuleDirection` - - Added model `AccessRuleProperties` - - Added model `AccessRulePropertiesSubscriptionsItem` - - Added enum `CapacityMode` - - Added model `CapacityModeChangeTransitionState` - - Added enum `CapacityModeTransitionStatus` - - Added model `ChaosFaultListResponse` - - Added model `ChaosFaultResource` - - Added model `CosmosMongoVCoreDataTransferDataSourceSink` - - Added model `DataTransferServiceResourceCreateUpdateProperties` - - Added enum `DedicatedGatewayType` - - Added model `GraphAPIComputeServiceResourceCreateUpdateProperties` - - Added enum `IssueType` - - Added model `MaterializedViewsBuilderServiceResourceCreateUpdateProperties` - - Added model `NetworkSecurityPerimeter` - - Added model `NetworkSecurityPerimeterConfiguration` - - Added model `NetworkSecurityPerimeterConfigurationListResult` - - Added model `NetworkSecurityPerimeterConfigurationProperties` - - Added enum `NetworkSecurityPerimeterConfigurationProvisioningState` - - Added model `NetworkSecurityProfile` - - Added model `ProvisioningIssue` - - Added model `ProvisioningIssueProperties` - - Added model `ResourceAssociation` - - Added enum `ResourceAssociationAccessMode` - - Added model `ServiceResourceCreateUpdateProperties` - - Added enum `Severity` - - Added model `SqlDedicatedGatewayServiceResourceCreateUpdateProperties` - - Added enum `SupportedActions` - - Added model `ChaosFaultOperations` - - Added model `NetworkSecurityPerimeterConfigurationsOperations` - -### Breaking Changes - - - Deleted or renamed client operation group `CosmosDBManagementClient.mongo_clusters` - - Deleted or renamed enum value `CreateMode.POINT_IN_TIME_RESTORE` - - Model `ServiceResourceCreateUpdateParameters` deleted or renamed its instance variable `instance_size` - - Model `ServiceResourceCreateUpdateParameters` deleted or renamed its instance variable `instance_count` - - Model `ServiceResourceCreateUpdateParameters` deleted or renamed its instance variable `service_type` - - Deleted or renamed model `CheckNameAvailabilityReason` - - Deleted or renamed model `CheckNameAvailabilityRequest` - - Deleted or renamed model `CheckNameAvailabilityResponse` - - Deleted or renamed model `ConnectionString` - - Deleted or renamed model `FirewallRule` - - Deleted or renamed model `ListConnectionStringsResult` - - Deleted or renamed model `MongoCluster` - - Deleted or renamed model `MongoClusterRestoreParameters` - - Deleted or renamed model `MongoClusterStatus` - - Deleted or renamed model `MongoClusterUpdate` - - Deleted or renamed model `NodeGroupProperties` - - Deleted or renamed model `NodeGroupSpec` - - Deleted or renamed model `NodeKind` - - Deleted or renamed model `ProvisioningState` - - Deleted or renamed model `MongoClustersOperations` - -## 9.6.0 (2024-09-18) - -### Features Added - - - Model `ResourceRestoreParameters` added property `restore_with_ttl_disabled` - - Model `RestoreParameters` added parameter `restore_with_ttl_disabled` in method `__init__` - - Model `RestoreParametersBase` added property `restore_with_ttl_disabled` - - Enum `ServerVersion` added member `SEVEN0` - - Added model `ErrorAdditionalInfo` - - Added model `ErrorDetail` - - Added model `ErrorResponseAutoGenerated` - -## 9.5.1 (2024-06-19) - -### Features Added - - - Model ServiceResourceCreateUpdateParameters has a new parameter properties - -### Breaking Changes - - - Model ServiceResourceCreateUpdateParameters no longer has parameter instance_count - - Model ServiceResourceCreateUpdateParameters no longer has parameter instance_size - - Model ServiceResourceCreateUpdateParameters no longer has parameter service_type - -### Bugs Fixed - - - Disable parameter flatten for Model ServiceResourceCreateUpdateParameters to avoid deserializatin - -## 9.5.0 (2024-05-20) - -### Features Added - - - Model ClusterResourceProperties has a new parameter azure_connection_method - - Model ClusterResourceProperties has a new parameter private_link_resource_id - - Model DataCenterResourceProperties has a new parameter private_endpoint_ip_address - - Model SqlDedicatedGatewayServiceResourceProperties has a new parameter dedicated_gateway_type - -## 10.0.0b3 (2024-03-18) - -### Features Added - - - Added operation DataTransferJobsOperations.complete - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_per_region_per_partition_autoscale - - Model DatabaseAccountGetResults has a new parameter enable_per_region_per_partition_autoscale - - Model DatabaseAccountUpdateParameters has a new parameter enable_per_region_per_partition_autoscale - - Model PrivateEndpointConnection has a new parameter system_data - - Model ProxyResource has a new parameter system_data - - Model Resource has a new parameter system_data - - Model ResourceRestoreParameters has a new parameter restore_with_ttl_disabled - - Model RestoreParameters has a new parameter restore_with_ttl_disabled - - Model RestoreParametersBase has a new parameter restore_with_ttl_disabled - -## 10.0.0b2 (2024-01-26) - -### Features Added - - - Added operation CassandraClustersOperations.begin_invoke_command_async - - Added operation CassandraClustersOperations.get_command_async - - Added operation CassandraClustersOperations.list_command - - Added operation group ThroughputPoolAccountOperations - - Added operation group ThroughputPoolAccountsOperations - - Added operation group ThroughputPoolOperations - - Added operation group ThroughputPoolsOperations - - Model BackupResource has a new parameter backup_expiry_timestamp - - Model BackupResource has a new parameter backup_id - - Model BackupResource has a new parameter backup_start_timestamp - - Model BackupResource has a new parameter backup_state - - Model BackupResource has a new parameter backup_stop_timestamp - - Model CassandraClusterDataCenterNodeItem has a new parameter is_latest_model - - Model ClusterResourceProperties has a new parameter auto_replicate - - Model ClusterResourceProperties has a new parameter azure_connection_method - - Model ClusterResourceProperties has a new parameter backup_schedules - - Model ClusterResourceProperties has a new parameter cluster_type - - Model ClusterResourceProperties has a new parameter extensions - - Model ClusterResourceProperties has a new parameter external_data_centers - - Model ClusterResourceProperties has a new parameter private_link_resource_id - - Model ClusterResourceProperties has a new parameter scheduled_event_strategy - - Model CommandPostBody has a new parameter read_write - - Model CosmosCassandraDataTransferDataSourceSink has a new parameter remote_account_name - - Model CosmosMongoDataTransferDataSourceSink has a new parameter remote_account_name - - Model CosmosSqlDataTransferDataSourceSink has a new parameter remote_account_name - - Model DataCenterResourceProperties has a new parameter private_endpoint_ip_address - - Model DataTransferJobGetResults has a new parameter duration - - Model DataTransferJobGetResults has a new parameter mode - - Model DataTransferJobProperties has a new parameter duration - - Model DataTransferJobProperties has a new parameter mode - - Model DatabaseAccountCreateUpdateParameters has a new parameter customer_managed_key_status - - Model DatabaseAccountCreateUpdateParameters has a new parameter default_priority_level - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_priority_based_execution - - Model DatabaseAccountGetResults has a new parameter customer_managed_key_status - - Model DatabaseAccountGetResults has a new parameter default_priority_level - - Model DatabaseAccountGetResults has a new parameter enable_priority_based_execution - - Model DatabaseAccountUpdateParameters has a new parameter customer_managed_key_status - - Model DatabaseAccountUpdateParameters has a new parameter default_priority_level - - Model DatabaseAccountUpdateParameters has a new parameter enable_priority_based_execution - - Model RestorableGremlinDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableGremlinDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableGremlinGraphPropertiesResource has a new parameter can_undelete - - Model RestorableGremlinGraphPropertiesResource has a new parameter can_undelete_reason - - Model RestorableMongodbCollectionPropertiesResource has a new parameter can_undelete - - Model RestorableMongodbCollectionPropertiesResource has a new parameter can_undelete_reason - - Model RestorableMongodbDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableMongodbDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableSqlContainerPropertiesResource has a new parameter can_undelete - - Model RestorableSqlContainerPropertiesResource has a new parameter can_undelete_reason - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter computed_properties - - Model RestorableSqlDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableSqlDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableTablePropertiesResource has a new parameter can_undelete - - Model RestorableTablePropertiesResource has a new parameter can_undelete_reason - - Model SqlContainerGetPropertiesResource has a new parameter computed_properties - - Model SqlContainerResource has a new parameter computed_properties - - Model ThroughputSettingsGetPropertiesResource has a new parameter instant_maximum_throughput - - Model ThroughputSettingsGetPropertiesResource has a new parameter soft_allowed_maximum_throughput - - Model ThroughputSettingsResource has a new parameter instant_maximum_throughput - - Model ThroughputSettingsResource has a new parameter soft_allowed_maximum_throughput - - Operation CassandraClustersOperations.begin_deallocate has a new optional parameter x_ms_force_deallocate - -### Breaking Changes - - - Model BackupResource no longer has parameter id - - Model BackupResource no longer has parameter name - - Model BackupResource no longer has parameter properties - - Model BackupResource no longer has parameter type - - Model CommandPostBody no longer has parameter readwrite - -## 9.4.0 (2023-12-19) - -### Features Added - - - Model GremlinDatabaseGetPropertiesResource has a new parameter create_mode - - Model GremlinDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model GremlinDatabaseResource has a new parameter create_mode - - Model GremlinDatabaseResource has a new parameter restore_parameters - - Model GremlinGraphGetPropertiesResource has a new parameter create_mode - - Model GremlinGraphGetPropertiesResource has a new parameter restore_parameters - - Model GremlinGraphResource has a new parameter create_mode - - Model GremlinGraphResource has a new parameter restore_parameters - - Model MongoDBCollectionGetPropertiesResource has a new parameter create_mode - - Model MongoDBCollectionGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBCollectionResource has a new parameter create_mode - - Model MongoDBCollectionResource has a new parameter restore_parameters - - Model MongoDBDatabaseGetPropertiesResource has a new parameter create_mode - - Model MongoDBDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBDatabaseResource has a new parameter create_mode - - Model MongoDBDatabaseResource has a new parameter restore_parameters - - Model RestorableGremlinDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableGremlinDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableGremlinGraphPropertiesResource has a new parameter can_undelete - - Model RestorableGremlinGraphPropertiesResource has a new parameter can_undelete_reason - - Model RestorableMongodbCollectionPropertiesResource has a new parameter can_undelete - - Model RestorableMongodbCollectionPropertiesResource has a new parameter can_undelete_reason - - Model RestorableMongodbDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableMongodbDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableSqlContainerPropertiesResource has a new parameter can_undelete - - Model RestorableSqlContainerPropertiesResource has a new parameter can_undelete_reason - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter computed_properties - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter create_mode - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter restore_parameters - - Model RestorableSqlDatabasePropertiesResource has a new parameter can_undelete - - Model RestorableSqlDatabasePropertiesResource has a new parameter can_undelete_reason - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter create_mode - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter restore_parameters - - Model RestorableTablePropertiesResource has a new parameter can_undelete - - Model RestorableTablePropertiesResource has a new parameter can_undelete_reason - - Model SqlContainerGetPropertiesResource has a new parameter computed_properties - - Model SqlContainerGetPropertiesResource has a new parameter create_mode - - Model SqlContainerGetPropertiesResource has a new parameter restore_parameters - - Model SqlContainerResource has a new parameter computed_properties - - Model SqlContainerResource has a new parameter create_mode - - Model SqlContainerResource has a new parameter restore_parameters - - Model SqlDatabaseGetPropertiesResource has a new parameter create_mode - - Model SqlDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model SqlDatabaseResource has a new parameter create_mode - - Model SqlDatabaseResource has a new parameter restore_parameters - - Model TableGetPropertiesResource has a new parameter create_mode - - Model TableGetPropertiesResource has a new parameter restore_parameters - - Model TableResource has a new parameter create_mode - - Model TableResource has a new parameter restore_parameters - -## 9.3.0 (2023-10-23) - -### Features Added - - - Model DatabaseAccountCreateUpdateParameters has a new parameter customer_managed_key_status - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_burst_capacity - - Model DatabaseAccountGetResults has a new parameter customer_managed_key_status - - Model DatabaseAccountGetResults has a new parameter enable_burst_capacity - - Model DatabaseAccountUpdateParameters has a new parameter customer_managed_key_status - - Model DatabaseAccountUpdateParameters has a new parameter enable_burst_capacity - -## 10.0.0b1 (2023-06-16) - -### Features Added - - - Added operation CassandraClustersOperations.get_backup - - Added operation CassandraClustersOperations.list_backups - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_partition_merge - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_list_sql_container_partition_merge - - Added operation SqlResourcesOperations.begin_sql_container_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_sql_database_partition_merge - - Added operation SqlResourcesOperations.begin_sql_database_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_database_retrieve_throughput_distribution - - Added operation group DataTransferJobsOperations - - Added operation group GraphResourcesOperations - - Added operation group MongoClustersOperations - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_burst_capacity - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model DatabaseAccountGetResults has a new parameter enable_burst_capacity - - Model DatabaseAccountGetResults has a new parameter enable_materialized_views - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountUpdateParameters has a new parameter enable_burst_capacity - - Model DatabaseAccountUpdateParameters has a new parameter enable_materialized_views - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetPropertiesResource has a new parameter create_mode - - Model GremlinDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinDatabaseResource has a new parameter create_mode - - Model GremlinDatabaseResource has a new parameter restore_parameters - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetPropertiesResource has a new parameter create_mode - - Model GremlinGraphGetPropertiesResource has a new parameter restore_parameters - - Model GremlinGraphGetResults has a new parameter identity - - Model GremlinGraphResource has a new parameter create_mode - - Model GremlinGraphResource has a new parameter restore_parameters - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetPropertiesResource has a new parameter create_mode - - Model MongoDBCollectionGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBCollectionGetResults has a new parameter identity - - Model MongoDBCollectionResource has a new parameter create_mode - - Model MongoDBCollectionResource has a new parameter restore_parameters - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model MongoDBDatabaseGetPropertiesResource has a new parameter create_mode - - Model MongoDBDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model MongoDBDatabaseResource has a new parameter create_mode - - Model MongoDBDatabaseResource has a new parameter restore_parameters - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter create_mode - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter materialized_view_definition - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter restore_parameters - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter create_mode - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter restore_parameters - - Model RestoreParameters has a new parameter source_backup_location - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetPropertiesResource has a new parameter create_mode - - Model SqlContainerGetPropertiesResource has a new parameter materialized_view_definition - - Model SqlContainerGetPropertiesResource has a new parameter restore_parameters - - Model SqlContainerGetResults has a new parameter identity - - Model SqlContainerResource has a new parameter create_mode - - Model SqlContainerResource has a new parameter materialized_view_definition - - Model SqlContainerResource has a new parameter restore_parameters - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseGetPropertiesResource has a new parameter create_mode - - Model SqlDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model SqlDatabaseGetResults has a new parameter identity - - Model SqlDatabaseResource has a new parameter create_mode - - Model SqlDatabaseResource has a new parameter restore_parameters - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model TableGetPropertiesResource has a new parameter create_mode - - Model TableGetPropertiesResource has a new parameter restore_parameters - - Model TableGetResults has a new parameter identity - - Model TableResource has a new parameter create_mode - - Model TableResource has a new parameter restore_parameters - - Model ThroughputSettingsGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - -### Breaking Changes - - - Model ThroughputSettingsGetPropertiesResource no longer has parameter instant_maximum_throughput - - Model ThroughputSettingsGetPropertiesResource no longer has parameter soft_allowed_maximum_throughput - - Model ThroughputSettingsResource no longer has parameter instant_maximum_throughput - - Model ThroughputSettingsResource no longer has parameter soft_allowed_maximum_throughput - -## 9.2.0 (2023-05-08) - -### Features Added - - - Model ContinuousModeBackupPolicy has a new parameter continuous_mode_properties - - Model RestorableDatabaseAccountGetResult has a new parameter oldest_restorable_time - - Model ThroughputSettingsGetPropertiesResource has a new parameter instant_maximum_throughput - - Model ThroughputSettingsGetPropertiesResource has a new parameter soft_allowed_maximum_throughput - - Model ThroughputSettingsResource has a new parameter instant_maximum_throughput - - Model ThroughputSettingsResource has a new parameter soft_allowed_maximum_throughput - - Added new enum type `ContinuousTier` - - Enum `PublicNetworkAccess` has a new value `SECURED_BY_PERIMETER` - -## 9.1.0 (2023-04-21) - -### Features Added - - - Model CassandraClusterDataCenterNodeItem has a new parameter cassandra_process_status - - Model CassandraClusterPublicStatus has a new parameter errors - - Model ClusterResourceProperties has a new parameter provision_error - - Model DataCenterResourceProperties has a new parameter authentication_method_ldap_properties - - Model DataCenterResourceProperties has a new parameter deallocated - - Model DataCenterResourceProperties has a new parameter provision_error - - Model DatabaseAccountConnectionString has a new parameter key_kind - - Model DatabaseAccountConnectionString has a new parameter type - - Model LocationProperties has a new parameter is_subscription_region_access_allowed_for_az - - Model LocationProperties has a new parameter is_subscription_region_access_allowed_for_regular - - Model LocationProperties has a new parameter status - -## 9.1.0b2 (2023-04-20) - -### Features Added - - - Added operation group MongoClustersOperations - -## 9.1.0b1 (2023-03-20) - -### Features Added - - - Added operation CassandraClustersOperations.get_backup - - Added operation CassandraClustersOperations.list_backups - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_list_sql_container_partition_merge - - Added operation SqlResourcesOperations.begin_sql_container_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_sql_database_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_database_retrieve_throughput_distribution - - Added operation group DataTransferJobsOperations - - Added operation group GraphResourcesOperations - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model ContinuousModeBackupPolicy has a new parameter continuous_mode_properties - - Model DataCenterResourceProperties has a new parameter authentication_method_ldap_properties - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_burst_capacity - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model DatabaseAccountGetResults has a new parameter enable_burst_capacity - - Model DatabaseAccountGetResults has a new parameter enable_materialized_views - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountUpdateParameters has a new parameter enable_burst_capacity - - Model DatabaseAccountUpdateParameters has a new parameter enable_materialized_views - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetPropertiesResource has a new parameter create_mode - - Model GremlinDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinDatabaseResource has a new parameter create_mode - - Model GremlinDatabaseResource has a new parameter restore_parameters - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetPropertiesResource has a new parameter create_mode - - Model GremlinGraphGetPropertiesResource has a new parameter restore_parameters - - Model GremlinGraphGetResults has a new parameter identity - - Model GremlinGraphResource has a new parameter create_mode - - Model GremlinGraphResource has a new parameter restore_parameters - - Model LocationProperties has a new parameter status - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetPropertiesResource has a new parameter create_mode - - Model MongoDBCollectionGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBCollectionGetResults has a new parameter identity - - Model MongoDBCollectionResource has a new parameter create_mode - - Model MongoDBCollectionResource has a new parameter restore_parameters - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model MongoDBDatabaseGetPropertiesResource has a new parameter create_mode - - Model MongoDBDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model MongoDBDatabaseResource has a new parameter create_mode - - Model MongoDBDatabaseResource has a new parameter restore_parameters - - Model RestorableDatabaseAccountGetResult has a new parameter oldest_restorable_time - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter create_mode - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter restore_parameters - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter create_mode - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter restore_parameters - - Model RestoreParameters has a new parameter source_backup_location - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetPropertiesResource has a new parameter create_mode - - Model SqlContainerGetPropertiesResource has a new parameter restore_parameters - - Model SqlContainerGetResults has a new parameter identity - - Model SqlContainerResource has a new parameter create_mode - - Model SqlContainerResource has a new parameter restore_parameters - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseGetPropertiesResource has a new parameter create_mode - - Model SqlDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model SqlDatabaseGetResults has a new parameter identity - - Model SqlDatabaseResource has a new parameter create_mode - - Model SqlDatabaseResource has a new parameter restore_parameters - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model TableGetPropertiesResource has a new parameter create_mode - - Model TableGetPropertiesResource has a new parameter restore_parameters - - Model TableGetResults has a new parameter identity - - Model TableResource has a new parameter create_mode - - Model TableResource has a new parameter restore_parameters - - Model ThroughputSettingsGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - -## 9.0.0 (2023-02-15) - -### Features Added - - - Added operation GremlinResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation SqlResourcesOperations.begin_create_update_client_encryption_key - - Added operation SqlResourcesOperations.get_client_encryption_key - - Added operation SqlResourcesOperations.list_client_encryption_keys - - Added operation TableResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group RestorableGremlinDatabasesOperations - - Added operation group RestorableGremlinGraphsOperations - - Added operation group RestorableGremlinResourcesOperations - - Added operation group RestorableTableResourcesOperations - - Added operation group RestorableTablesOperations - - Model DatabaseAccountCreateUpdateParameters has a new parameter minimal_tls_version - - Model DatabaseAccountGetResults has a new parameter minimal_tls_version - - Model DatabaseAccountUpdateParameters has a new parameter minimal_tls_version - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter client_encryption_policy - - Model RestoreParameters has a new parameter gremlin_databases_to_restore - - Model RestoreParameters has a new parameter tables_to_restore - - Model SqlContainerGetPropertiesResource has a new parameter client_encryption_policy - - Model SqlContainerResource has a new parameter client_encryption_policy - - Operation RestorableMongodbCollectionsOperations.list has a new optional parameter end_time - - Operation RestorableMongodbCollectionsOperations.list has a new optional parameter start_time - -## 9.0.0b2 (2022-10-26) - -### Features Added - - - Added model CosmosMongoDataTransferDataSourceSink - -## 9.0.0b1 (2022-10-10) - -### Features Added - - - Added operation CassandraClustersOperations.get_backup - - Added operation CassandraClustersOperations.list_backups - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation GremlinResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_database_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_create_update_client_encryption_key - - Added operation SqlResourcesOperations.begin_list_sql_container_partition_merge - - Added operation SqlResourcesOperations.begin_sql_container_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_sql_database_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_database_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.get_client_encryption_key - - Added operation SqlResourcesOperations.list_client_encryption_keys - - Added operation TableResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group DataTransferJobsOperations - - Added operation group GraphResourcesOperations - - Added operation group RestorableGremlinDatabasesOperations - - Added operation group RestorableGremlinGraphsOperations - - Added operation group RestorableGremlinResourcesOperations - - Added operation group RestorableTableResourcesOperations - - Added operation group RestorableTablesOperations - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model ContinuousModeBackupPolicy has a new parameter continuous_mode_properties - - Model DataCenterResourceProperties has a new parameter authentication_method_ldap_properties - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model DatabaseAccountGetResults has a new parameter enable_materialized_views - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountUpdateParameters has a new parameter enable_materialized_views - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model LocationProperties has a new parameter status - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetPropertiesResource has a new parameter create_mode - - Model MongoDBCollectionGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBCollectionGetResults has a new parameter identity - - Model MongoDBCollectionResource has a new parameter create_mode - - Model MongoDBCollectionResource has a new parameter restore_parameters - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model MongoDBDatabaseGetPropertiesResource has a new parameter create_mode - - Model MongoDBDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model MongoDBDatabaseResource has a new parameter create_mode - - Model MongoDBDatabaseResource has a new parameter restore_parameters - - Model RestorableDatabaseAccountGetResult has a new parameter oldest_restorable_time - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter client_encryption_policy - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter create_mode - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter restore_parameters - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter create_mode - - Model RestorableSqlDatabasePropertiesResourceDatabase has a new parameter restore_parameters - - Model RestoreParameters has a new parameter gremlin_databases_to_restore - - Model RestoreParameters has a new parameter tables_to_restore - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetPropertiesResource has a new parameter client_encryption_policy - - Model SqlContainerGetPropertiesResource has a new parameter create_mode - - Model SqlContainerGetPropertiesResource has a new parameter restore_parameters - - Model SqlContainerGetResults has a new parameter identity - - Model SqlContainerResource has a new parameter client_encryption_policy - - Model SqlContainerResource has a new parameter create_mode - - Model SqlContainerResource has a new parameter restore_parameters - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseGetPropertiesResource has a new parameter create_mode - - Model SqlDatabaseGetPropertiesResource has a new parameter restore_parameters - - Model SqlDatabaseGetResults has a new parameter identity - - Model SqlDatabaseResource has a new parameter create_mode - - Model SqlDatabaseResource has a new parameter restore_parameters - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - -### Breaking Changes - - - Operation RestorableMongodbCollectionsOperations.list has a new parameter end_time - - Operation RestorableMongodbCollectionsOperations.list has a new parameter start_time - -## 8.0.0 (2022-09-08) - -### Features Added - - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_user_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_user_definition - - Added operation MongoDBResourcesOperations.get_mongo_role_definition - - Added operation MongoDBResourcesOperations.get_mongo_user_definition - - Added operation MongoDBResourcesOperations.list_mongo_role_definitions - - Added operation MongoDBResourcesOperations.list_mongo_user_definitions - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_partition_merge - - Model DatabaseAccountCreateUpdateParameters has a new parameter keys_metadata - - Model DatabaseAccountGetResults has a new parameter enable_partition_merge - - Model DatabaseAccountGetResults has a new parameter keys_metadata - - Model DatabaseAccountUpdateParameters has a new parameter enable_partition_merge - - Model DatabaseAccountUpdateParameters has a new parameter keys_metadata - -## 8.0.0b2 (2022-08-11) - -### Breaking Changes - - - Renamed model `ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems` to `CassandraClusterDataCenterNodeItem` - - Renamed model `Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties` to `ManagedServiceIdentityUserAssignedIdentity` - -## 8.0.0b1 (2022-08-03) - -**Features** - - - Added operation CassandraClustersOperations.get_backup - - Added operation CassandraClustersOperations.list_backups - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation GremlinResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_user_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_user_definition - - Added operation MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution - - Added operation MongoDBResourcesOperations.get_mongo_role_definition - - Added operation MongoDBResourcesOperations.get_mongo_user_definition - - Added operation MongoDBResourcesOperations.list_mongo_role_definitions - - Added operation MongoDBResourcesOperations.list_mongo_user_definitions - - Added operation SqlResourcesOperations.begin_create_update_client_encryption_key - - Added operation SqlResourcesOperations.begin_list_sql_container_partition_merge - - Added operation SqlResourcesOperations.begin_sql_container_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.get_client_encryption_key - - Added operation SqlResourcesOperations.list_client_encryption_keys - - Added operation TableResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group DataTransferJobsOperations - - Added operation group GraphResourcesOperations - - Added operation group RestorableGremlinDatabasesOperations - - Added operation group RestorableGremlinGraphsOperations - - Added operation group RestorableGremlinResourcesOperations - - Added operation group RestorableTableResourcesOperations - - Added operation group RestorableTablesOperations - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model ContinuousModeBackupPolicy has a new parameter continuous_mode_properties - - Model DataCenterResourceProperties has a new parameter authentication_method_ldap_properties - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountCreateUpdateParameters has a new parameter keys_metadata - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model DatabaseAccountGetResults has a new parameter enable_materialized_views - - Model DatabaseAccountGetResults has a new parameter keys_metadata - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountUpdateParameters has a new parameter keys_metadata - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model LocationProperties has a new parameter status - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetResults has a new parameter identity - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model RestorableDatabaseAccountGetResult has a new parameter oldest_restorable_time - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter client_encryption_policy - - Model RestoreParameters has a new parameter gremlin_databases_to_restore - - Model RestoreParameters has a new parameter tables_to_restore - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetPropertiesResource has a new parameter client_encryption_policy - - Model SqlContainerGetResults has a new parameter identity - - Model SqlContainerResource has a new parameter client_encryption_policy - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseGetResults has a new parameter identity - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - -**Breaking changes** - - - Operation RestorableMongodbCollectionsOperations.list has a new parameter end_time - - Operation RestorableMongodbCollectionsOperations.list has a new parameter start_time - -## 7.0.0 (2022-07-22) - -**Features** - - - Added operation MongoDBResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group CassandraClustersOperations - - Added operation group CassandraDataCentersOperations - - Added operation group LocationsOperations - - Added operation group ServiceOperations - - Model DatabaseAccountCreateUpdateParameters has a new parameter capacity - - Model DatabaseAccountGetResults has a new parameter capacity - - Model DatabaseAccountUpdateParameters has a new parameter capacity - - Model GremlinGraphGetPropertiesResource has a new parameter analytical_storage_ttl - - Model GremlinGraphResource has a new parameter analytical_storage_ttl - - Model PeriodicModeProperties has a new parameter backup_storage_redundancy - -## 7.0.0b6 (2022-05-23) - -**Features** - - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution - -**Breaking changes** - - - Removed operation MongoDBResourcesOperations.begin_sql_container_retrieve_throughput_distribution - -## 7.0.0b5 (2022-04-28) - -**Features** - - - Added operation DataTransferJobsOperations.cancel - - Added operation DataTransferJobsOperations.pause - - Added operation DataTransferJobsOperations.resume - - Added operation MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput - - Added operation MongoDBResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Added operation SqlResourcesOperations.begin_sql_container_redistribute_throughput - - Added operation SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution - - Model DataTransferJobGetResults has a new parameter processed_count - - Model DataTransferJobGetResults has a new parameter total_count - - Model DataTransferJobProperties has a new parameter processed_count - - Model DataTransferJobProperties has a new parameter total_count - -**Breaking changes** - - - Model DataTransferJobGetResults no longer has parameter percentage_complete - - Model DataTransferJobProperties no longer has parameter percentage_complete - -## 7.0.0b4 (2022-04-14) - -**Features** - - - Added operation MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge - - Added operation SqlResourcesOperations.begin_list_sql_container_partition_merge - - Model ContinuousModeBackupPolicy has a new parameter continuous_mode_properties - - Model KeyWrapMetadata has a new parameter algorithm - - Model RestorableDatabaseAccountGetResult has a new parameter oldest_restorable_time - - Model RestorableSqlContainerPropertiesResourceContainer has a new parameter client_encryption_policy - - Model SqlContainerGetPropertiesResource has a new parameter client_encryption_policy - - Model SqlContainerResource has a new parameter client_encryption_policy - -## 7.0.0b3 (2022-02-18) - -**Features** - - - Added operation CassandraClustersOperations.get_backup - - Added operation CassandraClustersOperations.list_backups - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation GremlinResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_create_update_mongo_user_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_role_definition - - Added operation MongoDBResourcesOperations.begin_delete_mongo_user_definition - - Added operation MongoDBResourcesOperations.get_mongo_role_definition - - Added operation MongoDBResourcesOperations.get_mongo_user_definition - - Added operation MongoDBResourcesOperations.list_mongo_role_definitions - - Added operation MongoDBResourcesOperations.list_mongo_user_definitions - - Added operation SqlResourcesOperations.begin_create_update_client_encryption_key - - Added operation SqlResourcesOperations.get_client_encryption_key - - Added operation SqlResourcesOperations.list_client_encryption_keys - - Added operation TableResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group DataTransferJobsOperations - - Added operation group GraphResourcesOperations - - Added operation group RestorableGremlinDatabasesOperations - - Added operation group RestorableGremlinGraphsOperations - - Added operation group RestorableGremlinResourcesOperations - - Added operation group RestorableTableResourcesOperations - - Added operation group RestorableTablesOperations - - Added operation group ServiceOperations - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model DataCenterResourceProperties has a new parameter authentication_method_ldap_properties - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_materialized_views - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model DatabaseAccountGetResults has a new parameter enable_materialized_views - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Model DatabaseAccountUpdateParameters has a new parameter enable_materialized_views - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model LocationProperties has a new parameter status - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetResults has a new parameter identity - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model RestoreParameters has a new parameter gremlin_databases_to_restore - - Model RestoreParameters has a new parameter tables_to_restore - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetResults has a new parameter identity - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseGetResults has a new parameter identity - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - -**Breaking changes** - - - Operation RestorableMongodbCollectionsOperations.list has a new signature - - Operation RestorableMongodbCollectionsOperations.list has a new signature - -## 7.0.0b2 (2021-10-26) - -**Features** - - - Model DataCenterResourceProperties has a new parameter disk_capacity - - Model DataCenterResourceProperties has a new parameter disk_sku - - Model DataCenterResourceProperties has a new parameter managed_disk_customer_key_uri - - Model DataCenterResourceProperties has a new parameter sku - - Model DataCenterResourceProperties has a new parameter availability_zone - - Model DataCenterResourceProperties has a new parameter backup_storage_customer_key_uri - - Model DatabaseAccountCreateUpdateParameters has a new parameter capacity - - Model DatabaseAccountUpdateParameters has a new parameter capacity - - Model ClusterResourceProperties has a new parameter cassandra_audit_logging_enabled - - Model ClusterResourceProperties has a new parameter deallocated - - Model DatabaseAccountGetResults has a new parameter capacity - - Added operation MongoDBResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation CassandraClustersOperations.begin_invoke_command - - Added operation CassandraClustersOperations.begin_start - - Added operation CassandraClustersOperations.begin_deallocate - - Added operation CassandraClustersOperations.status - - Added operation group LocationsOperations - -**Breaking changes** - - - Model MongoDBDatabaseGetResults no longer has parameter identity - - Model MongoDBDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlContainerGetResults no longer has parameter identity - - Model SqlUserDefinedFunctionGetResults no longer has parameter identity - - Model GremlinDatabaseGetResults no longer has parameter identity - - Model SqlTriggerCreateUpdateParameters no longer has parameter identity - - Model SqlContainerCreateUpdateParameters no longer has parameter identity - - Model SqlDatabaseCreateUpdateParameters no longer has parameter identity - - Model LocationProperties no longer has parameter status - - Model DatabaseAccountCreateUpdateParameters no longer has parameter diagnostic_log_settings - - Model ThroughputSettingsGetResults no longer has parameter identity - - Model DatabaseAccountUpdateParameters no longer has parameter diagnostic_log_settings - - Model ARMResourceProperties no longer has parameter identity - - Model CassandraTableGetResults no longer has parameter identity - - Model GremlinGraphGetResults no longer has parameter identity - - Model CassandraKeyspaceCreateUpdateParameters no longer has parameter identity - - Model GremlinDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlTriggerGetResults no longer has parameter identity - - Model GremlinGraphCreateUpdateParameters no longer has parameter identity - - Model MongoDBCollectionGetResults no longer has parameter identity - - Model TableGetResults no longer has parameter identity - - Model CassandraKeyspaceGetResults no longer has parameter identity - - Model MongoDBCollectionCreateUpdateParameters no longer has parameter identity - - Model SqlStoredProcedureGetResults no longer has parameter identity - - Model SqlStoredProcedureCreateUpdateParameters no longer has parameter identity - - Model ThroughputSettingsUpdateParameters no longer has parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters no longer has parameter identity - - Model TableCreateUpdateParameters no longer has parameter identity - - Model DatabaseAccountGetResults no longer has parameter diagnostic_log_settings - - Model SqlDatabaseGetResults no longer has parameter identity - - Model CassandraTableCreateUpdateParameters no longer has parameter identity - - Removed operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Removed operation CassandraResourcesOperations.get_cassandra_view - - Removed operation CassandraResourcesOperations.list_cassandra_views - - Removed operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Removed operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Removed operation CassandraResourcesOperations.get_cassandra_view_throughput - - Removed operation CassandraResourcesOperations.begin_delete_cassandra_view - - Removed operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Removed operation CassandraClustersOperations.begin_request_repair - - Removed operation CassandraClustersOperations.begin_fetch_node_status - - Removed operation CassandraClustersOperations.get_backup - - Removed operation CassandraClustersOperations.list_backups - - Removed operation group ServiceOperations - - Removed operation group CosmosDBManagementClientOperationsMixin - - Removed operation group GraphResourcesOperations - -## 7.0.0b1 (2021-09-17) - -**Features** - - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model DatabaseAccountCreateUpdateParameters has a new parameter diagnostic_log_settings - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlDatabaseGetResults has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model PeriodicModeProperties has a new parameter backup_storage_redundancy - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetResults has a new parameter identity - - Model DatabaseAccountGetResults has a new parameter diagnostic_log_settings - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model MongoDBCollectionGetResults has a new parameter identity - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model ARMResourceProperties has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model DatabaseAccountUpdateParameters has a new parameter diagnostic_log_settings - - Added operation CassandraResourcesOperations.begin_create_update_cassandra_view - - Added operation CassandraResourcesOperations.get_cassandra_view_throughput - - Added operation CassandraResourcesOperations.get_cassandra_view - - Added operation CassandraResourcesOperations.list_cassandra_views - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput - - Added operation CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale - - Added operation CassandraResourcesOperations.begin_delete_cassandra_view - - Added operation CassandraResourcesOperations.begin_update_cassandra_view_throughput - - Added operation group CassandraClustersOperations - - Added operation group CassandraDataCentersOperations - - Added operation group ServiceOperations - - Added operation group CosmosDBManagementClientOperationsMixin - - Added operation group GraphResourcesOperations - -**Breaking changes** - - - Parameter create_mode of model DatabaseAccountCreateUpdateParameters is now required - -## 6.4.0 (2021-06-22) - -**Features** - - - Model ContinuousModeBackupPolicy has a new parameter migration_state - - Model DatabaseAccountGetResults has a new parameter restore_parameters - - Model DatabaseAccountGetResults has a new parameter analytical_storage_configuration - - Model DatabaseAccountGetResults has a new parameter system_data - - Model DatabaseAccountGetResults has a new parameter instance_id - - Model DatabaseAccountGetResults has a new parameter disable_local_auth - - Model DatabaseAccountGetResults has a new parameter create_mode - - Model BackupPolicy has a new parameter migration_state - - Model DatabaseAccountCreateUpdateParameters has a new parameter analytical_storage_configuration - - Model DatabaseAccountCreateUpdateParameters has a new parameter restore_parameters - - Model DatabaseAccountCreateUpdateParameters has a new parameter disable_local_auth - - Model DatabaseAccountCreateUpdateParameters has a new parameter create_mode - - Model PeriodicModeBackupPolicy has a new parameter migration_state - - Model DatabaseAccountUpdateParameters has a new parameter analytical_storage_configuration - - Model DatabaseAccountUpdateParameters has a new parameter disable_local_auth - - Added operation SqlResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation group RestorableMongodbDatabasesOperations - - Added operation group RestorableDatabaseAccountsOperations - - Added operation group RestorableSqlDatabasesOperations - - Added operation group RestorableSqlContainersOperations - - Added operation group RestorableMongodbResourcesOperations - - Added operation group RestorableMongodbCollectionsOperations - - Added operation group RestorableSqlResourcesOperations - -## 6.3.0 (2021-05-14) - -**Breaking changes** - - - Model CassandraKeyspaceCreateUpdateParameters no longer has parameter identity - - Model ARMResourceProperties no longer has parameter identity - - Model MongoDBCollectionCreateUpdateParameters no longer has parameter identity - - Model SqlDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlStoredProcedureCreateUpdateParameters no longer has parameter identity - - Model SqlTriggerGetResults no longer has parameter identity - - Model MongoDBDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlDatabaseGetResults no longer has parameter identity - - Model TableGetResults no longer has parameter identity - - Model CassandraTableCreateUpdateParameters no longer has parameter identity - - Model GremlinGraphCreateUpdateParameters no longer has parameter identity - - Model GremlinDatabaseGetResults no longer has parameter identity - - Model ThroughputSettingsUpdateParameters no longer has parameter identity - - Model CassandraKeyspaceGetResults no longer has parameter identity - - Model SqlContainerGetResults no longer has parameter identity - - Model SqlUserDefinedFunctionGetResults no longer has parameter identity - - Model SqlTriggerCreateUpdateParameters no longer has parameter identity - - Model MongoDBCollectionGetResults no longer has parameter identity - - Model MongoDBDatabaseGetResults no longer has parameter identity - - Model PeriodicModeProperties no longer has parameter backup_storage_redundancy - - Model ThroughputSettingsGetResults no longer has parameter identity - - Model GremlinGraphGetResults no longer has parameter identity - - Model GremlinDatabaseCreateUpdateParameters no longer has parameter identity - - Model CassandraTableGetResults no longer has parameter identity - - Model SqlStoredProcedureGetResults no longer has parameter identity - - Model TableCreateUpdateParameters no longer has parameter identity - - Model DatabaseAccountGetResults no longer has parameter create_mode - - Model DatabaseAccountGetResults no longer has parameter restore_parameters - - Model DatabaseAccountGetResults no longer has parameter instance_id - - Model DatabaseAccountGetResults no longer has parameter system_data - - Model SqlUserDefinedFunctionCreateUpdateParameters no longer has parameter identity - - Model SqlContainerCreateUpdateParameters no longer has parameter identity - - Removed operation SqlResourcesOperations.begin_retrieve_continuous_backup_information - - Model DatabaseAccountCreateUpdateParameters has a new signature - - Removed operation group RestorableDatabaseAccountsOperations - - Removed operation group RestorableMongodbCollectionsOperations - - Removed operation group CosmosDBManagementClientOperationsMixin - - Removed operation group RestorableSqlResourcesOperations - - Removed operation group RestorableMongodbDatabasesOperations - - Removed operation group CassandraClustersOperations - - Removed operation group RestorableMongodbResourcesOperations - - Removed operation group RestorableSqlContainersOperations - - Removed operation group CassandraDataCentersOperations - - Removed operation group RestorableSqlDatabasesOperations - - Removed operation group ServiceOperations - -## 6.3.0b1 (2021-05-10) - -**Features** - - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model SqlContainerGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model PeriodicModeProperties has a new parameter backup_storage_redundancy - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetResults has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model SqlDatabaseGetResults has a new parameter identity - - Model ARMResourceProperties has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model DatabaseAccountGetResults has a new parameter instance_id - - Model DatabaseAccountGetResults has a new parameter restore_parameters - - Model DatabaseAccountGetResults has a new parameter system_data - - Model DatabaseAccountGetResults has a new parameter create_mode - - Added operation SqlResourcesOperations.begin_create_update_sql_role_assignment - - Added operation SqlResourcesOperations.begin_retrieve_continuous_backup_information - - Added operation SqlResourcesOperations.begin_delete_sql_role_assignment - - Added operation SqlResourcesOperations.begin_create_update_sql_role_definition - - Added operation SqlResourcesOperations.list_sql_role_definitions - - Added operation SqlResourcesOperations.begin_delete_sql_role_definition - - Added operation SqlResourcesOperations.list_sql_role_assignments - - Added operation SqlResourcesOperations.get_sql_role_assignment - - Added operation SqlResourcesOperations.get_sql_role_definition - - Added operation group CassandraDataCentersOperations - - Added operation group RestorableSqlContainersOperations - - Added operation group CassandraClustersOperations - - Added operation group RestorableMongodbResourcesOperations - - Added operation group RestorableMongodbDatabasesOperations - - Added operation group RestorableDatabaseAccountsOperations - - Added operation group RestorableMongodbCollectionsOperations - - Added operation group CosmosDBManagementClientOperationsMixin - - Added operation group RestorableSqlResourcesOperations - - Added operation group ServiceOperations - - Added operation group RestorableSqlDatabasesOperations - -**Breaking changes** - - - Model DatabaseAccountCreateUpdateParameters has a new signature - -## 6.2.0 (2021-04-06) - -**Features** - - - Model DatabaseAccountUpdateParameters has a new parameter default_identity - - Model DatabaseAccountCreateUpdateParameters has a new parameter default_identity - - Model DatabaseAccountGetResults has a new parameter default_identity - -## 6.1.0 (2021-03-02) - -**Features** - - - Model DatabaseAccountGetResults has a new parameter network_acl_bypass - - Model DatabaseAccountGetResults has a new parameter backup_policy - - Model DatabaseAccountGetResults has a new parameter identity - - Model DatabaseAccountGetResults has a new parameter network_acl_bypass_resource_ids - - Model PrivateEndpointConnection has a new parameter group_id - - Model PrivateEndpointConnection has a new parameter provisioning_state - - Model ContainerPartitionKey has a new parameter system_key - - Model DatabaseAccountUpdateParameters has a new parameter network_acl_bypass - - Model DatabaseAccountUpdateParameters has a new parameter backup_policy - - Model DatabaseAccountUpdateParameters has a new parameter identity - - Model DatabaseAccountUpdateParameters has a new parameter network_acl_bypass_resource_ids - - Model PrivateLinkServiceConnectionStateProperty has a new parameter description - - Model DatabaseAccountCreateUpdateParameters has a new parameter network_acl_bypass - - Model DatabaseAccountCreateUpdateParameters has a new parameter backup_policy - - Model DatabaseAccountCreateUpdateParameters has a new parameter identity - - Model DatabaseAccountCreateUpdateParameters has a new parameter network_acl_bypass_resource_ids - -## 6.0.0 (2020-11-24) - -- GA release - -## 6.0.0b1 (2020-10-12) - -This is beta preview version. - -This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). - -**General breaking changes** - -- Credential system has been completly revamped: - - - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ - - `credentials` parameter has been renamed `credential` - -- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of - supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) -- You can't import a `version` module anymore, use `__version__` instead -- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. -- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). -- Most of the operation kwarg have changed. Some of the most noticeable: - - - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user - - For a complete set of - supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) - -**General new features** - -- Type annotations support using `typing`. SDKs are mypy ready. -- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. -- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/core/azure-core-tracing-opentelemetry) for an overview. - -## 1.0.0 (2020-08-17) - -**Features** - - - Model SqlContainerGetPropertiesResource has a new parameter analytical_storage_ttl - - Model DatabaseAccountUpdateParameters has a new parameter cors - - Model SqlContainerResource has a new parameter analytical_storage_ttl - - Model DatabaseAccountGetResults has a new parameter cors - - Added operation MongoDBResourcesOperations.migrate_mongo_db_collection_to_manual_throughput - - Added operation MongoDBResourcesOperations.migrate_mongo_db_database_to_manual_throughput - - Added operation MongoDBResourcesOperations.migrate_mongo_db_database_to_autoscale - - Added operation MongoDBResourcesOperations.migrate_mongo_db_collection_to_autoscale - - Added operation GremlinResourcesOperations.migrate_gremlin_database_to_manual_throughput - - Added operation GremlinResourcesOperations.migrate_gremlin_graph_to_autoscale - - Added operation GremlinResourcesOperations.migrate_gremlin_graph_to_manual_throughput - - Added operation GremlinResourcesOperations.migrate_gremlin_database_to_autoscale - - Added operation TableResourcesOperations.migrate_table_to_autoscale - - Added operation TableResourcesOperations.migrate_table_to_manual_throughput - - Added operation CassandraResourcesOperations.migrate_cassandra_keyspace_to_autoscale - - Added operation CassandraResourcesOperations.migrate_cassandra_keyspace_to_manual_throughput - - Added operation CassandraResourcesOperations.migrate_cassandra_table_to_manual_throughput - - Added operation CassandraResourcesOperations.migrate_cassandra_table_to_autoscale - - Added operation SqlResourcesOperations.migrate_sql_database_to_manual_throughput - - Added operation SqlResourcesOperations.migrate_sql_database_to_autoscale - - Added operation SqlResourcesOperations.migrate_sql_container_to_autoscale - - Added operation SqlResourcesOperations.migrate_sql_container_to_manual_throughput - -**Breaking changes** - - - Model ThroughputSettingsUpdateParameters no longer has parameter identity - - Model CassandraKeyspaceCreateUpdateParameters no longer has parameter identity - - Model SqlTriggerCreateUpdateParameters no longer has parameter identity - - Model SqlContainerGetResults no longer has parameter identity - - Model MongoDBDatabaseGetResults no longer has parameter identity - - Model GremlinGraphGetResults no longer has parameter identity - - Model SqlUserDefinedFunctionGetResults no longer has parameter identity - - Model CassandraTableGetResults no longer has parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters no longer has parameter identity - - Model SqlDatabaseGetResults no longer has parameter identity - - Model MongoDBCollectionGetResults no longer has parameter identity - - Model SqlStoredProcedureGetResults no longer has parameter identity - - Model GremlinDatabaseGetResults no longer has parameter identity - - Model MongoDBDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlTriggerGetResults no longer has parameter identity - - Model CassandraKeyspaceGetResults no longer has parameter identity - - Model DatabaseAccountUpdateParameters no longer has parameter backup_policy - - Model SqlStoredProcedureCreateUpdateParameters no longer has parameter identity - - Model TableCreateUpdateParameters no longer has parameter identity - - Model GremlinDatabaseCreateUpdateParameters no longer has parameter identity - - Model SqlDatabaseCreateUpdateParameters no longer has parameter identity - - Model MongoDBCollectionCreateUpdateParameters no longer has parameter identity - - Model DatabaseAccountGetResults no longer has parameter instance_id - - Model DatabaseAccountGetResults no longer has parameter system_data - - Model DatabaseAccountGetResults no longer has parameter backup_policy - - Model DatabaseAccountGetResults no longer has parameter identity - - Model DatabaseAccountGetResults no longer has parameter create_mode - - Model DatabaseAccountGetResults no longer has parameter restore_parameters - - Model SqlContainerCreateUpdateParameters no longer has parameter identity - - Model GremlinGraphCreateUpdateParameters no longer has parameter identity - - Model ARMResourceProperties no longer has parameter identity - - Model CassandraTableCreateUpdateParameters no longer has parameter identity - - Model ThroughputSettingsGetResults no longer has parameter identity - - Model TableGetResults no longer has parameter identity - - Model DatabaseAccountCreateUpdateParameters has a new signature - - Removed operation group RestorableDatabaseAccountsOperations - -## 0.16.0 (2020-07-31) - -**Features** - - - Model SqlUserDefinedFunctionGetResults has a new parameter identity - - Model CassandraKeyspaceCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionGetResults has a new parameter identity - - Model TableGetResults has a new parameter identity - - Model SqlTriggerGetResults has a new parameter identity - - Model SqlStoredProcedureCreateUpdateParameters has a new parameter identity - - Model SqlDatabaseCreateUpdateParameters has a new parameter identity - - Model CassandraTableGetResults has a new parameter identity - - Model MongoDBDatabaseCreateUpdateParameters has a new parameter identity - - Model ThroughputSettingsGetResults has a new parameter identity - - Model TableCreateUpdateParameters has a new parameter identity - - Model SqlContainerCreateUpdateParameters has a new parameter identity - - Model DatabaseAccountUpdateParameters has a new parameter backup_policy - - Model SqlDatabaseGetResults has a new parameter identity - - Model MongoDBDatabaseGetResults has a new parameter identity - - Model SqlUserDefinedFunctionCreateUpdateParameters has a new parameter identity - - Model CassandraTableCreateUpdateParameters has a new parameter identity - - Model MongoDBCollectionCreateUpdateParameters has a new parameter identity - - Model SqlStoredProcedureGetResults has a new parameter identity - - Model ThroughputSettingsUpdateParameters has a new parameter identity - - Model GremlinDatabaseCreateUpdateParameters has a new parameter identity - - Model GremlinDatabaseGetResults has a new parameter identity - - Model ARMResourceProperties has a new parameter identity - - Model CassandraKeyspaceGetResults has a new parameter identity - - Model SqlContainerGetResults has a new parameter identity - - Model GremlinGraphCreateUpdateParameters has a new parameter identity - - Model GremlinGraphGetResults has a new parameter identity - - Model SqlTriggerCreateUpdateParameters has a new parameter identity - - Model DatabaseAccountGetResults has a new parameter system_data - - Model DatabaseAccountGetResults has a new parameter backup_policy - - Model DatabaseAccountGetResults has a new parameter create_mode - - Model DatabaseAccountGetResults has a new parameter instance_id - - Model DatabaseAccountGetResults has a new parameter identity - - Model DatabaseAccountGetResults has a new parameter restore_parameters - - Added operation group RestorableDatabaseAccountsOperations - -**Breaking changes** - - - Model DatabaseAccountCreateUpdateParameters has a new signature - -## 0.15.0 (2020-06-11) - -**Features** - - - Model MongoDBCollectionResource has a new parameter analytical_storage_ttl - - Model MongoDBDatabaseGetPropertiesOptions has a new parameter autoscale_settings - - Model ThroughputSettingsGetPropertiesResource has a new parameter autoscale_settings - - Model SqlContainerGetPropertiesOptions has a new parameter autoscale_settings - - Model CassandraTableGetPropertiesResource has a new parameter analytical_storage_ttl - - Model CassandraTableResource has a new parameter analytical_storage_ttl - - Model OptionsResource has a new parameter autoscale_settings - - Model TableGetPropertiesOptions has a new parameter autoscale_settings - - Model ThroughputSettingsResource has a new parameter autoscale_settings - - Model CassandraTableGetPropertiesOptions has a new parameter autoscale_settings - - Model GremlinDatabaseGetPropertiesOptions has a new parameter autoscale_settings - - Model DatabaseAccountGetResults has a new parameter api_properties - - Model DatabaseAccountGetResults has a new parameter ip_rules - - Model DatabaseAccountGetResults has a new parameter enable_free_tier - - Model DatabaseAccountGetResults has a new parameter enable_analytical_storage - - Model GremlinGraphGetPropertiesOptions has a new parameter autoscale_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter api_properties - - Model DatabaseAccountCreateUpdateParameters has a new parameter ip_rules - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_free_tier - - Model DatabaseAccountCreateUpdateParameters has a new parameter enable_analytical_storage - - Model MongoDBCollectionGetPropertiesOptions has a new parameter autoscale_settings - - Model CassandraKeyspaceGetPropertiesOptions has a new parameter autoscale_settings - - Model SqlDatabaseGetPropertiesOptions has a new parameter autoscale_settings - - Model DatabaseAccountUpdateParameters has a new parameter api_properties - - Model DatabaseAccountUpdateParameters has a new parameter ip_rules - - Model DatabaseAccountUpdateParameters has a new parameter enable_free_tier - - Model DatabaseAccountUpdateParameters has a new parameter enable_analytical_storage - - Model MongoDBCollectionGetPropertiesResource has a new parameter analytical_storage_ttl - -**Breaking changes** - - - Model ThroughputSettingsGetPropertiesResource no longer has parameter provisioned_throughput_settings - - Model ThroughputSettingsResource no longer has parameter provisioned_throughput_settings - - Model DatabaseAccountGetResults no longer has parameter ip_range_filter - - Model DatabaseAccountCreateUpdateParameters no longer has parameter ip_range_filter - - Model DatabaseAccountUpdateParameters no longer has parameter ip_range_filter - - Model CreateUpdateOptions has a new signature - -## 0.14.0 (2020-05-05) - -**Features** - - - Model DatabaseAccountGetResults has a new parameter private_endpoint_connections - -## 0.13.0 (2020-04-18) - -**Features** - - - Model DatabaseAccountUpdateParameters has a new parameter public_network_access - - Model DatabaseAccountCreateUpdateParameters has a new parameter public_network_access - - Model GremlinGraphGetResults has a new parameter options - - Model PrivateLinkResource has a new parameter required_zone_names - - Model ThroughputSettingsGetPropertiesResource has a new parameter provisioned_throughput_settings - - Model PrivateEndpointConnection has a new parameter group_id - - Model PrivateEndpointConnection has a new parameter provisioning_state - - Model MongoDBDatabaseGetResults has a new parameter options - - Model SqlContainerGetResults has a new parameter options - - Model TableGetResults has a new parameter options - - Model SqlDatabaseGetResults has a new parameter options - - Model CassandraKeyspaceGetResults has a new parameter options - - Model ThroughputSettingsResource has a new parameter provisioned_throughput_settings - - Model DatabaseAccountGetResults has a new parameter public_network_access - - Model GremlinDatabaseGetResults has a new parameter options - - Model MongoDBCollectionGetResults has a new parameter options - - Model CassandraTableGetResults has a new parameter options - - Added operation group NotebookWorkspacesOperations - -**Breaking changes** - - - Model ThroughputSettingsGetPropertiesResource no longer has parameter autopilot_settings - - Model ThroughputSettingsResource no longer has parameter autopilot_settings - - Operation PrivateEndpointConnectionsOperations.create_or_update has a new signature - -## 0.12.0 (2020-02-27) - -**Features** - - - Model DatabaseAccountGetResults has a new parameter key_vault_key_uri - - Model ThroughputSettingsResource has a new parameter autopilot_settings - - Model ThroughputSettingsGetPropertiesResource has a new parameter autopilot_settings - - Model DatabaseAccountCreateUpdateParameters has a new parameter key_vault_key_uri - - Model DatabaseAccountUpdateParameters has a new parameter key_vault_key_uri - -## 0.11.0 (2019-12-07) - -**Features** - - - Model GremlinDatabaseGetResults has a new parameter resource - - Model ThroughputSettingsGetResults has a new parameter resource - - Model SqlStoredProcedureGetResults has a new parameter resource - - Model MongoDBDatabaseGetResults has a new parameter resource - - Model SqlUserDefinedFunctionGetResults has a new parameter resource - - Model TableGetResults has a new parameter resource - - Model IndexingPolicy has a new parameter composite_indexes - - Model IndexingPolicy has a new parameter spatial_indexes - - Model CassandraKeyspaceGetResults has a new parameter resource - - Model SqlDatabaseGetResults has a new parameter resource - -**Breaking changes** - - - Model GremlinDatabaseGetResults no longer has parameter _etag - - Model GremlinDatabaseGetResults no longer has parameter - gremlin_database_get_results_id - - Model GremlinDatabaseGetResults no longer has parameter _ts - - Model GremlinDatabaseGetResults no longer has parameter _rid - - Model ThroughputSettingsGetResults no longer has parameter - minimum_throughput - - Model ThroughputSettingsGetResults no longer has parameter - offer_replace_pending - - Model ThroughputSettingsGetResults no longer has parameter - throughput - - Model SqlStoredProcedureGetResults no longer has parameter _etag - - Model SqlStoredProcedureGetResults no longer has parameter _ts - - Model SqlStoredProcedureGetResults no longer has parameter _rid - - Model SqlStoredProcedureGetResults no longer has parameter body - - Model SqlStoredProcedureGetResults no longer has parameter - sql_stored_procedure_get_results_id - - Model MongoDBDatabaseGetResults no longer has parameter _etag - - Model MongoDBDatabaseGetResults no longer has parameter - mongo_db_database_get_results_id - - Model MongoDBDatabaseGetResults no longer has parameter _ts - - Model MongoDBDatabaseGetResults no longer has parameter _rid - - Model SqlUserDefinedFunctionGetResults no longer has parameter - _etag - - Model SqlUserDefinedFunctionGetResults no longer has parameter - sql_user_defined_function_get_results_id - - Model SqlUserDefinedFunctionGetResults no longer has parameter _ts - - Model SqlUserDefinedFunctionGetResults no longer has parameter _rid - - Model SqlUserDefinedFunctionGetResults no longer has parameter body - - Model TableGetResults no longer has parameter _etag - - Model TableGetResults no longer has parameter - table_get_results_id - - Model TableGetResults no longer has parameter _ts - - Model TableGetResults no longer has parameter _rid - - Model CassandraKeyspaceGetResults no longer has parameter _etag - - Model CassandraKeyspaceGetResults no longer has parameter - cassandra_keyspace_get_results_id - - Model CassandraKeyspaceGetResults no longer has parameter _ts - - Model CassandraKeyspaceGetResults no longer has parameter _rid - - Model SqlDatabaseGetResults no longer has parameter _colls - - Model SqlDatabaseGetResults no longer has parameter _etag - - Model SqlDatabaseGetResults no longer has parameter _users - - Model SqlDatabaseGetResults no longer has parameter - sql_database_get_results_id - - Model SqlDatabaseGetResults no longer has parameter _rid - - Model SqlDatabaseGetResults no longer has parameter _ts - - Model GremlinGraphGetResults has a new signature - - Model CassandraTableGetResults has a new signature - - Model SqlTriggerGetResults has a new signature - - Model SqlContainerGetResults has a new signature - - Model MongoDBCollectionGetResults has a new signature - -## 0.10.0 (2019-11-13) - -**Features** - - - Model DatabaseAccountCreateUpdateParameters has a new parameter - disable_key_based_metadata_write_access - - Model ContainerPartitionKey has a new parameter version - - Added operation DatabaseAccountsOperations.update - - Added operation group SqlResourcesOperations - - Added operation group MongoDBResourcesOperations - - Added operation group TableResourcesOperations - - Added operation group GremlinResourcesOperations - - Added operation group CassandraResourcesOperations - -**Breaking changes** - - - CosmosDB has been renamed to CosmosDBManagementClient - - CosmosDBConfiguration was renamed to - CosmodDBManagementClientConfiguration - - Model MongoDBCollectionCreateUpdateParameters has a new signature - - Model GremlinGraphCreateUpdateParameters has a new signature - - Model CassandraKeyspaceCreateUpdateParameters has a new signature - - Model GremlinDatabaseCreateUpdateParameters has a new signature - - Model SqlContainerCreateUpdateParameters has a new signature - - Model CassandraTableCreateUpdateParameters has a new signature - - Model TableCreateUpdateParameters has a new signature - - Model MongoDBDatabaseCreateUpdateParameters has a new signature - - Model SqlDatabaseCreateUpdateParameters has a new signature - - Removed operation - DatabaseAccountsOperations.get_gremlin_graph_throughput - - Removed operation - DatabaseAccountsOperations.update_cassandra_keyspace_throughput - - Removed operation DatabaseAccountsOperations.delete_sql_database - - Removed operation - DatabaseAccountsOperations.update_sql_database_throughput - - Removed operation - DatabaseAccountsOperations.update_mongo_db_database_throughput - - Removed operation - DatabaseAccountsOperations.delete_mongo_db_collection - - Removed operation - DatabaseAccountsOperations.list_mongo_db_databases - - Removed operation - DatabaseAccountsOperations.create_update_mongo_db_database - - Removed operation - DatabaseAccountsOperations.create_update_gremlin_graph - - Removed operation - DatabaseAccountsOperations.update_gremlin_database_throughput - - Removed operation - DatabaseAccountsOperations.get_mongo_db_collection - - Removed operation - DatabaseAccountsOperations.delete_gremlin_database - - Removed operation - DatabaseAccountsOperations.create_update_cassandra_keyspace - - Removed operation DatabaseAccountsOperations.get_sql_database - - Removed operation DatabaseAccountsOperations.get_table - - Removed operation - DatabaseAccountsOperations.update_table_throughput - - Removed operation - DatabaseAccountsOperations.create_update_mongo_db_collection - - Removed operation DatabaseAccountsOperations.get_gremlin_database - - Removed operation - DatabaseAccountsOperations.create_update_sql_container - - Removed operation - DatabaseAccountsOperations.create_update_gremlin_database - - Removed operation DatabaseAccountsOperations.get_table_throughput - - Removed operation - DatabaseAccountsOperations.delete_mongo_db_database - - Removed operation - DatabaseAccountsOperations.get_cassandra_table_throughput - - Removed operation - DatabaseAccountsOperations.update_sql_container_throughput - - Removed operation DatabaseAccountsOperations.get_cassandra_table - - Removed operation - DatabaseAccountsOperations.list_gremlin_databases - - Removed operation DatabaseAccountsOperations.list_gremlin_graphs - - Removed operation - DatabaseAccountsOperations.list_mongo_db_collections - - Removed operation - DatabaseAccountsOperations.create_update_cassandra_table - - Removed operation - DatabaseAccountsOperations.delete_cassandra_keyspace - - Removed operation - DatabaseAccountsOperations.update_cassandra_table_throughput - - Removed operation - DatabaseAccountsOperations.update_gremlin_graph_throughput - - Removed operation DatabaseAccountsOperations.create_update_table - - Removed operation - DatabaseAccountsOperations.get_mongo_db_database_throughput - - Removed operation DatabaseAccountsOperations.get_sql_container - - Removed operation - DatabaseAccountsOperations.get_gremlin_database_throughput - - Removed operation - DatabaseAccountsOperations.get_mongo_db_collection_throughput - - Removed operation DatabaseAccountsOperations.list_cassandra_tables - - Removed operation - DatabaseAccountsOperations.get_sql_database_throughput - - Removed operation DatabaseAccountsOperations.list_sql_databases - - Removed operation DatabaseAccountsOperations.list_tables - - Removed operation - DatabaseAccountsOperations.get_cassandra_keyspace - - Removed operation DatabaseAccountsOperations.get_gremlin_graph - - Removed operation - DatabaseAccountsOperations.get_mongo_db_database - - Removed operation DatabaseAccountsOperations.delete_table - - Removed operation - DatabaseAccountsOperations.list_cassandra_keyspaces - - Removed operation DatabaseAccountsOperations.list_sql_containers - - Removed operation DatabaseAccountsOperations.delete_sql_container - - Removed operation DatabaseAccountsOperations.delete_gremlin_graph - - Removed operation - DatabaseAccountsOperations.get_cassandra_keyspace_throughput - - Removed operation - DatabaseAccountsOperations.get_sql_container_throughput - - Removed operation - DatabaseAccountsOperations.delete_cassandra_table - - Removed operation DatabaseAccountsOperations.patch - - Removed operation - DatabaseAccountsOperations.create_update_sql_database - - Removed operation - DatabaseAccountsOperations.update_mongo_db_collection_throughput - -## 0.9.0 (2019-11-09) - -**Features** - - - Added operation group PrivateLinkResourcesOperations - - Added operation group PrivateEndpointConnectionsOperations - -## 0.8.0 (2019-08-15) - -**Features** - - - Model DatabaseAccount has a new parameter - enable_cassandra_connector - - Model DatabaseAccount has a new parameter connector_offer - - Model DatabaseAccountCreateUpdateParameters has a new parameter - enable_cassandra_connector - - Model DatabaseAccountCreateUpdateParameters has a new parameter - connector_offer - -**General breaking changes** - -This version uses a next-generation code generator that *might* -introduce breaking changes if from some import. In summary, some modules -were incorrectly visible/importable and have been renamed. This fixed -several issues caused by usage of classes that were not supposed to be -used in the first place. - - - CosmosDB cannot be imported from `azure.mgmt.cosmosdb.cosmos_db` - anymore (import from `azure.mgmt.cosmosdb` works like before) - - CosmosDBConfiguration import has been moved from - `azure.mgmt.cosmosdb.cosmos_db` to `azure.mgmt.cosmosdb` - - A model `MyClass` from a "models" sub-module cannot be imported - anymore using `azure.mgmt.cosmosdb.models.my_class` (import from - `azure.mgmt.cosmosdb.models` works like before) - - An operation class `MyClassOperations` from an `operations` - sub-module cannot be imported anymore using - `azure.mgmt.cosmosdb.operations.my_class_operations` (import - from `azure.mgmt.cosmosdb.operations` works like before) - -Last but not least, HTTP connection pooling is now enabled by default. -You should always use a client as a context manager, or call close(), or -use no more than one client per process. - -## 0.7.0 (2019-06-07) - -**Features** - - - Added operation - DatabaseAccountsOperations.get_gremlin_graph_throughput - - Added operation - DatabaseAccountsOperations.get_sql_database_throughput - - Added operation - DatabaseAccountsOperations.update_gremlin_database_throughput - - Added operation - DatabaseAccountsOperations.get_sql_container_throughput - - Added operation - DatabaseAccountsOperations.update_sql_container_throughput - - Added operation - DatabaseAccountsOperations.get_gremlin_database_throughput - - Added operation - DatabaseAccountsOperations.get_cassandra_table_throughput - - Added operation - DatabaseAccountsOperations.update_cassandra_keyspace_throughput - - Added operation - DatabaseAccountsOperations.update_mongo_db_collection_throughput - - Added operation - DatabaseAccountsOperations.update_cassandra_table_throughput - - Added operation DatabaseAccountsOperations.update_table_throughput - - Added operation - DatabaseAccountsOperations.update_mongo_db_database_throughput - - Added operation - DatabaseAccountsOperations.get_mongo_db_database_throughput - - Added operation - DatabaseAccountsOperations.update_sql_database_throughput - - Added operation DatabaseAccountsOperations.get_table_throughput - - Added operation - DatabaseAccountsOperations.get_mongo_db_collection_throughput - - Added operation - DatabaseAccountsOperations.update_gremlin_graph_throughput - - Added operation - DatabaseAccountsOperations.get_cassandra_keyspace_throughput - -## 0.6.1 (2019-05-31) - -**Features** - - - Add is_zone_redundant attribute - -**Bugfix** - - - Fix some incorrect type from int to long (Python 2) - -## 0.6.0 (2019-05-03) - -**Features** - - - Added operation DatabaseAccountsOperations.list_sql_databases - - Added operation DatabaseAccountsOperations.delete_gremlin_graph - - Added operation DatabaseAccountsOperations.get_sql_database - - Added operation DatabaseAccountsOperations.delete_table - - Added operation DatabaseAccountsOperations.get_cassandra_keyspace - - Added operation DatabaseAccountsOperations.list_sql_containers - - Added operation - DatabaseAccountsOperations.create_update_sql_container - - Added operation DatabaseAccountsOperations.get_table - - Added operation DatabaseAccountsOperations.list_cassandra_tables - - Added operation DatabaseAccountsOperations.create_update_table - - Added operation - DatabaseAccountsOperations.delete_mongo_db_collection - - Added operation DatabaseAccountsOperations.get_gremlin_graph - - Added operation DatabaseAccountsOperations.get_gremlin_database - - Added operation - DatabaseAccountsOperations.list_cassandra_keyspaces - - Added operation - DatabaseAccountsOperations.create_update_mongo_db_collection - - Added operation - DatabaseAccountsOperations.create_update_cassandra_keyspace - - Added operation - DatabaseAccountsOperations.create_update_cassandra_table - - Added operation DatabaseAccountsOperations.get_mongo_db_database - - Added operation DatabaseAccountsOperations.list_gremlin_databases - - Added operation - DatabaseAccountsOperations.create_update_sql_database - - Added operation - DatabaseAccountsOperations.get_mongo_db_collection - - Added operation - DatabaseAccountsOperations.list_mongo_db_collections - - Added operation DatabaseAccountsOperations.get_sql_container - - Added operation - DatabaseAccountsOperations.delete_cassandra_keyspace - - Added operation - DatabaseAccountsOperations.delete_mongo_db_database - - Added operation DatabaseAccountsOperations.get_cassandra_table - - Added operation DatabaseAccountsOperations.delete_cassandra_table - - Added operation - DatabaseAccountsOperations.list_mongo_db_databases - - Added operation DatabaseAccountsOperations.list_gremlin_graphs - - Added operation - DatabaseAccountsOperations.create_update_mongo_db_database - - Added operation DatabaseAccountsOperations.delete_sql_container - - Added operation - DatabaseAccountsOperations.create_update_gremlin_graph - - Added operation - DatabaseAccountsOperations.create_update_gremlin_database - - Added operation DatabaseAccountsOperations.list_tables - - Added operation DatabaseAccountsOperations.delete_gremlin_database - - Added operation DatabaseAccountsOperations.delete_sql_database - -## 0.5.2 (2018-11-05) - -**Features** - - - Add ignore_missing_vnet_service_endpoint support - -## 0.5.1 (2018-10-16) - -**Bugfix** - - - Fix sdist broken in 0.5.0. No code change. - -## 0.5.0 (2018-10-08) - -**Features** - - - Add enable_multiple_write_locations support - -**Note** - - - `database_accounts.list_read_only_keys` is now doing a POST - call, and not GET anymore. This should not impact anything. Old - behavior be can found with the - `database_accounts.get_read_only_keys` **deprecated** method. - - azure-mgmt-nspkg is not installed anymore on Python 3 (PEP420-based - namespace package) - -## 0.4.1 (2018-05-15) - -**Features** - - - Add database_accounts.offline_region - - Add database_accounts.online_region - - Client class can be used as a context manager to keep the underlying - HTTP session open for performance - -## 0.4.0 (2018-04-17) - -**General Breaking changes** - -This version uses a next-generation code generator that *might* -introduce breaking changes. - - - Model signatures now use only keyword-argument syntax. All - positional arguments must be re-written as keyword-arguments. To - keep auto-completion in most cases, models are now generated for - Python 2 and Python 3. Python 3 uses the "*" syntax for - keyword-only arguments. - - Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to - improve the behavior when unrecognized enum values are encountered. - While this is not a breaking change, the distinctions are important, - and are documented here: - At a glance: - - "is" should not be used at all. - - "format" will return the string value, where "%s" string - formatting will return `NameOfEnum.stringvalue`. Format syntax - should be prefered. - - New Long Running Operation: - - Return type changes from - `msrestazure.azure_operation.AzureOperationPoller` to - `msrest.polling.LROPoller`. External API is the same. - - Return type is now **always** a `msrest.polling.LROPoller`, - regardless of the optional parameters used. - - The behavior has changed when using `raw=True`. Instead of - returning the initial call result as `ClientRawResponse`, - without polling, now this returns an LROPoller. After polling, - the final resource will be returned as a `ClientRawResponse`. - - New `polling` parameter. The default behavior is - `Polling=True` which will poll using ARM algorithm. When - `Polling=False`, the response of the initial call will be - returned without polling. - - `polling` parameter accepts instances of subclasses of - `msrest.polling.PollingMethod`. - - `add_done_callback` will no longer raise if called after - polling is finished, but will instead execute the callback right - away. - -**Bugfixes** - - - Compatibility of the sdist with wheel 0.31.0 - -**Features** - - - Add VNet related properties to CosmosDB - -## 0.3.1 (2018-02-01) - -**Bugfixes** - - - Fix capabilities model definition - -## 0.3.0 (2018-01-30) - -**Features** - - - Add capability - - Add metrics operation groups - -## 0.2.1 (2017-10-18) - -**Bugfixes** - - - Fix max_interval_in_seconds interval values from 1/100 to 5/86400 - - Tags is now optional - -**Features** - - - Add operation list - -## 0.2.0 (2017-06-26) - - - Creation on this package based on azure-mgmt-documentdb 0.1.3 - content +> Changelog entries prior to 9.8.0 were removed to reduce file size. See https://pypi.org/project/azure-mgmt-cosmosdb/9.8.0/ for the older history. diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/_metadata.json b/sdk/cosmos/azure-mgmt-cosmosdb/_metadata.json index 7e7640c7f815..0063796bbfb3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/_metadata.json +++ b/sdk/cosmos/azure-mgmt-cosmosdb/_metadata.json @@ -1,11 +1,11 @@ { - "apiVersion": "2026-03-15", + "apiVersion": "2026-04-01-preview", "apiVersions": { - "Microsoft.DocumentDB": "2026-03-15" + "Microsoft.DocumentDB": "2026-04-01-preview" }, - "commit": "9ee5902c9557817bc4a859ebc13f757515aac5d7", + "commit": "9f5271b1ab4f354780443f12755bd097f148f9bc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB", - "emitterVersion": "0.63.2", - "httpClientPythonVersion": "^0.34.0" + "emitterVersion": "0.63.5", + "httpClientPythonVersion": "^0.36.0" } \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/api.md b/sdk/cosmos/azure-mgmt-cosmosdb/api.md index 89547d5e700d..ef0f3c42359e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/api.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/api.md @@ -5,20 +5,27 @@ namespace azure.mgmt.cosmosdb cassandra_clusters: CassandraClustersOperations cassandra_data_centers: CassandraDataCentersOperations cassandra_resources: CassandraResourcesOperations + chaos_fault: ChaosFaultOperations collection: CollectionOperations collection_partition: CollectionPartitionOperations collection_partition_region: CollectionPartitionRegionOperations collection_region: CollectionRegionOperations + copy_jobs: CopyJobsOperations + data_transfer_jobs: DataTransferJobsOperations database: DatabaseOperations database_account_region: DatabaseAccountRegionOperations database_accounts: DatabaseAccountsOperations fleet: FleetOperations + fleet_analytics: FleetAnalyticsOperations fleetspace: FleetspaceOperations fleetspace_account: FleetspaceAccountOperations + garnet_clusters: GarnetClustersOperations + graph_resources: GraphResourcesOperations gremlin_resources: GremlinResourcesOperations locations: LocationsOperations mongo_db_resources: MongoDBResourcesOperations mongo_mi_resources: MongoMIResourcesOperations + network_security_perimeter_configurations: NetworkSecurityPerimeterConfigurationsOperations notebook_workspaces: NotebookWorkspacesOperations operations: Operations partition_key_range_id: PartitionKeyRangeIdOperations @@ -41,8 +48,15 @@ namespace azure.mgmt.cosmosdb restorable_table_resources: RestorableTableResourcesOperations restorable_tables: RestorableTablesOperations service: ServiceOperations + soft_deleted_database_accounts: SoftDeletedDatabaseAccountsOperations + soft_deleted_sql_containers: SoftDeletedSqlContainersOperations + soft_deleted_sql_databases: SoftDeletedSqlDatabasesOperations sql_resources: SqlResourcesOperations table_resources: TableResourcesOperations + throughput_pool: ThroughputPoolOperations + throughput_pool_account: ThroughputPoolAccountOperations + throughput_pool_accounts: ThroughputPoolAccountsOperations + throughput_pools: ThroughputPoolsOperations def __init__( self, @@ -73,20 +87,27 @@ namespace azure.mgmt.cosmosdb.aio cassandra_clusters: CassandraClustersOperations cassandra_data_centers: CassandraDataCentersOperations cassandra_resources: CassandraResourcesOperations + chaos_fault: ChaosFaultOperations collection: CollectionOperations collection_partition: CollectionPartitionOperations collection_partition_region: CollectionPartitionRegionOperations collection_region: CollectionRegionOperations + copy_jobs: CopyJobsOperations + data_transfer_jobs: DataTransferJobsOperations database: DatabaseOperations database_account_region: DatabaseAccountRegionOperations database_accounts: DatabaseAccountsOperations fleet: FleetOperations + fleet_analytics: FleetAnalyticsOperations fleetspace: FleetspaceOperations fleetspace_account: FleetspaceAccountOperations + garnet_clusters: GarnetClustersOperations + graph_resources: GraphResourcesOperations gremlin_resources: GremlinResourcesOperations locations: LocationsOperations mongo_db_resources: MongoDBResourcesOperations mongo_mi_resources: MongoMIResourcesOperations + network_security_perimeter_configurations: NetworkSecurityPerimeterConfigurationsOperations notebook_workspaces: NotebookWorkspacesOperations operations: Operations partition_key_range_id: PartitionKeyRangeIdOperations @@ -109,8 +130,15 @@ namespace azure.mgmt.cosmosdb.aio restorable_table_resources: RestorableTableResourcesOperations restorable_tables: RestorableTablesOperations service: ServiceOperations + soft_deleted_database_accounts: SoftDeletedDatabaseAccountsOperations + soft_deleted_sql_containers: SoftDeletedSqlContainersOperations + soft_deleted_sql_databases: SoftDeletedSqlDatabasesOperations sql_resources: SqlResourcesOperations table_resources: TableResourcesOperations + throughput_pool: ThroughputPoolOperations + throughput_pool_account: ThroughputPoolAccountOperations + throughput_pool_accounts: ThroughputPoolAccountsOperations + throughput_pools: ThroughputPoolsOperations def __init__( self, @@ -229,6 +257,39 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[CommandOutput]: ... + @overload + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommandPublicResource]: ... + + @overload + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommandPublicResource]: ... + + @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[CommandPublicResource]: ... + @distributed_trace_async async def begin_start( self, @@ -278,6 +339,35 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> ClusterResource: ... + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'backup_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get_backup( + self, + resource_group_name: str, + cluster_name: str, + backup_id: str, + **kwargs: Any + ) -> BackupResource: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'command_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get_command_async( + self, + resource_group_name: str, + cluster_name: str, + command_id: str, + **kwargs: Any + ) -> CommandPublicResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_backups( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncItemPaged[BackupResource]: ... + @distributed_trace def list_by_resource_group( self, @@ -288,6 +378,15 @@ namespace azure.mgmt.cosmosdb.aio.operations @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged[ClusterResource]: ... + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_command( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncItemPaged[CommandPublicResource]: ... + @distributed_trace_async async def status( self, @@ -559,6 +658,45 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[CassandraTableGetResults]: ... + @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: CassandraViewCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CassandraViewGetResults]: ... + + @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: CassandraViewCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CassandraViewGetResults]: ... + + @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[CassandraViewGetResults]: ... + @distributed_trace_async async def begin_delete_cassandra_keyspace( self, @@ -596,6 +734,16 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[None]: ... + @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]: ... + @distributed_trace_async async def begin_migrate_cassandra_keyspace_to_autoscale( self, @@ -634,6 +782,26 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + @distributed_trace_async + async def begin_migrate_cassandra_view_to_autoscale( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @distributed_trace_async + async def begin_migrate_cassandra_view_to_manual_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + @overload async def begin_update_cassandra_keyspace_throughput( self, @@ -709,6 +877,45 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + @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: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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[ThroughputSettingsGetResults]: ... + @distributed_trace_async async def get_cassandra_keyspace( self, @@ -765,6 +972,26 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> ThroughputSettingsGetResults: ... + @distributed_trace_async + async def get_cassandra_view( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> CassandraViewGetResults: ... + + @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 + ) -> ThroughputSettingsGetResults: ... + @distributed_trace def list_cassandra_keyspaces( self, @@ -798,6 +1025,77 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncItemPaged[CassandraTableGetResults]: ... + @distributed_trace + def list_cassandra_views( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + **kwargs: Any + ) -> AsyncItemPaged[CassandraViewGetResults]: ... + + + class azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ChaosFaultResource]: ... + + @overload + async def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ChaosFaultResource]: ... + + @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[ChaosFaultResource]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + **kwargs: Any + ) -> ChaosFaultResource: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ChaosFaultResource]: ... + class azure.mgmt.cosmosdb.aio.operations.CollectionOperations: @@ -919,7 +1217,7 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[Metric]: ... - class azure.mgmt.cosmosdb.aio.operations.DatabaseAccountRegionOperations: + class azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations: def __init__( self, @@ -927,97 +1225,305 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs ) -> None: ... - @distributed_trace - def list_metrics( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def cancel( self, resource_group_name: str, account_name: str, - region: str, - *, - filter: str, + job_name: str, **kwargs: Any - ) -> AsyncItemPaged[Metric]: ... - - - class azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations: + ) -> CopyJobGetResults: ... - def __init__( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def complete( self, - *args, - **kwargs - ) -> None: ... + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... @overload - async def begin_create_or_update( + async def create( self, resource_group_name: str, account_name: str, - create_update_parameters: DatabaseAccountCreateUpdateParameters, + job_name: str, + job_create_parameters: CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + ) -> CopyJobGetResults: ... @overload - async def begin_create_or_update( + async def create( self, resource_group_name: str, account_name: str, - create_update_parameters: DatabaseAccountCreateUpdateParameters, + job_name: str, + job_create_parameters: CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + ) -> CopyJobGetResults: ... @overload - async def begin_create_or_update( + async def create( self, resource_group_name: str, account_name: str, - create_update_parameters: IO[bytes], + job_name: str, + job_create_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + ) -> CopyJobGetResults: ... @distributed_trace_async - async def begin_delete( + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( self, resource_group_name: str, account_name: str, + job_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: ... + ) -> CopyJobGetResults: ... - @overload - async def begin_failover_priority_change( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_database_account( self, resource_group_name: str, account_name: str, - failover_parameters: FailoverPolicies, - *, - content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[None]: ... + ) -> AsyncItemPaged[CopyJobGetResults]: ... - @overload - async def begin_failover_priority_change( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def pause( self, resource_group_name: str, account_name: str, - failover_parameters: FailoverPolicies, - *, - content_type: str = "application/json", + job_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: ... + ) -> CopyJobGetResults: ... - @overload - async def begin_failover_priority_change( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def resume( self, resource_group_name: str, account_name: str, - failover_parameters: IO[bytes], - *, - content_type: str = "application/json", + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + + class azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def cancel( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def complete( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @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 + ) -> DataTransferJobGetResults: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_database_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncItemPaged[DataTransferJobGetResults]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def pause( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def resume( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + + class azure.mgmt.cosmosdb.aio.operations.DatabaseAccountRegionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged[Metric]: ... + + + class azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + create_update_parameters: DatabaseAccountCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + create_update_parameters: DatabaseAccountCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + create_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[DatabaseAccountGetResults]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_failover_priority_change( + self, + resource_group_name: str, + account_name: str, + failover_parameters: FailoverPolicies, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_failover_priority_change( + self, + resource_group_name: str, + account_name: str, + failover_parameters: FailoverPolicies, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_failover_priority_change( + self, + resource_group_name: str, + account_name: str, + failover_parameters: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: ... @@ -1279,6 +1785,77 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[Usage]: ... + class azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetAnalyticsResource: ... + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetAnalyticsResource: ... + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetAnalyticsResource: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + **kwargs: Any + ) -> FleetAnalyticsResource: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> AsyncItemPaged[FleetAnalyticsResource]: ... + + class azure.mgmt.cosmosdb.aio.operations.FleetOperations: def __init__( @@ -1564,7 +2141,7 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[FleetspaceResource]: ... - class azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations: + class azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations: def __init__( self, @@ -1573,40 +2150,219 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> None: ... @overload - async def begin_create_update_gremlin_database( + async def begin_create_update( self, resource_group_name: str, - account_name: str, - database_name: str, - create_update_gremlin_database_parameters: GremlinDatabaseCreateUpdateParameters, + cluster_name: str, + body: GarnetClusterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... + ) -> AsyncLROPoller[GarnetClusterResource]: ... @overload - async def begin_create_update_gremlin_database( + async def begin_create_update( self, resource_group_name: str, - account_name: str, - database_name: str, - create_update_gremlin_database_parameters: GremlinDatabaseCreateUpdateParameters, + cluster_name: str, + body: GarnetClusterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... + ) -> AsyncLROPoller[GarnetClusterResource]: ... @overload - async def begin_create_update_gremlin_database( + async def begin_create_update( self, resource_group_name: str, - account_name: str, - database_name: str, - create_update_gremlin_database_parameters: IO[bytes], + cluster_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... + ) -> AsyncLROPoller[GarnetClusterResource]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name']}, api_versions_list=['2026-04-01-preview']) + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GarnetClusterResource]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GarnetClusterResource]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GarnetClusterResource]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> GarnetClusterResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[GarnetClusterResource]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged[GarnetClusterResource]: ... + + + class azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GraphResourceGetResults]: ... + + @overload + async def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GraphResourceGetResults]: ... + + @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[GraphResourceGetResults]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'graph_name']}, api_versions_list=['2026-04-01-preview']) + async def begin_delete_graph_resource( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'graph_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + **kwargs: Any + ) -> GraphResourceGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_graphs( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncItemPaged[GraphResourceGetResults]: ... + + + class azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[GremlinDatabaseGetResults]: ... @overload async def begin_create_update_gremlin_graph( @@ -2209,6 +2965,45 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[None]: ... + @overload + async def begin_list_mongo_db_collection_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + async def begin_list_mongo_db_collection_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + async def begin_list_mongo_db_collection_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... + @distributed_trace_async async def begin_migrate_mongo_db_collection_to_autoscale( self, @@ -2248,182 +3043,368 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... @overload - async def begin_retrieve_continuous_backup_information( + async def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[BackupInformation]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_retrieve_continuous_backup_information( + async def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[BackupInformation]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_retrieve_continuous_backup_information( + async def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[BackupInformation]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_mongo_db_collection_throughput( + async def begin_mongo_db_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_mongo_db_collection_throughput( + async def begin_mongo_db_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_mongo_db_collection_throughput( + async def begin_mongo_db_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: IO[bytes], + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_mongo_db_database_throughput( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + merge_parameters: MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... @overload - async def begin_update_mongo_db_database_throughput( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + merge_parameters: MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... @overload - async def begin_update_mongo_db_database_throughput( + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: IO[bytes], + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace_async - async def get_mongo_db_collection( + @overload + async def begin_mongo_db_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> MongoDBCollectionGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_mongo_db_collection_throughput( + @overload + async def begin_mongo_db_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ThroughputSettingsGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_mongo_db_database( + @overload + async def begin_mongo_db_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> MongoDBDatabaseGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_mongo_db_database_throughput( + @overload + async def begin_mongo_db_database_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ThroughputSettingsGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_mongo_role_definition( + @overload + async def begin_mongo_db_database_retrieve_throughput_distribution( self, - mongo_role_definition_id: str, resource_group_name: str, account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> MongoRoleDefinitionGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_mongo_user_definition( + @overload + async def begin_mongo_db_database_retrieve_throughput_distribution( self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> MongoUserDefinitionGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def list_mongo_db_collections( + @overload + async def begin_retrieve_continuous_backup_information( self, resource_group_name: str, account_name: str, database_name: str, - **kwargs: Any + collection_name: str, + location: ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[BackupInformation]: ... + + @overload + async def begin_retrieve_continuous_backup_information( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[BackupInformation]: ... + + @overload + async def begin_retrieve_continuous_backup_information( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[BackupInformation]: ... + + @overload + async def begin_update_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_mongo_db_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_mongo_db_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_mongo_db_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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 + ) -> MongoDBCollectionGetResults: ... + + @distributed_trace_async + async def get_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace_async + async def get_mongo_db_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> MongoDBDatabaseGetResults: ... + + @distributed_trace_async + async def get_mongo_db_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace_async + async def get_mongo_role_definition( + self, + mongo_role_definition_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> MongoRoleDefinitionGetResults: ... + + @distributed_trace_async + async def get_mongo_user_definition( + self, + mongo_user_definition_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> MongoUserDefinitionGetResults: ... + + @distributed_trace + def list_mongo_db_collections( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any ) -> AsyncItemPaged[MongoDBCollectionGetResults]: ... @distributed_trace @@ -2584,6 +3565,44 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[MongoMIRoleDefinitionResource]: ... + class azure.mgmt.cosmosdb.aio.operations.NetworkSecurityPerimeterConfigurationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'network_security_perimeter_configuration_name']}, api_versions_list=['2026-04-01-preview']) + async def begin_reconcile( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'network_security_perimeter_configuration_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> NetworkSecurityPerimeterConfiguration: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncItemPaged[NetworkSecurityPerimeterConfiguration]: ... + + class azure.mgmt.cosmosdb.aio.operations.NotebookWorkspacesOperations: def __init__( @@ -3208,7 +4227,7 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[ServiceResource]: ... - class azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations: + class azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations: def __init__( self, @@ -3216,72 +4235,248 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs ) -> None: ... - @overload - async def begin_create_update_client_encryption_key( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_purge( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, *, - content_type: str = "application/json", + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., **kwargs: Any - ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + ) -> AsyncLROPoller[None]: ... - @overload - async def begin_create_update_client_encryption_key( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_restore( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, *, - content_type: str = "application/json", + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., **kwargs: Any - ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + ) -> AsyncLROPoller[None]: ... - @overload - async def begin_create_update_client_encryption_key( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], - *, - content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + ) -> SoftDeletedDatabaseAccountGetResult: ... - @overload - async def begin_create_update_sql_container( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'location', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def list_by_location( self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, - *, - content_type: str = "application/json", + location: str, **kwargs: Any - ) -> AsyncLROPoller[SqlContainerGetResults]: ... + ) -> SoftDeletedDatabaseAccountsListResult: ... - @overload - async def begin_create_update_sql_container( + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'api_version', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def list_by_resource_group_and_location( self, resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, - *, - content_type: str = "application/json", + location: str, **kwargs: Any - ) -> AsyncLROPoller[SqlContainerGetResults]: ... + ) -> SoftDeletedDatabaseAccountsListResult: ... - @overload + + class azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> SoftDeletedSqlContainerGetResult: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def list( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SoftDeletedSqlContainersListResult: ... + + + class azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + async def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SoftDeletedSqlDatabaseGetResult: ... + + @distributed_trace_async + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + async def list( + self, + resource_group_name: str, + location: str, + account_name: str, + **kwargs: Any + ) -> SoftDeletedSqlDatabasesListResult: ... + + + class azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + async def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + async def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + async def begin_create_update_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SqlContainerGetResults]: ... + + @overload + async def begin_create_update_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SqlContainerGetResults]: ... + + @overload async def begin_create_update_sql_container( self, resource_group_name: str, @@ -3598,6 +4793,45 @@ namespace azure.mgmt.cosmosdb.aio.operations **kwargs: Any ) -> AsyncLROPoller[None]: ... + @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: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @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: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @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[PhysicalPartitionStorageInfoCollection]: ... + @distributed_trace_async async def begin_migrate_sql_container_to_autoscale( self, @@ -3676,135 +4910,321 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncLROPoller[BackupInformation]: ... @overload - async def begin_update_sql_container_throughput( + async def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_sql_container_throughput( + async def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_sql_container_throughput( + async def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_sql_database_throughput( + async def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + container_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_sql_database_throughput( + async def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + container_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - async def begin_update_sql_database_throughput( + async def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_client_encryption_key( + @overload + async def begin_sql_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ClientEncryptionKeyGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace_async - async def get_sql_container( + @overload + async def begin_sql_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlContainerGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace_async - async def get_sql_container_throughput( + @overload + async def begin_sql_database_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 - ) -> ThroughputSettingsGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace_async - async def get_sql_database( + @overload + async def begin_sql_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlDatabaseGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_sql_database_throughput( + @overload + async def begin_sql_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ThroughputSettingsGetResults: ... + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace_async - async def get_sql_role_assignment( + @overload + async def begin_sql_database_redistribute_throughput( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - **kwargs: Any + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + async def begin_sql_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + async def begin_sql_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + async def begin_sql_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @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: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @overload + async def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputSettingsGetResults]: ... + + @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 + ) -> ClientEncryptionKeyGetResults: ... + + @distributed_trace_async + async def get_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> SqlContainerGetResults: ... + + @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 + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace_async + async def get_sql_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SqlDatabaseGetResults: ... + + @distributed_trace_async + async def get_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace_async + async def get_sql_role_assignment( + self, + role_assignment_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any ) -> SqlRoleAssignmentGetResults: ... @distributed_trace_async @@ -4216,70 +5636,327 @@ namespace azure.mgmt.cosmosdb.aio.operations ) -> AsyncItemPaged[TableGetResults]: ... -namespace azure.mgmt.cosmosdb.models - - class azure.mgmt.cosmosdb.models.ARMProxyResource(_Model): - id: Optional[str] - name: Optional[str] - type: Optional[str] + class azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations: + def __init__( + self, + *args, + **kwargs + ) -> None: ... - class azure.mgmt.cosmosdb.models.ARMResourceProperties(_Model): - id: Optional[str] - identity: Optional[ManagedServiceIdentity] - location: Optional[str] - name: Optional[str] - tags: Optional[dict[str, str]] - type: Optional[str] + @overload + async def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: ThroughputPoolAccountResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolAccountResource]: ... @overload - def __init__( + async def begin_create( self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: ThroughputPoolAccountResource, *, - identity: Optional[ManagedServiceIdentity] = ..., - location: Optional[str] = ..., - tags: Optional[dict[str, str]] = ... - ) -> None: ... + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolAccountResource]: ... @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + 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[ThroughputPoolAccountResource]: ... + @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]: ... - class azure.mgmt.cosmosdb.models.AccountKeyMetadata(_Model): - generation_time: Optional[datetime] + @distributed_trace_async + async def get( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + **kwargs: Any + ) -> ThroughputPoolAccountResource: ... - class azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration(_Model): - schema_type: Optional[Union[str, AnalyticalStorageSchemaType]] + class azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountsOperations: - @overload def __init__( self, - *, - schema_type: Optional[Union[str, AnalyticalStorageSchemaType]] = ... + *args, + **kwargs ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - + @distributed_trace + def list( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ThroughputPoolAccountResource]: ... - class azure.mgmt.cosmosdb.models.AnalyticalStorageSchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - FULL_FIDELITY = "FullFidelity" - WELL_DEFINED = "WellDefined" + class azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations: - class azure.mgmt.cosmosdb.models.ApiProperties(_Model): - server_version: Optional[Union[str, ServerVersion]] + def __init__( + self, + *args, + **kwargs + ) -> None: ... @overload - def __init__( + async def begin_create_or_update( self, + resource_group_name: str, + throughput_pool_name: str, + body: ThroughputPoolResource, *, - server_version: Optional[Union[str, ServerVersion]] = ... - ) -> None: ... + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolResource]: ... @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: ThroughputPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolResource]: ... + + @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[ThroughputPoolResource]: ... + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolResource]: ... + + @overload + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[ThroughputPoolResource]: ... + + @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[ThroughputPoolResource]: ... + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> ThroughputPoolResource: ... + + + class azure.mgmt.cosmosdb.aio.operations.ThroughputPoolsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[ThroughputPoolResource]: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ThroughputPoolResource]: ... + + +namespace azure.mgmt.cosmosdb.models + + class azure.mgmt.cosmosdb.models.ARMProxyResource(_Model): + id: Optional[str] + name: Optional[str] + type: Optional[str] + + + class azure.mgmt.cosmosdb.models.ARMResourceProperties(_Model): + id: Optional[str] + identity: Optional[ManagedServiceIdentity] + location: Optional[str] + name: Optional[str] + tags: Optional[dict[str, str]] + type: Optional[str] + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AccessRule(_Model): + name: Optional[str] + properties: Optional[AccessRuleProperties] + + @overload + def __init__( + self, + *, + name: Optional[str] = ..., + properties: Optional[AccessRuleProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INBOUND = "Inbound" + OUTBOUND = "Outbound" + + + class azure.mgmt.cosmosdb.models.AccessRuleProperties(_Model): + address_prefixes: Optional[list[str]] + direction: Optional[Union[str, AccessRuleDirection]] + email_addresses: Optional[list[str]] + fully_qualified_domain_names: Optional[list[str]] + network_security_perimeters: Optional[list[NetworkSecurityPerimeter]] + phone_numbers: Optional[list[str]] + subscriptions: Optional[list[AccessRulePropertiesSubscriptionsItem]] + + @overload + def __init__( + self, + *, + address_prefixes: Optional[list[str]] = ..., + direction: Optional[Union[str, AccessRuleDirection]] = ..., + email_addresses: Optional[list[str]] = ..., + fully_qualified_domain_names: Optional[list[str]] = ..., + network_security_perimeters: Optional[list[NetworkSecurityPerimeter]] = ..., + phone_numbers: Optional[list[str]] = ..., + subscriptions: Optional[list[AccessRulePropertiesSubscriptionsItem]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AccessRulePropertiesSubscriptionsItem(_Model): + id: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AccountKeyMetadata(_Model): + approximate_last_usage_time: Optional[datetime] + generation_time: Optional[datetime] + + + class azure.mgmt.cosmosdb.models.AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "Active" + DEALLOCATED = "Deallocated" + + + class azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration(_Model): + schema_type: Optional[Union[str, AnalyticalStorageSchemaType]] + + @overload + def __init__( + self, + *, + schema_type: Optional[Union[str, AnalyticalStorageSchemaType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AnalyticalStorageSchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FULL_FIDELITY = "FullFidelity" + WELL_DEFINED = "WellDefined" + + + class azure.mgmt.cosmosdb.models.ApiProperties(_Model): + server_version: Optional[Union[str, ServerVersion]] + + @overload + def __init__( + self, + *, + server_version: Optional[Union[str, ServerVersion]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... class azure.mgmt.cosmosdb.models.ApiType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -4376,6 +6053,51 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.AzureBlobContainer(_Model): + container_name: str + + @overload + def __init__( + self, + *, + container_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AzureBlobDataTransferDataSourceSink(DataTransferDataSourceSink, discriminator='AzureBlobStorage'): + component: Literal[DataTransferComponent.AZURE_BLOB_STORAGE] + container_name: str + endpoint_url: Optional[str] + + @overload + def __init__( + self, + *, + container_name: str, + endpoint_url: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.AzureBlobSourceSinkDetails(_Model): + endpoint_url: str + + @overload + def __init__( + self, + *, + endpoint_url: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.AzureConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" VPN = "VPN" @@ -4441,6 +6163,28 @@ namespace azure.mgmt.cosmosdb.models PERIODIC = "Periodic" + class azure.mgmt.cosmosdb.models.BackupResource(_Model): + backup_expiry_timestamp: Optional[datetime] + backup_id: Optional[str] + backup_start_timestamp: Optional[datetime] + backup_state: Optional[Union[str, BackupState]] + backup_stop_timestamp: Optional[datetime] + + @overload + def __init__( + self, + *, + backup_expiry_timestamp: Optional[datetime] = ..., + backup_id: Optional[str] = ..., + backup_start_timestamp: Optional[datetime] = ..., + backup_state: Optional[Union[str, BackupState]] = ..., + backup_stop_timestamp: Optional[datetime] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.BackupSchedule(_Model): cron_expression: Optional[str] retention_in_hours: Optional[int] @@ -4459,73 +6203,186 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.BackupState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FAILED = "Failed" + INITIATED = "Initiated" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + + class azure.mgmt.cosmosdb.models.BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): GEO = "Geo" LOCAL = "Local" ZONE = "Zone" - class azure.mgmt.cosmosdb.models.Capability(_Model): - name: Optional[str] + class azure.mgmt.cosmosdb.models.BaseCopyJobProperties(_Model): + job_type: str @overload def __init__( self, *, - name: Optional[str] = ... + job_type: str ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.Capacity(_Model): - total_throughput_limit: Optional[int] + class azure.mgmt.cosmosdb.models.BaseCopyJobTask(_Model): + processed_count: Optional[int] + total_count: Optional[int] + + + class azure.mgmt.cosmosdb.models.BaseCosmosDataTransferDataSourceSink(DataTransferDataSourceSink, discriminator='BaseCosmosDataTransferDataSourceSink'): + component: Literal[DataTransferComponent.BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK] + remote_account_name: Optional[str] @overload def __init__( self, *, - total_throughput_limit: Optional[int] = ... + remote_account_name: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.CassandraClusterDataCenterNodeItem(_Model): - address: Optional[str] - cassandra_process_status: Optional[str] - cpu_usage: Optional[float] - disk_free_kb: Optional[int] - disk_used_kb: Optional[int] - host_id: Optional[str] - is_latest_model: Optional[bool] - load: Optional[str] - memory_buffers_and_cached_kb: Optional[int] - memory_free_kb: Optional[int] - memory_total_kb: Optional[int] - memory_used_kb: Optional[int] - rack: Optional[str] - size: Optional[int] - state: Optional[Union[str, NodeState]] - status: Optional[str] - timestamp: Optional[str] - tokens: Optional[list[str]] + class azure.mgmt.cosmosdb.models.BlobToCassandraRUCopyJobProperties(BaseCopyJobProperties, discriminator='AzureBlobStorageToCassandraRU'): + destination_details: Optional[CosmosDBSourceSinkDetails] + job_type: Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU] + source_details: AzureBlobSourceSinkDetails + tasks: list[BlobToCassandraRUCopyJobTask] @overload def __init__( self, *, - address: Optional[str] = ..., - cassandra_process_status: Optional[str] = ..., - cpu_usage: Optional[float] = ..., - disk_free_kb: Optional[int] = ..., - disk_used_kb: Optional[int] = ..., - host_id: Optional[str] = ..., - is_latest_model: Optional[bool] = ..., - load: Optional[str] = ..., - memory_buffers_and_cached_kb: Optional[int] = ..., + destination_details: Optional[CosmosDBSourceSinkDetails] = ..., + source_details: AzureBlobSourceSinkDetails, + tasks: list[BlobToCassandraRUCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.BlobToCassandraRUCopyJobTask(BaseCopyJobTask): + destination: CosmosDBCassandraTable + processed_count: int + source: AzureBlobContainer + total_count: int + + @overload + def __init__( + self, + *, + destination: CosmosDBCassandraTable, + source: AzureBlobContainer + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.Capability(_Model): + name: Optional[str] + + @overload + def __init__( + self, + *, + name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.Capacity(_Model): + total_throughput_limit: Optional[int] + + @overload + def __init__( + self, + *, + total_throughput_limit: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CapacityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NONE = "None" + PROVISIONED = "Provisioned" + SERVERLESS = "Serverless" + + + class azure.mgmt.cosmosdb.models.CapacityModeChangeTransitionState(_Model): + capacity_mode_last_successful_transition_end_timestamp: Optional[datetime] + capacity_mode_transition_begin_timestamp: Optional[datetime] + capacity_mode_transition_end_timestamp: Optional[datetime] + capacity_mode_transition_status: Optional[Union[str, CapacityModeTransitionStatus]] + current_capacity_mode: Optional[Union[str, CapacityMode]] + previous_capacity_mode: Optional[Union[str, CapacityMode]] + + @overload + def __init__( + self, + *, + capacity_mode_transition_status: Optional[Union[str, CapacityModeTransitionStatus]] = ..., + current_capacity_mode: Optional[Union[str, CapacityMode]] = ..., + previous_capacity_mode: Optional[Union[str, CapacityMode]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CapacityModeTransitionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + COMPLETED = "Completed" + FAILED = "Failed" + INITIALIZED = "Initialized" + INVALID = "Invalid" + IN_PROGRESS = "InProgress" + + + class azure.mgmt.cosmosdb.models.CassandraClusterDataCenterNodeItem(_Model): + address: Optional[str] + cassandra_process_status: Optional[str] + cpu_usage: Optional[float] + disk_free_kb: Optional[int] + disk_used_kb: Optional[int] + host_id: Optional[str] + is_latest_model: Optional[bool] + load: Optional[str] + memory_buffers_and_cached_kb: Optional[int] + memory_free_kb: Optional[int] + memory_total_kb: Optional[int] + memory_used_kb: Optional[int] + rack: Optional[str] + size: Optional[int] + state: Optional[Union[str, NodeState]] + status: Optional[str] + timestamp: Optional[str] + tokens: Optional[list[str]] + + @overload + def __init__( + self, + *, + address: Optional[str] = ..., + cassandra_process_status: Optional[str] = ..., + cpu_usage: Optional[float] = ..., + disk_free_kb: Optional[int] = ..., + disk_used_kb: Optional[int] = ..., + host_id: Optional[str] = ..., + is_latest_model: Optional[bool] = ..., + load: Optional[str] = ..., + memory_buffers_and_cached_kb: Optional[int] = ..., memory_free_kb: Optional[int] = ..., memory_total_kb: Optional[int] = ..., memory_used_kb: Optional[int] = ..., @@ -4757,6 +6614,80 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.CassandraRUToBlobCopyJobProperties(BaseCopyJobProperties, discriminator='CassandraRUToAzureBlobStorage'): + destination_details: AzureBlobSourceSinkDetails + job_type: Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE] + source_details: Optional[CosmosDBSourceSinkDetails] + tasks: list[CassandraRUToBlobCopyJobTask] + + @overload + def __init__( + self, + *, + destination_details: AzureBlobSourceSinkDetails, + source_details: Optional[CosmosDBSourceSinkDetails] = ..., + tasks: list[CassandraRUToBlobCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CassandraRUToBlobCopyJobTask(BaseCopyJobTask): + destination: AzureBlobContainer + processed_count: int + source: CosmosDBCassandraTable + total_count: int + + @overload + def __init__( + self, + *, + destination: AzureBlobContainer, + source: CosmosDBCassandraTable + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CassandraRUToCassandraRUCopyJobProperties(BaseCopyJobProperties, discriminator='CassandraRUToCassandraRU'): + destination_details: Optional[CosmosDBSourceSinkDetails] + job_type: Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU] + source_details: Optional[CosmosDBSourceSinkDetails] + tasks: list[CassandraRUToCassandraRUCopyJobTask] + + @overload + def __init__( + self, + *, + destination_details: Optional[CosmosDBSourceSinkDetails] = ..., + source_details: Optional[CosmosDBSourceSinkDetails] = ..., + tasks: list[CassandraRUToCassandraRUCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CassandraRUToCassandraRUCopyJobTask(BaseCopyJobTask): + destination: CosmosDBCassandraTable + processed_count: int + source: CosmosDBCassandraTable + total_count: int + + @overload + def __init__( + self, + *, + destination: CosmosDBCassandraTable, + source: CosmosDBCassandraTable + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource(ProxyResource): id: str name: str @@ -5022,118 +6953,112 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.Certificate(_Model): - pem: Optional[str] + class azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: CassandraViewCreateUpdateProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... @overload def __init__( self, *, - pem: Optional[str] = ... + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: CassandraViewCreateUpdateProperties, + tags: Optional[dict[str, str]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - class azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath(_Model): - client_encryption_key_id: str - encryption_algorithm: str - encryption_type: str - path: str - - @overload - def __init__( + def __setattr__( self, - *, - client_encryption_key_id: str, - encryption_algorithm: str, - encryption_type: str, - path: str + key: str, + value: Any ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters(_Model): - properties: ClientEncryptionKeyCreateUpdateProperties - - def __getattr__(self, name: str) -> Any: ... + class azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateProperties(_Model): + options: Optional[CreateUpdateOptions] + resource: CassandraViewResource @overload def __init__( self, *, - properties: ClientEncryptionKeyCreateUpdateProperties + options: Optional[CreateUpdateOptions] = ..., + resource: CassandraViewResource ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - def __setattr__( - self, - key: str, - value: Any - ) -> None: ... - - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateProperties(_Model): - resource: ClientEncryptionKeyResource + class azure.mgmt.cosmosdb.models.CassandraViewGetProperties(_Model): + options: Optional[CassandraViewGetPropertiesOptions] + resource: Optional[CassandraViewGetPropertiesResource] @overload def __init__( self, *, - resource: ClientEncryptionKeyResource + options: Optional[CassandraViewGetPropertiesOptions] = ..., + resource: Optional[CassandraViewGetPropertiesResource] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetProperties(_Model): - resource: Optional[ClientEncryptionKeyGetPropertiesResource] + class azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions(OptionsResource): + autoscale_settings: AutoscaleSettings + throughput: int @overload def __init__( self, *, - resource: Optional[ClientEncryptionKeyGetPropertiesResource] = ... + autoscale_settings: Optional[AutoscaleSettings] = ..., + throughput: Optional[int] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): - encryption_algorithm: str + class azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource(CassandraViewResource): etag: Optional[str] id: str - key_wrap_metadata: KeyWrapMetadata rid: Optional[str] ts: Optional[float] - wrapped_data_encryption_key: bytes + view_definition: str @overload def __init__( self, *, - encryption_algorithm: Optional[str] = ..., - id: Optional[str] = ..., - key_wrap_metadata: Optional[KeyWrapMetadata] = ..., - wrapped_data_encryption_key: Optional[bytes] = ... + id: str, + view_definition: str ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults(ProxyResource): + class azure.mgmt.cosmosdb.models.CassandraViewGetResults(ProxyResource): id: str + identity: Optional[ManagedServiceIdentity] + location: Optional[str] name: str - properties: Optional[ClientEncryptionKeyGetProperties] + properties: Optional[CassandraViewGetProperties] system_data: SystemData + tags: Optional[dict[str, str]] type: str def __getattr__(self, name: str) -> Any: ... @@ -5142,7 +7067,10 @@ namespace azure.mgmt.cosmosdb.models def __init__( self, *, - properties: Optional[ClientEncryptionKeyGetProperties] = ... + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: Optional[CassandraViewGetProperties] = ..., + tags: Optional[dict[str, str]] = ... ) -> None: ... @overload @@ -5155,74 +7083,270 @@ namespace azure.mgmt.cosmosdb.models ) -> None: ... - class azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource(_Model): - encryption_algorithm: Optional[str] - id: Optional[str] - key_wrap_metadata: Optional[KeyWrapMetadata] - wrapped_data_encryption_key: Optional[bytes] + class azure.mgmt.cosmosdb.models.CassandraViewResource(_Model): + id: str + view_definition: str @overload def __init__( self, *, - encryption_algorithm: Optional[str] = ..., - id: Optional[str] = ..., - key_wrap_metadata: Optional[KeyWrapMetadata] = ..., - wrapped_data_encryption_key: Optional[bytes] = ... + id: str, + view_definition: str ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ClientEncryptionPolicy(_Model): - included_paths: list[ClientEncryptionIncludedPath] - policy_format_version: int + class azure.mgmt.cosmosdb.models.Certificate(_Model): + pem: Optional[str] @overload def __init__( self, *, - included_paths: list[ClientEncryptionIncludedPath], - policy_format_version: int + pem: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.CloudError(_Model): - error: Optional[ErrorResponseAutoGenerated] + class azure.mgmt.cosmosdb.models.ChaosFaultProperties(_Model): + action: Optional[Union[str, SupportedActions]] + container_name: Optional[str] + database_name: Optional[str] + provisioning_state: Optional[str] + region: Optional[str] @overload def __init__( self, *, - error: Optional[ErrorResponseAutoGenerated] = ... + action: Optional[Union[str, SupportedActions]] = ..., + container_name: Optional[str] = ..., + database_name: Optional[str] = ..., + region: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ClusterKey(_Model): - name: Optional[str] - order_by: Optional[str] + class azure.mgmt.cosmosdb.models.ChaosFaultResource(ProxyResource): + id: str + name: str + properties: Optional[ChaosFaultProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... @overload def __init__( self, *, - name: Optional[str] = ..., - order_by: Optional[str] = ... + properties: Optional[ChaosFaultProperties] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - - class azure.mgmt.cosmosdb.models.ClusterResource(ProxyResource): - id: str + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath(_Model): + client_encryption_key_id: str + encryption_algorithm: str + encryption_type: str + path: str + + @overload + def __init__( + self, + *, + client_encryption_key_id: str, + encryption_algorithm: str, + encryption_type: str, + path: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters(_Model): + properties: ClientEncryptionKeyCreateUpdateProperties + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: ClientEncryptionKeyCreateUpdateProperties + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateProperties(_Model): + resource: ClientEncryptionKeyResource + + @overload + def __init__( + self, + *, + resource: ClientEncryptionKeyResource + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetProperties(_Model): + resource: Optional[ClientEncryptionKeyGetPropertiesResource] + + @overload + def __init__( + self, + *, + resource: Optional[ClientEncryptionKeyGetPropertiesResource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): + encryption_algorithm: str + etag: Optional[str] + id: str + key_wrap_metadata: KeyWrapMetadata + rid: Optional[str] + ts: Optional[float] + wrapped_data_encryption_key: bytes + + @overload + def __init__( + self, + *, + encryption_algorithm: Optional[str] = ..., + id: Optional[str] = ..., + key_wrap_metadata: Optional[KeyWrapMetadata] = ..., + wrapped_data_encryption_key: Optional[bytes] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults(ProxyResource): + id: str + name: str + properties: Optional[ClientEncryptionKeyGetProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ClientEncryptionKeyGetProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource(_Model): + encryption_algorithm: Optional[str] + id: Optional[str] + key_wrap_metadata: Optional[KeyWrapMetadata] + wrapped_data_encryption_key: Optional[bytes] + + @overload + def __init__( + self, + *, + encryption_algorithm: Optional[str] = ..., + id: Optional[str] = ..., + key_wrap_metadata: Optional[KeyWrapMetadata] = ..., + wrapped_data_encryption_key: Optional[bytes] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClientEncryptionPolicy(_Model): + included_paths: list[ClientEncryptionIncludedPath] + policy_format_version: int + + @overload + def __init__( + self, + *, + included_paths: list[ClientEncryptionIncludedPath], + policy_format_version: int + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CloudError(_Model): + error: Optional[ErrorResponseAutoGenerated] + + @overload + def __init__( + self, + *, + error: Optional[ErrorResponseAutoGenerated] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClusterKey(_Model): + name: Optional[str] + order_by: Optional[str] + + @overload + def __init__( + self, + *, + name: Optional[str] = ..., + order_by: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ClusterResource(ProxyResource): + id: str identity: Optional[ManagedCassandraManagedServiceIdentity] location: Optional[str] name: str @@ -5254,6 +7378,7 @@ namespace azure.mgmt.cosmosdb.models cassandra_version: Optional[str] client_certificates: Optional[list[Certificate]] cluster_name_override: Optional[str] + cluster_type: Optional[Union[str, ClusterType]] deallocated: Optional[bool] delegated_management_subnet_id: Optional[str] extensions: Optional[list[str]] @@ -5284,6 +7409,7 @@ namespace azure.mgmt.cosmosdb.models cassandra_version: Optional[str] = ..., client_certificates: Optional[list[Certificate]] = ..., cluster_name_override: Optional[str] = ..., + cluster_type: Optional[Union[str, ClusterType]] = ..., deallocated: Optional[bool] = ..., delegated_management_subnet_id: Optional[str] = ..., extensions: Optional[list[str]] = ..., @@ -5304,6 +7430,11 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.ClusterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NON_PRODUCTION = "NonProduction" + PRODUCTION = "Production" + + class azure.mgmt.cosmosdb.models.Column(_Model): name: Optional[str] type: Optional[str] @@ -5320,6 +7451,28 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.CommandAsyncPostBody(_Model): + arguments: Optional[Any] + cassandra_stop_start: Optional[bool] + command: str + host: str + read_write: Optional[bool] + + @overload + def __init__( + self, + *, + arguments: Optional[Any] = ..., + cassandra_stop_start: Optional[bool] = ..., + command: str, + host: str, + read_write: Optional[bool] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.CommandOutput(_Model): command_output: Optional[str] @@ -5356,6 +7509,47 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.CommandPublicResource(_Model): + arguments: Optional[Any] + cassandra_stop_start: Optional[bool] + command: Optional[str] + command_id: Optional[str] + host: Optional[str] + is_admin: Optional[bool] + output_file: Optional[str] + read_write: Optional[bool] + result: Optional[str] + status: Optional[Union[str, CommandStatus]] + + @overload + def __init__( + self, + *, + arguments: Optional[Any] = ..., + cassandra_stop_start: Optional[bool] = ..., + command: Optional[str] = ..., + command_id: Optional[str] = ..., + host: Optional[str] = ..., + is_admin: Optional[bool] = ..., + output_file: Optional[str] = ..., + read_write: Optional[bool] = ..., + result: Optional[str] = ..., + status: Optional[Union[str, CommandStatus]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CommandStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DONE = "Done" + ENQUEUE = "Enqueue" + FAILED = "Failed" + FINISHED = "Finished" + PROCESSING = "Processing" + RUNNING = "Running" + + class azure.mgmt.cosmosdb.models.CompositePath(_Model): order: Optional[Union[str, CompositePathSortOrder]] path: Optional[str] @@ -5549,54 +7743,294 @@ namespace azure.mgmt.cosmosdb.models class azure.mgmt.cosmosdb.models.ContinuousTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONTINUOUS30_DAYS = "Continuous30Days" + CONTINUOUS35_DAYS = "Continuous35Days" CONTINUOUS7_DAYS = "Continuous7Days" - class azure.mgmt.cosmosdb.models.CorsPolicy(_Model): - allowed_headers: Optional[str] - allowed_methods: Optional[str] - allowed_origins: str - exposed_headers: Optional[str] - max_age_in_seconds: Optional[int] + class azure.mgmt.cosmosdb.models.CopyJobGetResults(ProxyResource): + id: str + name: str + properties: CopyJobProperties + system_data: SystemData + type: str @overload def __init__( self, *, - allowed_headers: Optional[str] = ..., - allowed_methods: Optional[str] = ..., - allowed_origins: str, - exposed_headers: Optional[str] = ..., - max_age_in_seconds: Optional[int] = ... + properties: CopyJobProperties ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - DEFAULT = "Default" - RESTORE = "Restore" + class azure.mgmt.cosmosdb.models.CopyJobMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + OFFLINE = "Offline" + ONLINE = "Online" - class azure.mgmt.cosmosdb.models.CreateUpdateOptions(_Model): - autoscale_settings: Optional[AutoscaleSettings] - throughput: Optional[int] + class azure.mgmt.cosmosdb.models.CopyJobProperties(_Model): + duration: Optional[str] + error: Optional[ErrorResponse] + job_properties: BaseCopyJobProperties + last_updated_utc_time: Optional[datetime] + mode: Optional[Union[str, CopyJobMode]] + processed_count: Optional[int] + status: Optional[Union[str, CopyJobStatus]] + total_count: Optional[int] + worker_count: Optional[int] @overload def __init__( self, *, - autoscale_settings: Optional[AutoscaleSettings] = ..., - throughput: Optional[int] = ... + job_properties: BaseCopyJobProperties, + mode: Optional[Union[str, CopyJobMode]] = ..., + worker_count: Optional[int] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - APPLICATION = "Application" + class azure.mgmt.cosmosdb.models.CopyJobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CANCELLED = "Cancelled" + COMPLETED = "Completed" + FAULTED = "Faulted" + PARTITIONING = "Partitioning" + PAUSED = "Paused" + PENDING = "Pending" + RUNNING = "Running" + + + class azure.mgmt.cosmosdb.models.CopyJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB_STORAGE_TO_CASSANDRA_RU = "AzureBlobStorageToCassandraRU" + CASSANDRA_RU_TO_AZURE_BLOB_STORAGE = "CassandraRUToAzureBlobStorage" + CASSANDRA_RU_TO_CASSANDRA_RU = "CassandraRUToCassandraRU" + MONGO_RU_TO_MONGO_RU = "MongoRUToMongoRU" + MONGO_RU_TO_MONGO_V_CORE = "MongoRUToMongoVCore" + NO_SQL_RU_TO_NO_SQL_RU = "NoSqlRUToNoSqlRU" + + + class azure.mgmt.cosmosdb.models.CorsPolicy(_Model): + allowed_headers: Optional[str] + allowed_methods: Optional[str] + allowed_origins: str + exposed_headers: Optional[str] + max_age_in_seconds: Optional[int] + + @overload + def __init__( + self, + *, + allowed_headers: Optional[str] = ..., + allowed_methods: Optional[str] = ..., + allowed_origins: str, + exposed_headers: Optional[str] = ..., + max_age_in_seconds: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosCassandraDataTransferDataSourceSink(BaseCosmosDataTransferDataSourceSink, discriminator='CosmosDBCassandra'): + component: Literal[DataTransferComponent.COSMOS_DB_CASSANDRA] + keyspace_name: str + remote_account_name: str + table_name: str + + @overload + def __init__( + self, + *, + keyspace_name: str, + remote_account_name: Optional[str] = ..., + table_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosDBCassandraTable(_Model): + keyspace_name: str + table_name: str + + @overload + def __init__( + self, + *, + keyspace_name: str, + table_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosDBMongoCollection(_Model): + collection_name: str + database_name: str + + @overload + def __init__( + self, + *, + collection_name: str, + database_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosDBMongoVCoreCollection(_Model): + collection_name: str + database_name: str + + @overload + def __init__( + self, + *, + collection_name: str, + database_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosDBNoSqlContainer(_Model): + container_name: str + database_name: str + + @overload + def __init__( + self, + *, + container_name: str, + database_name: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails(_Model): + remote_account_name: Optional[str] + + @overload + def __init__( + self, + *, + remote_account_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosMongoDataTransferDataSourceSink(BaseCosmosDataTransferDataSourceSink, discriminator='CosmosDBMongo'): + collection_name: str + component: Literal[DataTransferComponent.COSMOS_DB_MONGO] + database_name: str + remote_account_name: str + + @overload + def __init__( + self, + *, + collection_name: str, + database_name: str, + remote_account_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosMongoVCoreDataTransferDataSourceSink(DataTransferDataSourceSink, discriminator='CosmosDBMongoVCore'): + collection_name: str + component: Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE] + connection_string_key_vault_uri: Optional[str] + database_name: str + host_name: Optional[str] + + @overload + def __init__( + self, + *, + collection_name: str, + connection_string_key_vault_uri: Optional[str] = ..., + database_name: str, + host_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CosmosSqlDataTransferDataSourceSink(BaseCosmosDataTransferDataSourceSink, discriminator='CosmosDBSql'): + component: Literal[DataTransferComponent.COSMOS_DB_SQL] + container_name: str + database_name: str + remote_account_name: str + + @overload + def __init__( + self, + *, + container_name: str, + database_name: str, + remote_account_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CreateJobRequest(ARMProxyResource): + id: str + name: str + properties: DataTransferJobProperties + type: str + + @overload + def __init__( + self, + *, + properties: DataTransferJobProperties + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DEFAULT = "Default" + RESTORE = "Restore" + + + class azure.mgmt.cosmosdb.models.CreateUpdateOptions(_Model): + autoscale_settings: Optional[AutoscaleSettings] + throughput: Optional[int] + + @overload + def __init__( + self, + *, + autoscale_settings: Optional[AutoscaleSettings] = ..., + throughput: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" KEY = "Key" MANAGED_IDENTITY = "ManagedIdentity" USER = "User" @@ -5663,73 +8097,86 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource(RegionalServiceResource): - location: str - name: str - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.models.DataMaskingPolicy(_Model): + excluded_paths: Optional[list[DataMaskingPolicyExcludedPathsItem]] + included_paths: Optional[list[DataMaskingPolicyIncludedPathsItem]] + is_policy_enabled: Optional[bool] + @overload + def __init__( + self, + *, + excluded_paths: Optional[list[DataMaskingPolicyExcludedPathsItem]] = ..., + included_paths: Optional[list[DataMaskingPolicyIncludedPathsItem]] = ..., + is_policy_enabled: Optional[bool] = ... + ) -> None: ... - class azure.mgmt.cosmosdb.models.DataTransferServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='DataTransfer'): - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.DATA_TRANSFER] + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.DataMaskingPolicyExcludedPathsItem(_Model): + path: str @overload def __init__( self, *, - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + path: str ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties(ServiceResourceProperties, discriminator='DataTransfer'): - creation_time: datetime - instance_count: int - instance_size: Union[str, ServiceSize] - locations: Optional[list[DataTransferRegionalServiceResource]] - service_type: Literal[ServiceType.DATA_TRANSFER] - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.models.DataMaskingPolicyIncludedPathsItem(_Model): + length: Optional[int] + path: str + start_position: Optional[int] + strategy: Optional[str] @overload def __init__( self, *, - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + length: Optional[int] = ..., + path: str, + start_position: Optional[int] = ..., + strategy: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LINE_STRING = "LineString" - MULTI_POLYGON = "MultiPolygon" - NUMBER = "Number" - POINT = "Point" - POLYGON = "Polygon" - STRING = "String" + class azure.mgmt.cosmosdb.models.DataTransferComponent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB_STORAGE = "AzureBlobStorage" + BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK = "BaseCosmosDataTransferDataSourceSink" + COSMOS_DB_CASSANDRA = "CosmosDBCassandra" + COSMOS_DB_MONGO = "CosmosDBMongo" + COSMOS_DB_MONGO_V_CORE = "CosmosDBMongoVCore" + COSMOS_DB_SQL = "CosmosDBSql" - class azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString(_Model): - connection_string: Optional[str] - description: Optional[str] - key_kind: Optional[Union[str, Kind]] - type: Optional[Union[str, Type]] + class azure.mgmt.cosmosdb.models.DataTransferDataSourceSink(_Model): + component: str + @overload + def __init__( + self, + *, + component: str + ) -> None: ... - class azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.DataTransferJobGetResults(ProxyResource): id: str - identity: ManagedServiceIdentity - kind: Optional[Union[str, DatabaseAccountKind]] - location: str name: str - properties: DatabaseAccountCreateUpdateProperties - tags: dict[str, str] + properties: Optional[DataTransferJobProperties] + system_data: SystemData type: str def __getattr__(self, name: str) -> Any: ... @@ -5738,11 +8185,7 @@ namespace azure.mgmt.cosmosdb.models def __init__( self, *, - identity: Optional[ManagedServiceIdentity] = ..., - kind: Optional[Union[str, DatabaseAccountKind]] = ..., - location: Optional[str] = ..., - properties: DatabaseAccountCreateUpdateProperties, - tags: Optional[dict[str, str]] = ... + properties: Optional[DataTransferJobProperties] = ... ) -> None: ... @overload @@ -5755,27 +8198,155 @@ namespace azure.mgmt.cosmosdb.models ) -> None: ... - class azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateProperties(_Model): - analytical_storage_configuration: Optional[AnalyticalStorageConfiguration] - api_properties: Optional[ApiProperties] - backup_policy: Optional[BackupPolicy] - capabilities: Optional[list[Capability]] - capacity: Optional[Capacity] - connector_offer: Optional[Union[str, ConnectorOffer]] - consistency_policy: Optional[ConsistencyPolicy] - cors: Optional[list[CorsPolicy]] - create_mode: Optional[Union[str, CreateMode]] + class azure.mgmt.cosmosdb.models.DataTransferJobMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + OFFLINE = "Offline" + ONLINE = "Online" + + + class azure.mgmt.cosmosdb.models.DataTransferJobProperties(_Model): + destination: DataTransferDataSourceSink + duration: Optional[str] + error: Optional[ErrorResponseAutoGenerated] + job_name: Optional[str] + last_updated_utc_time: Optional[datetime] + mode: Optional[Union[str, DataTransferJobMode]] + processed_count: Optional[int] + source: DataTransferDataSourceSink + status: Optional[str] + total_count: Optional[int] + worker_count: Optional[int] + + @overload + def __init__( + self, + *, + destination: DataTransferDataSourceSink, + mode: Optional[Union[str, DataTransferJobMode]] = ..., + source: DataTransferDataSourceSink, + worker_count: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource(RegionalServiceResource): + location: str + name: str + status: Union[str, ServiceStatus] + + + class azure.mgmt.cosmosdb.models.DataTransferServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='DataTransfer'): + instance_count: int + instance_size: Union[str, ServiceSize] + service_type: Literal[ServiceType.DATA_TRANSFER] + + @overload + def __init__( + self, + *, + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties(ServiceResourceProperties, discriminator='DataTransfer'): + creation_time: datetime + instance_count: int + instance_size: Union[str, ServiceSize] + locations: Optional[list[DataTransferRegionalServiceResource]] + service_type: Literal[ServiceType.DATA_TRANSFER] + status: Union[str, ServiceStatus] + + @overload + def __init__( + self, + *, + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LINE_STRING = "LineString" + MULTI_POLYGON = "MultiPolygon" + NUMBER = "Number" + POINT = "Point" + POLYGON = "Polygon" + STRING = "String" + + + class azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString(_Model): + connection_string: Optional[str] + description: Optional[str] + key_kind: Optional[Union[str, Kind]] + type: Optional[Union[str, Type]] + + + class azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + kind: Optional[Union[str, DatabaseAccountKind]] + location: str + name: str + properties: DatabaseAccountCreateUpdateProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + kind: Optional[Union[str, DatabaseAccountKind]] = ..., + location: Optional[str] = ..., + properties: DatabaseAccountCreateUpdateProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateProperties(_Model): + analytical_storage_configuration: Optional[AnalyticalStorageConfiguration] + api_properties: Optional[ApiProperties] + backup_policy: Optional[BackupPolicy] + capabilities: Optional[list[Capability]] + capacity: Optional[Capacity] + capacity_mode: Optional[Union[str, CapacityMode]] + connector_offer: Optional[Union[str, ConnectorOffer]] + consistency_policy: Optional[ConsistencyPolicy] + cors: Optional[list[CorsPolicy]] + create_mode: Optional[Union[str, CreateMode]] customer_managed_key_status: Optional[str] database_account_offer_type: Literal["Standard"] default_identity: Optional[str] default_priority_level: Optional[Union[str, DefaultPriorityLevel]] + diagnostic_log_settings: Optional[DiagnosticLogSettings] disable_key_based_metadata_write_access: Optional[bool] disable_local_auth: Optional[bool] + enable_all_versions_and_deletes_change_feed: Optional[bool] enable_analytical_storage: Optional[bool] enable_automatic_failover: Optional[bool] enable_burst_capacity: Optional[bool] enable_cassandra_connector: Optional[bool] enable_free_tier: Optional[bool] + enable_materialized_views: Optional[bool] enable_multiple_write_locations: Optional[bool] enable_partition_merge: Optional[bool] enable_per_region_per_partition_autoscale: Optional[bool] @@ -5791,6 +8362,7 @@ namespace azure.mgmt.cosmosdb.models network_acl_bypass_resource_ids: Optional[list[str]] public_network_access: Optional[Union[str, PublicNetworkAccess]] restore_parameters: Optional[RestoreParameters] + soft_delete_configuration: Optional[SoftDeleteConfiguration] virtual_network_rules: Optional[list[VirtualNetworkRule]] @overload @@ -5802,6 +8374,7 @@ namespace azure.mgmt.cosmosdb.models backup_policy: Optional[BackupPolicy] = ..., capabilities: Optional[list[Capability]] = ..., capacity: Optional[Capacity] = ..., + capacity_mode: Optional[Union[str, CapacityMode]] = ..., connector_offer: Optional[Union[str, ConnectorOffer]] = ..., consistency_policy: Optional[ConsistencyPolicy] = ..., cors: Optional[list[CorsPolicy]] = ..., @@ -5809,13 +8382,16 @@ namespace azure.mgmt.cosmosdb.models customer_managed_key_status: Optional[str] = ..., default_identity: Optional[str] = ..., default_priority_level: Optional[Union[str, DefaultPriorityLevel]] = ..., + diagnostic_log_settings: Optional[DiagnosticLogSettings] = ..., disable_key_based_metadata_write_access: Optional[bool] = ..., disable_local_auth: Optional[bool] = ..., + enable_all_versions_and_deletes_change_feed: Optional[bool] = ..., enable_analytical_storage: Optional[bool] = ..., enable_automatic_failover: Optional[bool] = ..., enable_burst_capacity: Optional[bool] = ..., enable_cassandra_connector: Optional[bool] = ..., enable_free_tier: Optional[bool] = ..., + enable_materialized_views: Optional[bool] = ..., enable_multiple_write_locations: Optional[bool] = ..., enable_partition_merge: Optional[bool] = ..., enable_per_region_per_partition_autoscale: Optional[bool] = ..., @@ -5830,6 +8406,7 @@ namespace azure.mgmt.cosmosdb.models network_acl_bypass_resource_ids: Optional[list[str]] = ..., public_network_access: Optional[Union[str, PublicNetworkAccess]] = ..., restore_parameters: Optional[RestoreParameters] = ..., + soft_delete_configuration: Optional[SoftDeleteConfiguration] = ..., virtual_network_rules: Optional[list[VirtualNetworkRule]] = ... ) -> None: ... @@ -5843,6 +8420,8 @@ namespace azure.mgmt.cosmosdb.models backup_policy: Optional[BackupPolicy] capabilities: Optional[list[Capability]] capacity: Optional[Capacity] + capacity_mode: Optional[Union[str, CapacityMode]] + capacity_mode_change_transition_state: Optional[CapacityModeChangeTransitionState] connector_offer: Optional[Union[str, ConnectorOffer]] consistency_policy: Optional[ConsistencyPolicy] cors: Optional[list[CorsPolicy]] @@ -5851,14 +8430,17 @@ namespace azure.mgmt.cosmosdb.models database_account_offer_type: Optional[Literal["Standard"]] default_identity: Optional[str] default_priority_level: Optional[Union[str, DefaultPriorityLevel]] + diagnostic_log_settings: Optional[DiagnosticLogSettings] disable_key_based_metadata_write_access: Optional[bool] disable_local_auth: Optional[bool] document_endpoint: Optional[str] + enable_all_versions_and_deletes_change_feed: Optional[bool] enable_analytical_storage: Optional[bool] enable_automatic_failover: Optional[bool] enable_burst_capacity: Optional[bool] enable_cassandra_connector: Optional[bool] enable_free_tier: Optional[bool] + enable_materialized_views: Optional[bool] enable_multiple_write_locations: Optional[bool] enable_partition_merge: Optional[bool] enable_per_region_per_partition_autoscale: Optional[bool] @@ -5880,6 +8462,9 @@ namespace azure.mgmt.cosmosdb.models public_network_access: Optional[Union[str, PublicNetworkAccess]] read_locations: Optional[list[Location]] restore_parameters: Optional[RestoreParameters] + soft_delete_configuration: Optional[SoftDeleteConfiguration] + throughput_pool_dedicated_r_us: Optional[int] + throughput_pool_max_consumable_r_us: Optional[int] virtual_network_rules: Optional[list[VirtualNetworkRule]] write_locations: Optional[list[Location]] @@ -5892,6 +8477,8 @@ namespace azure.mgmt.cosmosdb.models backup_policy: Optional[BackupPolicy] = ..., capabilities: Optional[list[Capability]] = ..., capacity: Optional[Capacity] = ..., + capacity_mode: Optional[Union[str, CapacityMode]] = ..., + capacity_mode_change_transition_state: Optional[CapacityModeChangeTransitionState] = ..., connector_offer: Optional[Union[str, ConnectorOffer]] = ..., consistency_policy: Optional[ConsistencyPolicy] = ..., cors: Optional[list[CorsPolicy]] = ..., @@ -5899,13 +8486,16 @@ namespace azure.mgmt.cosmosdb.models customer_managed_key_status: Optional[str] = ..., default_identity: Optional[str] = ..., default_priority_level: Optional[Union[str, DefaultPriorityLevel]] = ..., + diagnostic_log_settings: Optional[DiagnosticLogSettings] = ..., disable_key_based_metadata_write_access: Optional[bool] = ..., disable_local_auth: Optional[bool] = ..., + enable_all_versions_and_deletes_change_feed: Optional[bool] = ..., enable_analytical_storage: Optional[bool] = ..., enable_automatic_failover: Optional[bool] = ..., enable_burst_capacity: Optional[bool] = ..., enable_cassandra_connector: Optional[bool] = ..., enable_free_tier: Optional[bool] = ..., + enable_materialized_views: Optional[bool] = ..., enable_multiple_write_locations: Optional[bool] = ..., enable_partition_merge: Optional[bool] = ..., enable_per_region_per_partition_autoscale: Optional[bool] = ..., @@ -5919,6 +8509,9 @@ namespace azure.mgmt.cosmosdb.models network_acl_bypass_resource_ids: Optional[list[str]] = ..., public_network_access: Optional[Union[str, PublicNetworkAccess]] = ..., restore_parameters: Optional[RestoreParameters] = ..., + soft_delete_configuration: Optional[SoftDeleteConfiguration] = ..., + throughput_pool_dedicated_r_us: Optional[int] = ..., + throughput_pool_max_consumable_r_us: Optional[int] = ..., virtual_network_rules: Optional[list[VirtualNetworkRule]] = ... ) -> None: ... @@ -6001,12 +8594,14 @@ namespace azure.mgmt.cosmosdb.models class azure.mgmt.cosmosdb.models.DatabaseAccountRegenerateKeyParameters(_Model): key_kind: Union[str, KeyKind] + skip_account_keys_last_usage_check: Optional[bool] @overload def __init__( self, *, - key_kind: Union[str, KeyKind] + key_kind: Union[str, KeyKind], + skip_account_keys_last_usage_check: Optional[bool] = ... ) -> None: ... @overload @@ -6047,19 +8642,23 @@ namespace azure.mgmt.cosmosdb.models backup_policy: Optional[BackupPolicy] capabilities: Optional[list[Capability]] capacity: Optional[Capacity] + capacity_mode: Optional[Union[str, CapacityMode]] connector_offer: Optional[Union[str, ConnectorOffer]] consistency_policy: Optional[ConsistencyPolicy] cors: Optional[list[CorsPolicy]] customer_managed_key_status: Optional[str] default_identity: Optional[str] default_priority_level: Optional[Union[str, DefaultPriorityLevel]] + diagnostic_log_settings: Optional[DiagnosticLogSettings] disable_key_based_metadata_write_access: Optional[bool] disable_local_auth: Optional[bool] + enable_all_versions_and_deletes_change_feed: Optional[bool] enable_analytical_storage: Optional[bool] enable_automatic_failover: Optional[bool] enable_burst_capacity: Optional[bool] enable_cassandra_connector: Optional[bool] enable_free_tier: Optional[bool] + enable_materialized_views: Optional[bool] enable_multiple_write_locations: Optional[bool] enable_partition_merge: Optional[bool] enable_per_region_per_partition_autoscale: Optional[bool] @@ -6074,6 +8673,7 @@ namespace azure.mgmt.cosmosdb.models network_acl_bypass: Optional[Union[str, NetworkAclBypass]] network_acl_bypass_resource_ids: Optional[list[str]] public_network_access: Optional[Union[str, PublicNetworkAccess]] + soft_delete_configuration: Optional[SoftDeleteConfiguration] virtual_network_rules: Optional[list[VirtualNetworkRule]] @overload @@ -6085,19 +8685,23 @@ namespace azure.mgmt.cosmosdb.models backup_policy: Optional[BackupPolicy] = ..., capabilities: Optional[list[Capability]] = ..., capacity: Optional[Capacity] = ..., + capacity_mode: Optional[Union[str, CapacityMode]] = ..., connector_offer: Optional[Union[str, ConnectorOffer]] = ..., consistency_policy: Optional[ConsistencyPolicy] = ..., cors: Optional[list[CorsPolicy]] = ..., customer_managed_key_status: Optional[str] = ..., default_identity: Optional[str] = ..., default_priority_level: Optional[Union[str, DefaultPriorityLevel]] = ..., + diagnostic_log_settings: Optional[DiagnosticLogSettings] = ..., disable_key_based_metadata_write_access: Optional[bool] = ..., disable_local_auth: Optional[bool] = ..., + enable_all_versions_and_deletes_change_feed: Optional[bool] = ..., enable_analytical_storage: Optional[bool] = ..., enable_automatic_failover: Optional[bool] = ..., enable_burst_capacity: Optional[bool] = ..., enable_cassandra_connector: Optional[bool] = ..., enable_free_tier: Optional[bool] = ..., + enable_materialized_views: Optional[bool] = ..., enable_multiple_write_locations: Optional[bool] = ..., enable_partition_merge: Optional[bool] = ..., enable_per_region_per_partition_autoscale: Optional[bool] = ..., @@ -6111,6 +8715,7 @@ namespace azure.mgmt.cosmosdb.models network_acl_bypass: Optional[Union[str, NetworkAclBypass]] = ..., network_acl_bypass_resource_ids: Optional[list[str]] = ..., public_network_access: Optional[Union[str, PublicNetworkAccess]] = ..., + soft_delete_configuration: Optional[SoftDeleteConfiguration] = ..., virtual_network_rules: Optional[list[VirtualNetworkRule]] = ... ) -> None: ... @@ -6152,12 +8757,32 @@ namespace azure.mgmt.cosmosdb.models LOW = "Low" + class azure.mgmt.cosmosdb.models.DiagnosticLogSettings(_Model): + enable_full_text_query: Optional[Union[str, EnableFullTextQuery]] + + @overload + def __init__( + self, + *, + enable_full_text_query: Optional[Union[str, EnableFullTextQuery]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.DistanceFunction(str, Enum, metaclass=CaseInsensitiveEnumMeta): COSINE = "cosine" DOTPRODUCT = "dotproduct" EUCLIDEAN = "euclidean" + class azure.mgmt.cosmosdb.models.EnableFullTextQuery(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FALSE = "False" + NONE = "None" + TRUE = "True" + + class azure.mgmt.cosmosdb.models.ErrorAdditionalInfo(_Model): info: Optional[Any] type: Optional[str] @@ -6246,6 +8871,54 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.FleetAnalyticsProperties(_Model): + provisioning_state: Optional[Union[str, Status]] + storage_location_type: Optional[Union[str, FleetAnalyticsPropertiesStorageLocationType]] + storage_location_uri: Optional[str] + + @overload + def __init__( + self, + *, + storage_location_type: Optional[Union[str, FleetAnalyticsPropertiesStorageLocationType]] = ..., + storage_location_uri: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.FleetAnalyticsPropertiesStorageLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + FABRIC_LAKEHOUSE = "FabricLakehouse" + STORAGE_ACCOUNT = "StorageAccount" + + + class azure.mgmt.cosmosdb.models.FleetAnalyticsResource(ProxyResource): + id: str + name: str + properties: Optional[FleetAnalyticsProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[FleetAnalyticsProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + class azure.mgmt.cosmosdb.models.FleetResource(TrackedResource): id: str location: str @@ -6505,118 +9178,380 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - graph_api_compute_endpoint: Optional[str] - location: str - name: str - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.models.GarnetAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ENTRA = "Entra" - class azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='GraphAPICompute'): - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] + class azure.mgmt.cosmosdb.models.GarnetCacheProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.mgmt.cosmosdb.models.GarnetClusterResource(TrackedResource): + id: str + identity: Optional[ManagedCassandraManagedServiceIdentity] + location: str + name: str + properties: Optional[GarnetClusterResourceProperties] + system_data: SystemData + tags: dict[str, str] + type: str @overload def __init__( self, *, - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + identity: Optional[ManagedCassandraManagedServiceIdentity] = ..., + location: str, + properties: Optional[GarnetClusterResourceProperties] = ..., + tags: Optional[dict[str, str]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties(ServiceResourceProperties, discriminator='GraphAPICompute'): - creation_time: datetime - graph_api_compute_endpoint: Optional[str] - instance_count: int - instance_size: Union[str, ServiceSize] - locations: Optional[list[GraphAPIComputeRegionalServiceResource]] - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch(_Model): + properties: Optional[GarnetClusterResourcePatchProperties] @overload def __init__( self, *, - graph_api_compute_endpoint: Optional[str] = ..., - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + properties: Optional[GarnetClusterResourcePatchProperties] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: GremlinDatabaseCreateUpdateProperties - tags: dict[str, str] - type: str - - def __getattr__(self, name: str) -> Any: ... + class azure.mgmt.cosmosdb.models.GarnetClusterResourcePatchProperties(_Model): + authentication_method: Optional[Union[str, GarnetAuthenticationType]] + cluster_type: Optional[Union[str, ClusterType]] + extensions: Optional[list[str]] + persistence: Optional[bool] @overload def __init__( self, *, - identity: Optional[ManagedServiceIdentity] = ..., - location: Optional[str] = ..., - properties: GremlinDatabaseCreateUpdateProperties, - tags: Optional[dict[str, str]] = ... + authentication_method: Optional[Union[str, GarnetAuthenticationType]] = ..., + cluster_type: Optional[Union[str, ClusterType]] = ..., + extensions: Optional[list[str]] = ..., + persistence: Optional[bool] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - def __setattr__( - self, - key: str, - value: Any - ) -> None: ... - - class azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateProperties(_Model): - options: Optional[CreateUpdateOptions] - resource: GremlinDatabaseResource + class azure.mgmt.cosmosdb.models.GarnetClusterResourceProperties(_Model): + allocation_state: Optional[Union[str, AllocationState]] + authentication_method: Optional[Union[str, GarnetAuthenticationType]] + availability_zone: Optional[bool] + cluster_type: Optional[Union[str, ClusterType]] + end_points: Optional[list[GarnetClusterResourcePropertiesEndPointsItem]] + extensions: Optional[list[str]] + node_sku: Optional[str] + persistence: Optional[bool] + provision_error: Optional[ErrorDetail] + provisioning_state: Optional[Union[str, GarnetCacheProvisioningState]] + replication_factor: Optional[int] + shard_count: Optional[int] + subnet_id: Optional[str] @overload def __init__( self, *, - options: Optional[CreateUpdateOptions] = ..., - resource: GremlinDatabaseResource + allocation_state: Optional[Union[str, AllocationState]] = ..., + authentication_method: Optional[Union[str, GarnetAuthenticationType]] = ..., + availability_zone: Optional[bool] = ..., + cluster_type: Optional[Union[str, ClusterType]] = ..., + extensions: Optional[list[str]] = ..., + node_sku: Optional[str] = ..., + persistence: Optional[bool] = ..., + provision_error: Optional[ErrorDetail] = ..., + replication_factor: Optional[int] = ..., + shard_count: Optional[int] = ..., + subnet_id: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.GremlinDatabaseGetProperties(_Model): - options: Optional[GremlinDatabaseGetPropertiesOptions] - resource: Optional[GremlinDatabaseGetPropertiesResource] + class azure.mgmt.cosmosdb.models.GarnetClusterResourcePropertiesEndPointsItem(_Model): + ip_address: Optional[str] + port: Optional[int] @overload def __init__( self, *, - options: Optional[GremlinDatabaseGetPropertiesOptions] = ..., - resource: Optional[GremlinDatabaseGetPropertiesResource] = ... + ip_address: Optional[str] = ..., + port: Optional[int] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions(OptionsResource): - autoscale_settings: AutoscaleSettings - throughput: int + class azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource(RegionalServiceResource): + graph_api_compute_endpoint: Optional[str] + location: str + name: str + status: Union[str, ServiceStatus] + + + class azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='GraphAPICompute'): + instance_count: int + instance_size: Union[str, ServiceSize] + service_type: Literal[ServiceType.GRAPH_API_COMPUTE] + + @overload + def __init__( + self, + *, + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties(ServiceResourceProperties, discriminator='GraphAPICompute'): + creation_time: datetime + graph_api_compute_endpoint: Optional[str] + instance_count: int + instance_size: Union[str, ServiceSize] + locations: Optional[list[GraphAPIComputeRegionalServiceResource]] + service_type: Literal[ServiceType.GRAPH_API_COMPUTE] + status: Union[str, ServiceStatus] + + @overload + def __init__( + self, + *, + graph_api_compute_endpoint: Optional[str] = ..., + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResource(_Model): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: GraphResourceCreateUpdateProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: GraphResourceCreateUpdateProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateProperties(_Model): + options: Optional[CreateUpdateOptions] + resource: GraphResource + + @overload + def __init__( + self, + *, + options: Optional[CreateUpdateOptions] = ..., + resource: GraphResource + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceGetProperties(_Model): + options: Optional[GraphResourceGetPropertiesOptions] + resource: Optional[GraphResourceGetPropertiesResource] + + @overload + def __init__( + self, + *, + options: Optional[GraphResourceGetPropertiesOptions] = ..., + resource: Optional[GraphResourceGetPropertiesResource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions(OptionsResource): + autoscale_settings: AutoscaleSettings + throughput: int + + @overload + def __init__( + self, + *, + autoscale_settings: Optional[AutoscaleSettings] = ..., + throughput: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource(GraphResource): + id: str + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GraphResourceGetResults(ProxyResource): + id: str + identity: Optional[ManagedServiceIdentity] + location: Optional[str] + name: str + properties: Optional[GraphResourceGetProperties] + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: Optional[GraphResourceGetProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: GremlinDatabaseCreateUpdateProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: GremlinDatabaseCreateUpdateProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateProperties(_Model): + options: Optional[CreateUpdateOptions] + resource: GremlinDatabaseResource + + @overload + def __init__( + self, + *, + options: Optional[CreateUpdateOptions] = ..., + resource: GremlinDatabaseResource + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GremlinDatabaseGetProperties(_Model): + options: Optional[GremlinDatabaseGetPropertiesOptions] + resource: Optional[GremlinDatabaseGetPropertiesResource] + + @overload + def __init__( + self, + *, + options: Optional[GremlinDatabaseGetPropertiesOptions] = ..., + resource: Optional[GremlinDatabaseGetPropertiesResource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions(OptionsResource): + autoscale_settings: AutoscaleSettings + throughput: int @overload def __init__( @@ -7072,6 +10007,13 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CONFIGURATION_PROPAGATION_FAILURE = "ConfigurationPropagationFailure" + MISSING_IDENTITY_CONFIGURATION = "MissingIdentityConfiguration" + MISSING_PERIMETER_CONFIGURATION = "MissingPerimeterConfiguration" + UNKNOWN = "Unknown" + + class azure.mgmt.cosmosdb.models.KeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): PRIMARY = "primary" PRIMARY_READONLY = "primaryReadonly" @@ -7225,43 +10167,106 @@ namespace azure.mgmt.cosmosdb.models principal_id: Optional[str] - class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): - location: str - name: str - status: Union[str, ServiceStatus] - - - class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='MaterializedViewsBuilder'): - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] + class azure.mgmt.cosmosdb.models.MaterializedViewDefinition(_Model): + definition: str + source_collection_id: str + source_collection_rid: Optional[str] + throughput_bucket_for_build: Optional[int] @overload def __init__( self, *, - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + definition: str, + source_collection_id: str, + throughput_bucket_for_build: Optional[int] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties(ServiceResourceProperties, discriminator='MaterializedViewsBuilder'): - creation_time: datetime - instance_count: int - instance_size: Union[str, ServiceSize] - locations: Optional[list[MaterializedViewsBuilderRegionalServiceResource]] - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.models.MaterializedViewDetails(_Model): + id: Optional[str] + rid: Optional[str] @overload def __init__( self, *, - instance_count: Optional[int] = ..., - instance_size: Optional[Union[str, ServiceSize]] = ... + id: Optional[str] = ..., + rid: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): + location: str + name: str + status: Union[str, ServiceStatus] + + + class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceCreateUpdateProperties(ServiceResourceCreateUpdateProperties, discriminator='MaterializedViewsBuilder'): + instance_count: int + instance_size: Union[str, ServiceSize] + service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] + + @overload + def __init__( + self, + *, + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties(ServiceResourceProperties, discriminator='MaterializedViewsBuilder'): + creation_time: datetime + instance_count: int + instance_size: Union[str, ServiceSize] + locations: Optional[list[MaterializedViewsBuilderRegionalServiceResource]] + service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] + status: Union[str, ServiceStatus] + + @overload + def __init__( + self, + *, + instance_count: Optional[int] = ..., + instance_size: Optional[Union[str, ServiceSize]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MaterializedViewsProperties(_Model): + throughput_bucket_for_build: Optional[int] + + @overload + def __init__( + self, + *, + throughput_bucket_for_build: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MergeParameters(_Model): + is_dry_run: Optional[bool] + + @overload + def __init__( + self, + *, + is_dry_run: Optional[bool] = ... ) -> None: ... @overload @@ -7769,6 +10774,80 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.MongoRUToMongoRUCopyJobProperties(BaseCopyJobProperties, discriminator='MongoRUToMongoRU'): + destination_details: Optional[CosmosDBSourceSinkDetails] + job_type: Literal[CopyJobType.MONGO_RU_TO_MONGO_RU] + source_details: Optional[CosmosDBSourceSinkDetails] + tasks: list[MongoRUToMongoRUCopyJobTask] + + @overload + def __init__( + self, + *, + destination_details: Optional[CosmosDBSourceSinkDetails] = ..., + source_details: Optional[CosmosDBSourceSinkDetails] = ..., + tasks: list[MongoRUToMongoRUCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MongoRUToMongoRUCopyJobTask(BaseCopyJobTask): + destination: CosmosDBMongoCollection + processed_count: int + source: CosmosDBMongoCollection + total_count: int + + @overload + def __init__( + self, + *, + destination: CosmosDBMongoCollection, + source: CosmosDBMongoCollection + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MongoRUToMongoVCoreCopyJobProperties(BaseCopyJobProperties, discriminator='MongoRUToMongoVCore'): + destination_details: MongoVCoreSourceSinkDetails + job_type: Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE] + source_details: Optional[CosmosDBSourceSinkDetails] + tasks: list[MongoRUToMongoVCoreCopyJobTask] + + @overload + def __init__( + self, + *, + destination_details: MongoVCoreSourceSinkDetails, + source_details: Optional[CosmosDBSourceSinkDetails] = ..., + tasks: list[MongoRUToMongoVCoreCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.MongoRUToMongoVCoreCopyJobTask(BaseCopyJobTask): + destination: CosmosDBMongoVCoreCollection + processed_count: int + source: CosmosDBMongoCollection + total_count: int + + @overload + def __init__( + self, + *, + destination: CosmosDBMongoVCoreCollection, + source: CosmosDBMongoCollection + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters(_Model): properties: Optional[MongoRoleDefinitionResource] @@ -7916,11 +10995,152 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.MongoVCoreSourceSinkDetails(_Model): + connection_string_key_vault_uri: Optional[str] + host_name: Optional[str] + + @overload + def __init__( + self, + *, + connection_string_key_vault_uri: Optional[str] = ..., + host_name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.NetworkAclBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_SERVICES = "AzureServices" NONE = "None" + class azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter(_Model): + id: Optional[str] + location: Optional[str] + perimeter_guid: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ..., + location: Optional[str] = ..., + perimeter_guid: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration(ProxyResource): + id: str + name: str + properties: Optional[NetworkSecurityPerimeterConfigurationProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[NetworkSecurityPerimeterConfigurationProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProperties(_Model): + network_security_perimeter: Optional[NetworkSecurityPerimeter] + profile: Optional[NetworkSecurityProfile] + provisioning_issues: Optional[list[ProvisioningIssue]] + provisioning_state: Optional[Union[str, NetworkSecurityPerimeterConfigurationProvisioningState]] + resource_association: Optional[ResourceAssociation] + + @overload + def __init__( + self, + *, + network_security_perimeter: Optional[NetworkSecurityPerimeter] = ..., + profile: Optional[NetworkSecurityProfile] = ..., + resource_association: Optional[ResourceAssociation] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACCEPTED = "Accepted" + CANCELED = "Canceled" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + + class azure.mgmt.cosmosdb.models.NetworkSecurityProfile(_Model): + access_rules: Optional[list[AccessRule]] + access_rules_version: Optional[int] + diagnostic_settings_version: Optional[int] + enabled_log_categories: Optional[list[str]] + name: Optional[str] + + @overload + def __init__( + self, + *, + access_rules: Optional[list[AccessRule]] = ..., + access_rules_version: Optional[int] = ..., + diagnostic_settings_version: Optional[int] = ..., + enabled_log_categories: Optional[list[str]] = ..., + name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.NoSqlRUToNoSqlRUCopyJobProperties(BaseCopyJobProperties, discriminator='NoSqlRUToNoSqlRU'): + destination_details: Optional[CosmosDBSourceSinkDetails] + job_type: Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU] + source_details: Optional[CosmosDBSourceSinkDetails] + tasks: list[NoSqlRUToNoSqlRUCopyJobTask] + + @overload + def __init__( + self, + *, + destination_details: Optional[CosmosDBSourceSinkDetails] = ..., + source_details: Optional[CosmosDBSourceSinkDetails] = ..., + tasks: list[NoSqlRUToNoSqlRUCopyJobTask] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.NoSqlRUToNoSqlRUCopyJobTask(BaseCopyJobTask): + destination: CosmosDBNoSqlContainer + processed_count: int + source: CosmosDBNoSqlContainer + total_count: int + + @overload + def __init__( + self, + *, + destination: CosmosDBNoSqlContainer, + source: CosmosDBNoSqlContainer + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): JOINING = "Joining" LEAVING = "Leaving" @@ -8140,80 +11360,68 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.PrimaryAggregationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - AVERAGE = "Average" - LAST = "Last" - MAXIMUM = "Maximum" - MINIMUM = "Minimum" - NONE = "None" - TOTAL = "Total" - - - class azure.mgmt.cosmosdb.models.PrivateEndpointConnection(ProxyResource): + class azure.mgmt.cosmosdb.models.PhysicalPartitionId(_Model): id: str - name: str - properties: Optional[PrivateEndpointConnectionProperties] - system_data: SystemData - type: str - - def __getattr__(self, name: str) -> Any: ... @overload def __init__( self, *, - properties: Optional[PrivateEndpointConnectionProperties] = ... + id: str ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - def __setattr__( - self, - key: str, - value: Any - ) -> None: ... + class azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfo(_Model): + id: Optional[str] + storage_in_kb: Optional[float] - class azure.mgmt.cosmosdb.models.PrivateEndpointConnectionProperties(_Model): - group_id: Optional[str] - private_endpoint: Optional[PrivateEndpointProperty] - private_link_service_connection_state: Optional[PrivateLinkServiceConnectionStateProperty] - provisioning_state: Optional[str] + + class azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection(_Model): + physical_partition_storage_info_collection: Optional[list[PhysicalPartitionStorageInfo]] + + + class azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoProperties(_Model): + physical_partition_throughput_info: Optional[list[PhysicalPartitionThroughputInfoResource]] @overload def __init__( self, *, - group_id: Optional[str] = ..., - private_endpoint: Optional[PrivateEndpointProperty] = ..., - private_link_service_connection_state: Optional[PrivateLinkServiceConnectionStateProperty] = ..., - provisioning_state: Optional[str] = ... + physical_partition_throughput_info: Optional[list[PhysicalPartitionThroughputInfoResource]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.PrivateEndpointProperty(_Model): - id: Optional[str] + class azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource(_Model): + id: str + target_throughput: Optional[float] + throughput: Optional[float] @overload def __init__( self, *, - id: Optional[str] = ... + id: str, + target_throughput: Optional[float] = ..., + throughput: Optional[float] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.PrivateLinkResource(ProxyResource): + class azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult(ARMResourceProperties): id: str + identity: ManagedServiceIdentity + location: str name: str - properties: Optional[PrivateLinkResourceProperties] - system_data: SystemData + properties: Optional[PhysicalPartitionThroughputInfoResultProperties] + tags: dict[str, str] type: str def __getattr__(self, name: str) -> Any: ... @@ -8222,7 +11430,10 @@ namespace azure.mgmt.cosmosdb.models def __init__( self, *, - properties: Optional[PrivateLinkResourceProperties] = ... + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: Optional[PhysicalPartitionThroughputInfoResultProperties] = ..., + tags: Optional[dict[str, str]] = ... ) -> None: ... @overload @@ -8235,7 +11446,130 @@ namespace azure.mgmt.cosmosdb.models ) -> None: ... - class azure.mgmt.cosmosdb.models.PrivateLinkResourceProperties(_Model): + class azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultProperties(_Model): + resource: Optional[PhysicalPartitionThroughputInfoResultPropertiesResource] + + @overload + def __init__( + self, + *, + resource: Optional[PhysicalPartitionThroughputInfoResultPropertiesResource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource(PhysicalPartitionThroughputInfoProperties): + physical_partition_throughput_info: list[PhysicalPartitionThroughputInfoResource] + + @overload + def __init__( + self, + *, + physical_partition_throughput_info: Optional[list[PhysicalPartitionThroughputInfoResource]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.PrimaryAggregationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AVERAGE = "Average" + LAST = "Last" + MAXIMUM = "Maximum" + MINIMUM = "Minimum" + NONE = "None" + TOTAL = "Total" + + + class azure.mgmt.cosmosdb.models.PrivateEndpointConnection(ProxyResource): + id: str + name: str + properties: Optional[PrivateEndpointConnectionProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[PrivateEndpointConnectionProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.PrivateEndpointConnectionProperties(_Model): + group_id: Optional[str] + private_endpoint: Optional[PrivateEndpointProperty] + private_link_service_connection_state: Optional[PrivateLinkServiceConnectionStateProperty] + provisioning_state: Optional[str] + + @overload + def __init__( + self, + *, + group_id: Optional[str] = ..., + private_endpoint: Optional[PrivateEndpointProperty] = ..., + private_link_service_connection_state: Optional[PrivateLinkServiceConnectionStateProperty] = ..., + provisioning_state: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.PrivateEndpointProperty(_Model): + id: Optional[str] + + @overload + def __init__( + self, + *, + id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.PrivateLinkResource(ProxyResource): + id: str + name: str + properties: Optional[PrivateLinkResourceProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[PrivateLinkResourceProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.PrivateLinkResourceProperties(_Model): group_id: Optional[str] required_members: Optional[list[str]] required_zone_names: Optional[list[str]] @@ -8290,6 +11624,19 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.ProvisioningIssue(_Model): + name: Optional[str] + properties: Optional[ProvisioningIssueProperties] + + + class azure.mgmt.cosmosdb.models.ProvisioningIssueProperties(_Model): + description: Optional[str] + issue_type: Optional[Union[str, IssueType]] + severity: Optional[Union[str, Severity]] + suggested_access_rules: Optional[list[AccessRule]] + suggested_resource_ids: Optional[list[str]] + + class azure.mgmt.cosmosdb.models.ProxyResource(Resource): id: str name: str @@ -8303,6 +11650,69 @@ namespace azure.mgmt.cosmosdb.models SECURED_BY_PERIMETER = "SecuredByPerimeter" + class azure.mgmt.cosmosdb.models.RedistributeThroughputParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: RedistributeThroughputProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: RedistributeThroughputProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.RedistributeThroughputProperties(_Model): + resource: RedistributeThroughputPropertiesResource + + @overload + def __init__( + self, + *, + resource: RedistributeThroughputPropertiesResource + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource(_Model): + source_physical_partition_throughput_info: list[PhysicalPartitionThroughputInfoResource] + target_physical_partition_throughput_info: list[PhysicalPartitionThroughputInfoResource] + throughput_policy: Union[str, ThroughputPolicyType] + + @overload + def __init__( + self, + *, + source_physical_partition_throughput_info: list[PhysicalPartitionThroughputInfoResource], + target_physical_partition_throughput_info: list[PhysicalPartitionThroughputInfoResource], + throughput_policy: Union[str, ThroughputPolicyType] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.RegionForOnlineOffline(_Model): region: str @@ -8330,6 +11740,28 @@ namespace azure.mgmt.cosmosdb.models type: Optional[str] + class azure.mgmt.cosmosdb.models.ResourceAssociation(_Model): + access_mode: Optional[Union[str, ResourceAssociationAccessMode]] + name: Optional[str] + + @overload + def __init__( + self, + *, + access_mode: Optional[Union[str, ResourceAssociationAccessMode]] = ..., + name: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AUDIT = "Audit" + ENFORCED = "Enforced" + LEARNING = "Learning" + + class azure.mgmt.cosmosdb.models.ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" @@ -8712,11 +12144,15 @@ namespace azure.mgmt.cosmosdb.models computed_properties: list[ComputedProperty] conflict_resolution_policy: ConflictResolutionPolicy create_mode: Union[str, CreateMode] + data_masking_policy: DataMaskingPolicy default_ttl: int etag: Optional[str] full_text_policy: FullTextPolicy id: str indexing_policy: IndexingPolicy + materialized_view_definition: MaterializedViewDefinition + materialized_views: list[MaterializedViewDetails] + materialized_views_properties: MaterializedViewsProperties partition_key: ContainerPartitionKey restore_parameters: ResourceRestoreParameters rid: Optional[str] @@ -8734,10 +12170,14 @@ namespace azure.mgmt.cosmosdb.models computed_properties: Optional[list[ComputedProperty]] = ..., conflict_resolution_policy: Optional[ConflictResolutionPolicy] = ..., create_mode: Optional[Union[str, CreateMode]] = ..., + data_masking_policy: Optional[DataMaskingPolicy] = ..., default_ttl: Optional[int] = ..., full_text_policy: Optional[FullTextPolicy] = ..., id: str, indexing_policy: Optional[IndexingPolicy] = ..., + materialized_view_definition: Optional[MaterializedViewDefinition] = ..., + materialized_views: Optional[list[MaterializedViewDetails]] = ..., + materialized_views_properties: Optional[MaterializedViewsProperties] = ..., partition_key: Optional[ContainerPartitionKey] = ..., restore_parameters: Optional[ResourceRestoreParameters] = ..., unique_key_policy: Optional[UniqueKeyPolicy] = ..., @@ -8956,6 +12396,65 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... + class azure.mgmt.cosmosdb.models.RetrieveThroughputParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: RetrieveThroughputProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: RetrieveThroughputProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.RetrieveThroughputProperties(_Model): + resource: RetrieveThroughputPropertiesResource + + @overload + def __init__( + self, + *, + resource: RetrieveThroughputPropertiesResource + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource(_Model): + physical_partition_ids: list[PhysicalPartitionId] + + @overload + def __init__( + self, + *, + physical_partition_ids: list[PhysicalPartitionId] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + class azure.mgmt.cosmosdb.models.Role(_Model): db: Optional[str] role: Optional[str] @@ -9099,29 +12598,281 @@ namespace azure.mgmt.cosmosdb.models SQL_DEDICATED_GATEWAY = "SqlDedicatedGateway" - class azure.mgmt.cosmosdb.models.SpatialSpec(_Model): - path: Optional[str] - types: Optional[list[Union[str, SpatialType]]] + class azure.mgmt.cosmosdb.models.Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ERROR = "Error" + WARNING = "Warning" + + + class azure.mgmt.cosmosdb.models.SoftDeleteActionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PERMANENT_DELETE_RESOURCE = "PermanentDeleteResource" + RESTORE_SOFT_DELETED_RESOURCE = "RestoreSoftDeletedResource" + + + class azure.mgmt.cosmosdb.models.SoftDeleteConfiguration(_Model): + min_minutes_before_permanent_deletion_allowed: Optional[int] + soft_delete_retention_period_in_minutes: Optional[int] + soft_deletion_enabled: Optional[bool] @overload def __init__( self, *, - path: Optional[str] = ..., - types: Optional[list[Union[str, SpatialType]]] = ... + min_minutes_before_permanent_deletion_allowed: Optional[int] = ..., + soft_delete_retention_period_in_minutes: Optional[int] = ..., + soft_deletion_enabled: Optional[bool] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - LINE_STRING = "LineString" - MULTI_POLYGON = "MultiPolygon" - POINT = "Point" - POLYGON = "Polygon" - - + class azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountGetResult(ProxyResource): + id: str + name: str + properties: Optional[SoftDeletedDatabaseAccountProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[SoftDeletedDatabaseAccountProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountProperties(_Model): + account_name: Optional[str] + resource: Optional[SoftDeletedDatabaseAccountResource] + soft_delete_configuration: Optional[SoftDeleteConfiguration] + soft_deletion_metadata: Optional[SoftDeletionMetadata] + + @overload + def __init__( + self, + *, + account_name: Optional[str] = ..., + resource: Optional[SoftDeletedDatabaseAccountResource] = ..., + soft_delete_configuration: Optional[SoftDeleteConfiguration] = ..., + soft_deletion_metadata: Optional[SoftDeletionMetadata] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountResource(_Model): + locations: Optional[list[Location]] + read_locations: Optional[list[Location]] + write_locations: Optional[list[Location]] + + @overload + def __init__( + self, + *, + locations: Optional[list[Location]] = ..., + read_locations: Optional[list[Location]] = ..., + write_locations: Optional[list[Location]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult(_Model): + next_link: Optional[str] + value: list[SoftDeletedDatabaseAccountGetResult] + + @overload + def __init__( + self, + *, + next_link: Optional[str] = ..., + value: list[SoftDeletedDatabaseAccountGetResult] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerGetResult(ProxyResource): + id: str + name: str + properties: Optional[SoftDeletedSqlContainerProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[SoftDeletedSqlContainerProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerProperties(_Model): + resource: Optional[SoftDeletedSqlContainerResource] + soft_deletion_metadata: Optional[SoftDeletionMetadata] + + @overload + def __init__( + self, + *, + resource: Optional[SoftDeletedSqlContainerResource] = ..., + soft_deletion_metadata: Optional[SoftDeletionMetadata] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerResource(_Model): + default_ttl: Optional[int] + id: str + partition_key: Optional[ContainerPartitionKey] + rid: Optional[str] + + @overload + def __init__( + self, + *, + default_ttl: Optional[int] = ..., + id: str, + partition_key: Optional[ContainerPartitionKey] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlContainersListResult(_Model): + next_link: Optional[str] + value: list[SoftDeletedSqlContainerGetResult] + + @overload + def __init__( + self, + *, + next_link: Optional[str] = ..., + value: list[SoftDeletedSqlContainerGetResult] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseGetResult(ProxyResource): + id: str + name: str + properties: Optional[SoftDeletedSqlDatabaseProperties] + system_data: SystemData + type: str + + @overload + def __init__( + self, + *, + properties: Optional[SoftDeletedSqlDatabaseProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseProperties(_Model): + resource: Optional[SoftDeletedSqlDatabaseResource] + soft_deletion_metadata: Optional[SoftDeletionMetadata] + + @overload + def __init__( + self, + *, + resource: Optional[SoftDeletedSqlDatabaseResource] = ..., + soft_deletion_metadata: Optional[SoftDeletionMetadata] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseResource(_Model): + id: str + rid: Optional[str] + + @overload + def __init__( + self, + *, + id: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabasesListResult(_Model): + next_link: Optional[str] + value: list[SoftDeletedSqlDatabaseGetResult] + + @overload + def __init__( + self, + *, + next_link: Optional[str] = ..., + value: list[SoftDeletedSqlDatabaseGetResult] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SoftDeletionMetadata(_Model): + is_soft_deleted: Optional[bool] + soft_deletion_resource_expiration_timestamp: Optional[int] + soft_deletion_start_timestamp: Optional[int] + + @overload + def __init__( + self, + *, + is_soft_deleted: Optional[bool] = ..., + soft_deletion_resource_expiration_timestamp: Optional[int] = ..., + soft_deletion_start_timestamp: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SpatialSpec(_Model): + path: Optional[str] + types: Optional[list[Union[str, SpatialType]]] + + @overload + def __init__( + self, + *, + path: Optional[str] = ..., + types: Optional[list[Union[str, SpatialType]]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + LINE_STRING = "LineString" + MULTI_POLYGON = "MultiPolygon" + POINT = "Point" + POLYGON = "Polygon" + + class azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters(ARMResourceProperties): id: str identity: ManagedServiceIdentity @@ -9207,11 +12958,15 @@ namespace azure.mgmt.cosmosdb.models computed_properties: list[ComputedProperty] conflict_resolution_policy: ConflictResolutionPolicy create_mode: Union[str, CreateMode] + data_masking_policy: DataMaskingPolicy default_ttl: int etag: Optional[str] full_text_policy: FullTextPolicy id: str indexing_policy: IndexingPolicy + materialized_view_definition: MaterializedViewDefinition + materialized_views: list[MaterializedViewDetails] + materialized_views_properties: MaterializedViewsProperties partition_key: ContainerPartitionKey restore_parameters: ResourceRestoreParameters rid: Optional[str] @@ -9228,10 +12983,14 @@ namespace azure.mgmt.cosmosdb.models computed_properties: Optional[list[ComputedProperty]] = ..., conflict_resolution_policy: Optional[ConflictResolutionPolicy] = ..., create_mode: Optional[Union[str, CreateMode]] = ..., + data_masking_policy: Optional[DataMaskingPolicy] = ..., default_ttl: Optional[int] = ..., full_text_policy: Optional[FullTextPolicy] = ..., id: str, indexing_policy: Optional[IndexingPolicy] = ..., + materialized_view_definition: Optional[MaterializedViewDefinition] = ..., + materialized_views: Optional[list[MaterializedViewDetails]] = ..., + materialized_views_properties: Optional[MaterializedViewsProperties] = ..., partition_key: Optional[ContainerPartitionKey] = ..., restore_parameters: Optional[ResourceRestoreParameters] = ..., unique_key_policy: Optional[UniqueKeyPolicy] = ..., @@ -9280,10 +13039,14 @@ namespace azure.mgmt.cosmosdb.models computed_properties: Optional[list[ComputedProperty]] conflict_resolution_policy: Optional[ConflictResolutionPolicy] create_mode: Optional[Union[str, CreateMode]] + data_masking_policy: Optional[DataMaskingPolicy] default_ttl: Optional[int] full_text_policy: Optional[FullTextPolicy] id: str indexing_policy: Optional[IndexingPolicy] + materialized_view_definition: Optional[MaterializedViewDefinition] + materialized_views: Optional[list[MaterializedViewDetails]] + materialized_views_properties: Optional[MaterializedViewsProperties] partition_key: Optional[ContainerPartitionKey] restore_parameters: Optional[ResourceRestoreParameters] unique_key_policy: Optional[UniqueKeyPolicy] @@ -9298,10 +13061,14 @@ namespace azure.mgmt.cosmosdb.models computed_properties: Optional[list[ComputedProperty]] = ..., conflict_resolution_policy: Optional[ConflictResolutionPolicy] = ..., create_mode: Optional[Union[str, CreateMode]] = ..., + data_masking_policy: Optional[DataMaskingPolicy] = ..., default_ttl: Optional[int] = ..., full_text_policy: Optional[FullTextPolicy] = ..., id: str, indexing_policy: Optional[IndexingPolicy] = ..., + materialized_view_definition: Optional[MaterializedViewDefinition] = ..., + materialized_views: Optional[list[MaterializedViewDetails]] = ..., + materialized_views_properties: Optional[MaterializedViewsProperties] = ..., partition_key: Optional[ContainerPartitionKey] = ..., restore_parameters: Optional[ResourceRestoreParameters] = ..., unique_key_policy: Optional[UniqueKeyPolicy] = ..., @@ -10055,6 +13822,11 @@ namespace azure.mgmt.cosmosdb.models UPDATING = "Updating" + class azure.mgmt.cosmosdb.models.SupportedActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + DISABLE = "Disable" + ENABLE = "Enable" + + class azure.mgmt.cosmosdb.models.SystemData(_Model): created_at: Optional[datetime] created_by: Optional[str] @@ -10322,67 +14094,69 @@ namespace azure.mgmt.cosmosdb.models def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputPolicyResource(_Model): - increment_percent: Optional[int] - is_enabled: Optional[bool] + class azure.mgmt.cosmosdb.models.ThroughputBucketResource(_Model): + id: int + is_default_bucket: Optional[bool] + max_throughput_percentage: int @overload def __init__( self, *, - increment_percent: Optional[int] = ..., - is_enabled: Optional[bool] = ... + id: int, + is_default_bucket: Optional[bool] = ..., + max_throughput_percentage: int ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsGetProperties(_Model): - resource: Optional[ThroughputSettingsGetPropertiesResource] + class azure.mgmt.cosmosdb.models.ThroughputPolicyResource(_Model): + increment_percent: Optional[int] + is_enabled: Optional[bool] @overload def __init__( self, *, - resource: Optional[ThroughputSettingsGetPropertiesResource] = ... + increment_percent: Optional[int] = ..., + is_enabled: Optional[bool] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): - autoscale_settings: AutoscaleSettingsResource - etag: Optional[str] - instant_maximum_throughput: str - minimum_throughput: str - offer_replace_pending: str - rid: Optional[str] - soft_allowed_maximum_throughput: str - throughput: int - ts: Optional[float] + class azure.mgmt.cosmosdb.models.ThroughputPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CUSTOM = "custom" + EQUAL = "equal" + NONE = "none" + + + class azure.mgmt.cosmosdb.models.ThroughputPoolAccountProperties(_Model): + account_instance_id: Optional[str] + account_location: Optional[str] + account_resource_identifier: Optional[str] + provisioning_state: Optional[Union[str, Status]] @overload def __init__( self, *, - autoscale_settings: Optional[AutoscaleSettingsResource] = ..., - throughput: Optional[int] = ... + account_location: Optional[str] = ..., + account_resource_identifier: Optional[str] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults(ProxyResource): + class azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource(ProxyResource): id: str - identity: Optional[ManagedServiceIdentity] - location: Optional[str] name: str - properties: Optional[ThroughputSettingsGetProperties] + properties: Optional[ThroughputPoolAccountProperties] system_data: SystemData - tags: Optional[dict[str, str]] type: str def __getattr__(self, name: str) -> Any: ... @@ -10391,10 +14165,7 @@ namespace azure.mgmt.cosmosdb.models def __init__( self, *, - identity: Optional[ManagedServiceIdentity] = ..., - location: Optional[str] = ..., - properties: Optional[ThroughputSettingsGetProperties] = ..., - tags: Optional[dict[str, str]] = ... + properties: Optional[ThroughputPoolAccountProperties] = ... ) -> None: ... @overload @@ -10407,32 +14178,28 @@ namespace azure.mgmt.cosmosdb.models ) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsResource(_Model): - autoscale_settings: Optional[AutoscaleSettingsResource] - instant_maximum_throughput: Optional[str] - minimum_throughput: Optional[str] - offer_replace_pending: Optional[str] - soft_allowed_maximum_throughput: Optional[str] - throughput: Optional[int] + class azure.mgmt.cosmosdb.models.ThroughputPoolProperties(_Model): + max_throughput: Optional[int] + provisioning_state: Optional[Union[str, Status]] @overload def __init__( self, *, - autoscale_settings: Optional[AutoscaleSettingsResource] = ..., - throughput: Optional[int] = ... + max_throughput: Optional[int] = ..., + provisioning_state: Optional[Union[str, Status]] = ... ) -> None: ... @overload def __init__(self, mapping: Mapping[str, Any]) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters(ARMResourceProperties): + class azure.mgmt.cosmosdb.models.ThroughputPoolResource(TrackedResource): id: str - identity: ManagedServiceIdentity location: str name: str - properties: ThroughputSettingsUpdateProperties + properties: Optional[ThroughputPoolProperties] + system_data: SystemData tags: dict[str, str] type: str @@ -10442,9 +14209,8 @@ namespace azure.mgmt.cosmosdb.models def __init__( self, *, - identity: Optional[ManagedServiceIdentity] = ..., - location: Optional[str] = ..., - properties: ThroughputSettingsUpdateProperties, + location: str, + properties: Optional[ThroughputPoolProperties] = ..., tags: Optional[dict[str, str]] = ... ) -> None: ... @@ -10458,10 +14224,156 @@ namespace azure.mgmt.cosmosdb.models ) -> None: ... - class azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateProperties(_Model): - resource: ThroughputSettingsResource + class azure.mgmt.cosmosdb.models.ThroughputPoolUpdate(_Model): + properties: Optional[ThroughputPoolProperties] - @overload + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ThroughputPoolProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsGetProperties(_Model): + resource: Optional[ThroughputSettingsGetPropertiesResource] + + @overload + def __init__( + self, + *, + resource: Optional[ThroughputSettingsGetPropertiesResource] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): + autoscale_settings: AutoscaleSettingsResource + etag: Optional[str] + instant_maximum_throughput: str + minimum_throughput: str + offer_replace_pending: str + rid: Optional[str] + soft_allowed_maximum_throughput: str + throughput: int + throughput_buckets: list[ThroughputBucketResource] + ts: Optional[float] + + @overload + def __init__( + self, + *, + autoscale_settings: Optional[AutoscaleSettingsResource] = ..., + throughput: Optional[int] = ..., + throughput_buckets: Optional[list[ThroughputBucketResource]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults(ProxyResource): + id: str + identity: Optional[ManagedServiceIdentity] + location: Optional[str] + name: str + properties: Optional[ThroughputSettingsGetProperties] + system_data: SystemData + tags: Optional[dict[str, str]] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: Optional[ThroughputSettingsGetProperties] = ..., + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsResource(_Model): + autoscale_settings: Optional[AutoscaleSettingsResource] + instant_maximum_throughput: Optional[str] + minimum_throughput: Optional[str] + offer_replace_pending: Optional[str] + soft_allowed_maximum_throughput: Optional[str] + throughput: Optional[int] + throughput_buckets: Optional[list[ThroughputBucketResource]] + + @overload + def __init__( + self, + *, + autoscale_settings: Optional[AutoscaleSettingsResource] = ..., + throughput: Optional[int] = ..., + throughput_buckets: Optional[list[ThroughputBucketResource]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters(ARMResourceProperties): + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: ThroughputSettingsUpdateProperties + tags: dict[str, str] + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + identity: Optional[ManagedServiceIdentity] = ..., + location: Optional[str] = ..., + properties: ThroughputSettingsUpdateProperties, + tags: Optional[dict[str, str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateProperties(_Model): + resource: ThroughputSettingsResource + + @overload def __init__( self, *, @@ -10742,6 +14654,39 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[CommandOutput]: ... + @overload + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommandPublicResource]: ... + + @overload + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: CommandAsyncPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommandPublicResource]: ... + + @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[CommandPublicResource]: ... + @distributed_trace def begin_start( self, @@ -10791,6 +14736,35 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> ClusterResource: ... + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'backup_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get_backup( + self, + resource_group_name: str, + cluster_name: str, + backup_id: str, + **kwargs: Any + ) -> BackupResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'command_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get_command_async( + self, + resource_group_name: str, + cluster_name: str, + command_id: str, + **kwargs: Any + ) -> CommandPublicResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_backups( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> ItemPaged[BackupResource]: ... + @distributed_trace def list_by_resource_group( self, @@ -10801,6 +14775,15 @@ namespace azure.mgmt.cosmosdb.operations @distributed_trace def list_by_subscription(self, **kwargs: Any) -> ItemPaged[ClusterResource]: ... + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_command( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> ItemPaged[CommandPublicResource]: ... + @distributed_trace def status( self, @@ -11072,6 +15055,45 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[CassandraTableGetResults]: ... + @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: CassandraViewCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CassandraViewGetResults]: ... + + @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: CassandraViewCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CassandraViewGetResults]: ... + + @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[CassandraViewGetResults]: ... + @distributed_trace def begin_delete_cassandra_keyspace( self, @@ -11109,6 +15131,16 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[None]: ... + @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]: ... + @distributed_trace def begin_migrate_cassandra_keyspace_to_autoscale( self, @@ -11147,6 +15179,26 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[ThroughputSettingsGetResults]: ... + @distributed_trace + def begin_migrate_cassandra_view_to_autoscale( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @distributed_trace + def begin_migrate_cassandra_view_to_manual_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + @overload def begin_update_cassandra_keyspace_throughput( self, @@ -11222,23 +15274,62 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[ThroughputSettingsGetResults]: ... - @distributed_trace - def get_cassandra_keyspace( + @overload + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, + view_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> CassandraKeyspaceGetResults: ... + ) -> LROPoller[ThroughputSettingsGetResults]: ... - @distributed_trace - def get_cassandra_keyspace_throughput( + @overload + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, keyspace_name: str, + view_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ThroughputSettingsGetResults: ... + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @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[ThroughputSettingsGetResults]: ... + + @distributed_trace + def get_cassandra_keyspace( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + **kwargs: Any + ) -> CassandraKeyspaceGetResults: ... + + @distributed_trace + def get_cassandra_keyspace_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... @distributed_trace def get_cassandra_role_assignment( @@ -11278,6 +15369,26 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> ThroughputSettingsGetResults: ... + @distributed_trace + def get_cassandra_view( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> CassandraViewGetResults: ... + + @distributed_trace + def get_cassandra_view_throughput( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + view_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + @distributed_trace def list_cassandra_keyspaces( self, @@ -11311,6 +15422,77 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> ItemPaged[CassandraTableGetResults]: ... + @distributed_trace + def list_cassandra_views( + self, + resource_group_name: str, + account_name: str, + keyspace_name: str, + **kwargs: Any + ) -> ItemPaged[CassandraViewGetResults]: ... + + + class azure.mgmt.cosmosdb.operations.ChaosFaultOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ChaosFaultResource]: ... + + @overload + def begin_enable_disable( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: ChaosFaultResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ChaosFaultResource]: ... + + @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[ChaosFaultResource]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + **kwargs: Any + ) -> ChaosFaultResource: ... + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> ItemPaged[ChaosFaultResource]: ... + class azure.mgmt.cosmosdb.operations.CollectionOperations: @@ -11432,6 +15614,214 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[Metric]: ... + class azure.mgmt.cosmosdb.operations.CopyJobsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def cancel( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def complete( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CopyJobGetResults, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CopyJobGetResults: ... + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CopyJobGetResults, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CopyJobGetResults: ... + + @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 + ) -> CopyJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_database_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> ItemPaged[CopyJobGetResults]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def pause( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def resume( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> CopyJobGetResults: ... + + + class azure.mgmt.cosmosdb.operations.DataTransferJobsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def cancel( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def complete( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: CreateJobRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @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 + ) -> DataTransferJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_database_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> ItemPaged[DataTransferJobGetResults]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def pause( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'job_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def resume( + self, + resource_group_name: str, + account_name: str, + job_name: str, + **kwargs: Any + ) -> DataTransferJobGetResults: ... + + class azure.mgmt.cosmosdb.operations.DatabaseAccountRegionOperations: def __init__( @@ -11792,7 +16182,7 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[Usage]: ... - class azure.mgmt.cosmosdb.operations.FleetOperations: + class azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations: def __init__( self, @@ -11805,6 +16195,7 @@ namespace azure.mgmt.cosmosdb.operations self, resource_group_name: str, fleet_name: str, + fleet_analytics_name: str, **kwargs: Any ) -> LROPoller[None]: ... @@ -11813,47 +16204,117 @@ namespace azure.mgmt.cosmosdb.operations self, resource_group_name: str, fleet_name: str, - body: FleetResource, + fleet_analytics_name: str, + body: FleetAnalyticsResource, *, content_type: str = "application/json", **kwargs: Any - ) -> FleetResource: ... + ) -> FleetAnalyticsResource: ... @overload def create( self, resource_group_name: str, fleet_name: str, - body: FleetResource, + fleet_analytics_name: str, + body: FleetAnalyticsResource, *, content_type: str = "application/json", **kwargs: Any - ) -> FleetResource: ... + ) -> FleetAnalyticsResource: ... @overload def create( self, resource_group_name: str, fleet_name: str, + fleet_analytics_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> FleetResource: ... + ) -> FleetAnalyticsResource: ... @distributed_trace def get( self, resource_group_name: str, fleet_name: str, + fleet_analytics_name: str, **kwargs: Any - ) -> FleetResource: ... - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged[FleetResource]: ... + ) -> FleetAnalyticsResource: ... @distributed_trace - def list_by_resource_group( + def list( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> ItemPaged[FleetAnalyticsResource]: ... + + + class azure.mgmt.cosmosdb.operations.FleetOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + body: FleetResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetResource: ... + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + body: FleetResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetResource: ... + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FleetResource: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + fleet_name: str, + **kwargs: Any + ) -> FleetResource: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[FleetResource]: ... + + @distributed_trace + def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -12077,6 +16538,185 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[FleetspaceResource]: ... + class azure.mgmt.cosmosdb.operations.GarnetClustersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name']}, api_versions_list=['2026-04-01-preview']) + def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GarnetClusterResource]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'cluster_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> GarnetClusterResource: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[GarnetClusterResource]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_subscription(self, **kwargs: Any) -> ItemPaged[GarnetClusterResource]: ... + + + class azure.mgmt.cosmosdb.operations.GraphResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GraphResourceGetResults]: ... + + @overload + def begin_create_update_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + create_update_graph_parameters: GraphResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[GraphResourceGetResults]: ... + + @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[GraphResourceGetResults]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'graph_name']}, api_versions_list=['2026-04-01-preview']) + def begin_delete_graph_resource( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'graph_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get_graph( + self, + resource_group_name: str, + account_name: str, + graph_name: str, + **kwargs: Any + ) -> GraphResourceGetResults: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_graphs( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> ItemPaged[GraphResourceGetResults]: ... + + class azure.mgmt.cosmosdb.operations.GremlinResourcesOperations: def __init__( @@ -12722,6 +17362,45 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[None]: ... + @overload + def begin_list_mongo_db_collection_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_list_mongo_db_collection_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_list_mongo_db_collection_partition_merge( + 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[PhysicalPartitionStorageInfoCollection]: ... + @distributed_trace def begin_migrate_mongo_db_collection_to_autoscale( self, @@ -12761,72 +17440,258 @@ namespace azure.mgmt.cosmosdb.operations ) -> LROPoller[ThroughputSettingsGetResults]: ... @overload - def begin_retrieve_continuous_backup_information( + def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[BackupInformation]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_retrieve_continuous_backup_information( + def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[BackupInformation]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_retrieve_continuous_backup_information( + def begin_mongo_db_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - location: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[BackupInformation]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_mongo_db_collection_throughput( + def begin_mongo_db_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_mongo_db_collection_throughput( + def begin_mongo_db_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_mongo_db_collection_throughput( + def begin_mongo_db_container_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_mongo_db_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_mongo_db_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[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_mongo_db_database_redistribute_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_redistribute_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_redistribute_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_mongo_db_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_retrieve_continuous_backup_information( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[BackupInformation]: ... + + @overload + def begin_retrieve_continuous_backup_information( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[BackupInformation]: ... + + @overload + def begin_retrieve_continuous_backup_information( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[BackupInformation]: ... + + @overload + def begin_update_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_mongo_db_collection_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_mongo_db_collection_throughput( self, resource_group_name: str, account_name: str, @@ -13097,6 +17962,44 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[MongoMIRoleDefinitionResource]: ... + class azure.mgmt.cosmosdb.operations.NetworkSecurityPerimeterConfigurationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'network_security_perimeter_configuration_name']}, api_versions_list=['2026-04-01-preview']) + def begin_reconcile( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'network_security_perimeter_configuration_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_name: str, + **kwargs: Any + ) -> NetworkSecurityPerimeterConfiguration: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> ItemPaged[NetworkSecurityPerimeterConfiguration]: ... + + class azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations: def __init__( @@ -13721,7 +18624,7 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[ServiceResource]: ... - class azure.mgmt.cosmosdb.operations.SqlResourcesOperations: + class azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations: def __init__( self, @@ -13729,79 +18632,255 @@ namespace azure.mgmt.cosmosdb.operations **kwargs ) -> None: ... - @overload - def begin_create_update_client_encryption_key( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_purge( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, *, - content_type: str = "application/json", + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., **kwargs: Any - ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + ) -> LROPoller[None]: ... - @overload - def begin_create_update_client_encryption_key( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_restore( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, *, - content_type: str = "application/json", + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., **kwargs: Any - ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + ) -> LROPoller[None]: ... - @overload - def begin_create_update_client_encryption_key( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( self, resource_group_name: str, + location: str, account_name: str, - database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], - *, - content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + ) -> SoftDeletedDatabaseAccountGetResult: ... - @overload - def begin_create_update_sql_container( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'location', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_location( + self, + location: str, + **kwargs: Any + ) -> SoftDeletedDatabaseAccountsListResult: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'api_version', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list_by_resource_group_and_location( self, resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, - *, - content_type: str = "application/json", + location: str, **kwargs: Any - ) -> LROPoller[SqlContainerGetResults]: ... + ) -> SoftDeletedDatabaseAccountsListResult: ... - @overload - def begin_create_update_sql_container( + + class azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_purge( self, resource_group_name: str, + location: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, *, - content_type: str = "application/json", + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., **kwargs: Any - ) -> LROPoller[SqlContainerGetResults]: ... + ) -> LROPoller[None]: ... - @overload - def begin_create_update_sql_container( + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_restore( self, resource_group_name: str, + location: str, account_name: str, database_name: str, container_name: str, - create_update_sql_container_parameters: IO[bytes], + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'container_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> SoftDeletedSqlContainerGetResult: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SoftDeletedSqlContainersListResult: ... + + + class azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'api_version', 'soft_delete_action_kind']}, api_versions_list=['2026-04-01-preview']) + def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, SoftDeleteActionKind]] = ..., + **kwargs: Any + ) -> LROPoller[None]: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'database_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SoftDeletedSqlDatabaseGetResult: ... + + @distributed_trace + @api_version_validation(method_added_on='2026-04-01-preview', params_added_on={'2026-04-01-preview': ['api_version', 'subscription_id', 'resource_group_name', 'location', 'account_name', 'accept']}, api_versions_list=['2026-04-01-preview']) + def list( + self, + resource_group_name: str, + location: str, + account_name: str, + **kwargs: Any + ) -> SoftDeletedSqlDatabasesListResult: ... + + + class azure.mgmt.cosmosdb.operations.SqlResourcesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: ClientEncryptionKeyCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + def begin_create_update_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ClientEncryptionKeyGetResults]: ... + + @overload + def begin_create_update_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SqlContainerGetResults]: ... + + @overload + def begin_create_update_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + create_update_sql_container_parameters: SqlContainerCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SqlContainerGetResults]: ... + + @overload + def begin_create_update_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + create_update_sql_container_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -14111,6 +19190,45 @@ namespace azure.mgmt.cosmosdb.operations **kwargs: Any ) -> LROPoller[None]: ... + @overload + def begin_list_sql_container_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @overload + def begin_list_sql_container_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... + + @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[PhysicalPartitionStorageInfoCollection]: ... + @distributed_trace def begin_migrate_sql_container_to_autoscale( self, @@ -14189,155 +19307,341 @@ namespace azure.mgmt.cosmosdb.operations ) -> LROPoller[BackupInformation]: ... @overload - def begin_update_sql_container_throughput( + def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_sql_container_throughput( + def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + redistribute_throughput_parameters: RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_sql_container_throughput( + def begin_sql_container_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - update_throughput_parameters: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_sql_database_throughput( + def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + container_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_sql_database_throughput( + def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: ThroughputSettingsUpdateParameters, + container_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... @overload - def begin_update_sql_database_throughput( + def begin_sql_container_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[ThroughputSettingsGetResults]: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def get_client_encryption_key( + @overload + def begin_sql_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ClientEncryptionKeyGetResults: ... + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace - def get_sql_container( + @overload + def begin_sql_database_partition_merge( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, + merge_parameters: MergeParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlContainerGetResults: ... + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace - def get_sql_container_throughput( + @overload + def begin_sql_database_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 - ) -> ThroughputSettingsGetResults: ... + ) -> LROPoller[PhysicalPartitionStorageInfoCollection]: ... - @distributed_trace - def get_sql_database( + @overload + def begin_sql_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlDatabaseGetResults: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def get_sql_database_throughput( + @overload + def begin_sql_database_redistribute_throughput( self, resource_group_name: str, account_name: str, database_name: str, + redistribute_throughput_parameters: RedistributeThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> ThroughputSettingsGetResults: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def get_sql_role_assignment( + @overload + def begin_sql_database_redistribute_throughput( self, - role_assignment_id: str, resource_group_name: str, account_name: str, + database_name: str, + redistribute_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlRoleAssignmentGetResults: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def get_sql_role_definition( + @overload + def begin_sql_database_retrieve_throughput_distribution( self, - role_definition_id: str, resource_group_name: str, account_name: str, + database_name: str, + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> SqlRoleDefinitionGetResults: ... + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... - @distributed_trace - def get_sql_stored_procedure( + @overload + def begin_sql_database_retrieve_throughput_distribution( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - **kwargs: Any + retrieve_throughput_parameters: RetrieveThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_sql_database_retrieve_throughput_distribution( + self, + resource_group_name: str, + account_name: str, + database_name: str, + retrieve_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[PhysicalPartitionThroughputInfoResult]: ... + + @overload + def begin_update_sql_container_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_sql_container_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @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[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @overload + def begin_update_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputSettingsGetResults]: ... + + @distributed_trace + def get_client_encryption_key( + self, + resource_group_name: str, + account_name: str, + database_name: str, + client_encryption_key_name: str, + **kwargs: Any + ) -> ClientEncryptionKeyGetResults: ... + + @distributed_trace + def get_sql_container( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> SqlContainerGetResults: ... + + @distributed_trace + def get_sql_container_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace + def get_sql_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> SqlDatabaseGetResults: ... + + @distributed_trace + def get_sql_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + **kwargs: Any + ) -> ThroughputSettingsGetResults: ... + + @distributed_trace + def get_sql_role_assignment( + self, + role_assignment_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> SqlRoleAssignmentGetResults: ... + + @distributed_trace + def get_sql_role_definition( + self, + role_definition_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> SqlRoleDefinitionGetResults: ... + + @distributed_trace + def get_sql_stored_procedure( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any ) -> SqlStoredProcedureGetResults: ... @distributed_trace @@ -14729,96 +20033,301 @@ namespace azure.mgmt.cosmosdb.operations ) -> ItemPaged[TableGetResults]: ... -namespace azure.mgmt.cosmosdb.types - - class azure.mgmt.cosmosdb.types.ARMProxyResource(TypedDict, total=False): - key "id": str - key "name": str - key "type": str - id: str - name: str - type: str + class azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations: + def __init__( + self, + *args, + **kwargs + ) -> None: ... - class azure.mgmt.cosmosdb.types.ARMResourceProperties(TypedDict, total=False): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - tags: dict[str, str] - type: str + @overload + def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: ThroughputPoolAccountResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolAccountResource]: ... + @overload + def begin_create( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: ThroughputPoolAccountResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolAccountResource]: ... - class azure.mgmt.cosmosdb.types.AccountKeyMetadata(TypedDict, total=False): - key "generationTime": str - generation_time: str + @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[ThroughputPoolAccountResource]: ... + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... - class azure.mgmt.cosmosdb.types.AnalyticalStorageConfiguration(TypedDict, total=False): - key "schemaType": Union[str, AnalyticalStorageSchemaType] - schema_type: Union[str, AnalyticalStorageSchemaType] + @distributed_trace + def get( + self, + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_name: str, + **kwargs: Any + ) -> ThroughputPoolAccountResource: ... - class azure.mgmt.cosmosdb.types.ApiProperties(TypedDict, total=False): - key "serverVersion": Union[str, ServerVersion] - server_version: Union[str, ServerVersion] + class azure.mgmt.cosmosdb.operations.ThroughputPoolAccountsOperations: + def __init__( + self, + *args, + **kwargs + ) -> None: ... - class azure.mgmt.cosmosdb.types.AuthenticationMethodLdapProperties(TypedDict, total=False): - key "connectionTimeoutInMs": int - key "searchBaseDistinguishedName": str - key "searchFilterTemplate": str - key "serverHostname": str - key "serverPort": int - key "serviceUserDistinguishedName": str - key "serviceUserPassword": str - connection_timeout_in_ms: int - search_base_distinguished_name: str - search_filter_template: str - serverCertificates: list[Certificate] - server_certificates: list[Certificate] - server_hostname: str - server_port: int - service_user_distinguished_name: str - service_user_password: str + @distributed_trace + def list( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> ItemPaged[ThroughputPoolAccountResource]: ... - class azure.mgmt.cosmosdb.types.AutoUpgradePolicyResource(TypedDict, total=False): - key "throughputPolicy": ForwardRef('ThroughputPolicyResource', module='types') - throughput_policy: ThroughputPolicyResource + class azure.mgmt.cosmosdb.operations.ThroughputPoolOperations: + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: ThroughputPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolResource]: ... + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: ThroughputPoolResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolResource]: ... + + @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[ThroughputPoolResource]: ... + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolResource]: ... + + @overload + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[ThroughputPoolResource]: ... + + @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[ThroughputPoolResource]: ... + + @distributed_trace + def get( + self, + resource_group_name: str, + throughput_pool_name: str, + **kwargs: Any + ) -> ThroughputPoolResource: ... + + + class azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[ThroughputPoolResource]: ... + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> ItemPaged[ThroughputPoolResource]: ... + + +namespace azure.mgmt.cosmosdb.types + + class azure.mgmt.cosmosdb.types.ARMProxyResource(TypedDict, total=False): + key "id": str + key "name": str + key "type": str + id: str + name: str + type: str + + + class azure.mgmt.cosmosdb.types.ARMResourceProperties(TypedDict, total=False): + key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": str + key "name": str + key "type": str + id: str + identity: ManagedServiceIdentity + location: str + name: str + tags: dict[str, str] + type: str + + + class azure.mgmt.cosmosdb.types.AccountKeyMetadata(TypedDict, total=False): + key "approximateLastUsageTime": str + key "generationTime": str + approximateLastUsageTime: str + generationTime: str + + + class azure.mgmt.cosmosdb.types.AnalyticalStorageConfiguration(TypedDict, total=False): + key "schemaType": Union[str, AnalyticalStorageSchemaType] + schemaType: Union[str, AnalyticalStorageSchemaType] + + + class azure.mgmt.cosmosdb.types.ApiProperties(TypedDict, total=False): + key "serverVersion": Union[str, ServerVersion] + serverVersion: Union[str, ServerVersion] + + + class azure.mgmt.cosmosdb.types.AuthenticationMethodLdapProperties(TypedDict, total=False): + key "connectionTimeoutInMs": int + key "searchBaseDistinguishedName": str + key "searchFilterTemplate": str + key "serverHostname": str + key "serverPort": int + key "serviceUserDistinguishedName": str + key "serviceUserPassword": str + connectionTimeoutInMs: int + searchBaseDistinguishedName: str + searchFilterTemplate: str + serverCertificates: list[Certificate] + serverHostname: str + serverPort: int + serviceUserDistinguishedName: str + serviceUserPassword: str - class azure.mgmt.cosmosdb.types.AutoscaleSettings(TypedDict, total=False): - key "maxThroughput": int - max_throughput: int + + class azure.mgmt.cosmosdb.types.AutoUpgradePolicyResource(TypedDict, total=False): + key "throughputPolicy": ForwardRef('ThroughputPolicyResource', module='types') + throughputPolicy: ThroughputPolicyResource + + + class azure.mgmt.cosmosdb.types.AutoscaleSettings(TypedDict, total=False): + key "maxThroughput": int + maxThroughput: int class azure.mgmt.cosmosdb.types.AutoscaleSettingsResource(TypedDict, total=False): key "autoUpgradePolicy": ForwardRef('AutoUpgradePolicyResource', module='types') key "maxThroughput": Required[int] key "targetMaxThroughput": int - auto_upgrade_policy: AutoUpgradePolicyResource - max_throughput: int - target_max_throughput: int + autoUpgradePolicy: AutoUpgradePolicyResource + maxThroughput: int + targetMaxThroughput: int - class azure.mgmt.cosmosdb.types.BackupInformation(TypedDict, total=False): - key "continuousBackupInformation": ForwardRef('ContinuousBackupInformation', module='types') - continuous_backup_information: ContinuousBackupInformation + class azure.mgmt.cosmosdb.types.AzureBlobContainer(TypedDict, total=False): + key "containerName": Required[str] + containerName: str + + + class azure.mgmt.cosmosdb.types.AzureBlobDataTransferDataSourceSink(TypedDict, total=False): + key "component": Required[Literal[DataTransferComponent.AZURE_BLOB_STORAGE]] + key "containerName": Required[str] + key "endpointUrl": str + component: Literal[DataTransferComponent.AZURE_BLOB_STORAGE] + containerName: str + endpointUrl: str + + + class azure.mgmt.cosmosdb.types.AzureBlobSourceSinkDetails(TypedDict, total=False): + key "endpointUrl": Required[str] + endpointUrl: str class azure.mgmt.cosmosdb.types.BackupPolicyMigrationState(TypedDict, total=False): key "startTime": str key "status": Union[str, BackupPolicyMigrationStatus] key "targetType": Union[str, BackupPolicyType] - start_time: str + startTime: str status: Union[str, BackupPolicyMigrationStatus] - target_type: Union[str, BackupPolicyType] + targetType: Union[str, BackupPolicyType] class azure.mgmt.cosmosdb.types.BackupPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -14830,77 +20339,48 @@ namespace azure.mgmt.cosmosdb.types key "cronExpression": str key "retentionInHours": int key "scheduleName": str - cron_expression: str - retention_in_hours: int - schedule_name: str + cronExpression: str + retentionInHours: int + scheduleName: str - class azure.mgmt.cosmosdb.types.Capability(TypedDict, total=False): - key "name": str - name: str + class azure.mgmt.cosmosdb.types.BaseCopyJobTask(TypedDict, total=False): + key "processedCount": int + key "totalCount": int + processedCount: int + totalCount: int - class azure.mgmt.cosmosdb.types.Capacity(TypedDict, total=False): - key "totalThroughputLimit": int - total_throughput_limit: int - - - class azure.mgmt.cosmosdb.types.CassandraClusterDataCenterNodeItem(TypedDict, total=False): - key "address": str - key "cassandraProcessStatus": str - key "cpuUsage": float - key "diskFreeKB": int - key "diskUsedKB": int - key "hostID": str - key "isLatestModel": bool - key "load": str - key "memoryBuffersAndCachedKB": int - key "memoryFreeKB": int - key "memoryTotalKB": int - key "memoryUsedKB": int - key "rack": str - key "size": int - key "state": Union[str, NodeState] - key "status": str - key "timestamp": str - address: str - cassandra_process_status: str - cpu_usage: float - disk_free_kb: int - disk_used_kb: int - host_id: str - is_latest_model: bool - load: str - memory_buffers_and_cached_kb: int - memory_free_kb: int - memory_total_kb: int - memory_used_kb: int - rack: str - size: int - state: Union[str, NodeState] - status: str - timestamp: str - tokens: list[str] + class azure.mgmt.cosmosdb.types.BlobToCassandraRUCopyJobProperties(TypedDict, total=False): + key "destinationDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "jobType": Required[Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU]] + key "sourceDetails": Required[AzureBlobSourceSinkDetails] + key "tasks": Required[list[BlobToCassandraRUCopyJobTask]] + destinationDetails: CosmosDBSourceSinkDetails + jobType: Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU] + sourceDetails: AzureBlobSourceSinkDetails + tasks: list[BlobToCassandraRUCopyJobTask] - class azure.mgmt.cosmosdb.types.CassandraClusterPublicStatus(TypedDict, total=False): - key "eTag": str - key "reaperStatus": ForwardRef('ManagedCassandraReaperStatus', module='types') - connectionErrors: list[ConnectionError] - connection_errors: list[ConnectionError] - dataCenters: list[CassandraClusterPublicStatusDataCentersItem] - data_centers: list[CassandraClusterPublicStatusDataCentersItem] - e_tag: str - errors: list[CassandraError] - reaper_status: ManagedCassandraReaperStatus + class azure.mgmt.cosmosdb.types.BlobToCassandraRUCopyJobTask(BaseCopyJobTask): + key "destination": Required[CosmosDBCassandraTable] + key "processedCount": int + key "source": Required[AzureBlobContainer] + key "totalCount": int + destination: CosmosDBCassandraTable + processedCount: int + source: AzureBlobContainer + totalCount: int - class azure.mgmt.cosmosdb.types.CassandraClusterPublicStatusDataCentersItem(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.Capability(TypedDict, total=False): key "name": str name: str - nodes: list[CassandraClusterDataCenterNodeItem] - seedNodes: list[str] - seed_nodes: list[str] + + + class azure.mgmt.cosmosdb.types.Capacity(TypedDict, total=False): + key "totalThroughputLimit": int + totalThroughputLimit: int class azure.mgmt.cosmosdb.types.CassandraError(TypedDict, total=False): @@ -14908,7 +20388,7 @@ namespace azure.mgmt.cosmosdb.types key "code": str key "message": str key "target": str - additional_error_info: str + additionalErrorInfo: str code: str message: str target: str @@ -14937,46 +20417,6 @@ namespace azure.mgmt.cosmosdb.types resource: CassandraKeyspaceResource - class azure.mgmt.cosmosdb.types.CassandraKeyspaceGetProperties(TypedDict, total=False): - key "options": ForwardRef('CassandraKeyspaceGetPropertiesOptions', module='types') - key "resource": ForwardRef('CassandraKeyspaceGetPropertiesResource', module='types') - options: CassandraKeyspaceGetPropertiesOptions - resource: CassandraKeyspaceGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.CassandraKeyspaceGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.CassandraKeyspaceGetPropertiesResource(CassandraKeyspaceResource): - key "id": Required[str] - etag: str - id: str - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.CassandraKeyspaceGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('CassandraKeyspaceGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: CassandraKeyspaceGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.CassandraKeyspaceResource(TypedDict, total=False): key "id": Required[str] id: str @@ -14987,6 +20427,50 @@ namespace azure.mgmt.cosmosdb.types name: str + class azure.mgmt.cosmosdb.types.CassandraRUToBlobCopyJobProperties(TypedDict, total=False): + key "destinationDetails": Required[AzureBlobSourceSinkDetails] + key "jobType": Required[Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE]] + key "sourceDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "tasks": Required[list[CassandraRUToBlobCopyJobTask]] + destinationDetails: AzureBlobSourceSinkDetails + jobType: Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE] + sourceDetails: CosmosDBSourceSinkDetails + tasks: list[CassandraRUToBlobCopyJobTask] + + + class azure.mgmt.cosmosdb.types.CassandraRUToBlobCopyJobTask(BaseCopyJobTask): + key "destination": Required[AzureBlobContainer] + key "processedCount": int + key "source": Required[CosmosDBCassandraTable] + key "totalCount": int + destination: AzureBlobContainer + processedCount: int + source: CosmosDBCassandraTable + totalCount: int + + + class azure.mgmt.cosmosdb.types.CassandraRUToCassandraRUCopyJobProperties(TypedDict, total=False): + key "destinationDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "jobType": Required[Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU]] + key "sourceDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "tasks": Required[list[CassandraRUToCassandraRUCopyJobTask]] + destinationDetails: CosmosDBSourceSinkDetails + jobType: Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU] + sourceDetails: CosmosDBSourceSinkDetails + tasks: list[CassandraRUToCassandraRUCopyJobTask] + + + class azure.mgmt.cosmosdb.types.CassandraRUToCassandraRUCopyJobTask(BaseCopyJobTask): + key "destination": Required[CosmosDBCassandraTable] + key "processedCount": int + key "source": Required[CosmosDBCassandraTable] + key "totalCount": int + destination: CosmosDBCassandraTable + processedCount: int + source: CosmosDBCassandraTable + totalCount: int + + class azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource(ProxyResource): key "id": str key "name": str @@ -14996,7 +20480,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: CassandraRoleAssignmentResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -15005,9 +20489,9 @@ namespace azure.mgmt.cosmosdb.types key "provisioningState": str key "roleDefinitionId": str key "scope": str - principal_id: str - provisioning_state: str - role_definition_id: str + principalId: str + provisioningState: str + roleDefinitionId: str scope: str @@ -15020,7 +20504,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: CassandraRoleDefinitionResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -15029,19 +20513,16 @@ namespace azure.mgmt.cosmosdb.types key "roleName": str key "type": Union[str, RoleDefinitionType] assignableScopes: list[str] - assignable_scopes: list[str] id: str permissions: list[Permission] - role_name: str + roleName: str type: Union[str, RoleDefinitionType] class azure.mgmt.cosmosdb.types.CassandraSchema(TypedDict, total=False): clusterKeys: list[ClusterKey] - cluster_keys: list[ClusterKey] columns: list[Column] partitionKeys: list[CassandraPartitionKey] - partition_keys: list[CassandraPartitionKey] class azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters(ARMResourceProperties): @@ -15067,61 +20548,45 @@ namespace azure.mgmt.cosmosdb.types resource: CassandraTableResource - class azure.mgmt.cosmosdb.types.CassandraTableGetProperties(TypedDict, total=False): - key "options": ForwardRef('CassandraTableGetPropertiesOptions', module='types') - key "resource": ForwardRef('CassandraTableGetPropertiesResource', module='types') - options: CassandraTableGetPropertiesOptions - resource: CassandraTableGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.CassandraTableGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.CassandraTableGetPropertiesResource(CassandraTableResource): + class azure.mgmt.cosmosdb.types.CassandraTableResource(TypedDict, total=False): key "analyticalStorageTtl": int key "defaultTtl": int key "id": Required[str] key "schema": ForwardRef('CassandraSchema', module='types') - analytical_storage_ttl: int - default_ttl: int - etag: str + analyticalStorageTtl: int + defaultTtl: int id: str - rid: str schema: CassandraSchema - ts: float - class azure.mgmt.cosmosdb.types.CassandraTableGetResults(ProxyResource): + class azure.mgmt.cosmosdb.types.CassandraViewCreateUpdateParameters(ARMResourceProperties): key "id": str key "identity": ForwardRef('ManagedServiceIdentity', module='types') key "location": str key "name": str - key "properties": ForwardRef('CassandraTableGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') + key "properties": Required[CassandraViewCreateUpdateProperties] key "type": str id: str identity: ManagedServiceIdentity location: str name: str - properties: CassandraTableGetProperties - system_data: SystemData + properties: CassandraViewCreateUpdateProperties tags: dict[str, str] type: str - class azure.mgmt.cosmosdb.types.CassandraTableResource(TypedDict, total=False): - key "analyticalStorageTtl": int - key "defaultTtl": int + class azure.mgmt.cosmosdb.types.CassandraViewCreateUpdateProperties(TypedDict, total=False): + key "options": ForwardRef('CreateUpdateOptions', module='types') + key "resource": Required[CassandraViewResource] + options: CreateUpdateOptions + resource: CassandraViewResource + + + class azure.mgmt.cosmosdb.types.CassandraViewResource(TypedDict, total=False): key "id": Required[str] - key "schema": ForwardRef('CassandraSchema', module='types') - analytical_storage_ttl: int - default_ttl: int + key "viewDefinition": Required[str] id: str - schema: CassandraSchema + viewDefinition: str class azure.mgmt.cosmosdb.types.Certificate(TypedDict, total=False): @@ -15129,14 +20594,40 @@ namespace azure.mgmt.cosmosdb.types pem: str + class azure.mgmt.cosmosdb.types.ChaosFaultProperties(TypedDict, total=False): + key "action": Union[str, SupportedActions] + key "containerName": str + key "databaseName": str + key "provisioningState": str + key "region": str + action: Union[str, SupportedActions] + containerName: str + databaseName: str + provisioningState: str + region: str + + + class azure.mgmt.cosmosdb.types.ChaosFaultResource(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ChaosFaultProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ChaosFaultProperties + systemData: SystemData + type: str + + class azure.mgmt.cosmosdb.types.ClientEncryptionIncludedPath(TypedDict, total=False): key "clientEncryptionKeyId": Required[str] key "encryptionAlgorithm": Required[str] key "encryptionType": Required[str] key "path": Required[str] - client_encryption_key_id: str - encryption_algorithm: str - encryption_type: str + clientEncryptionKeyId: str + encryptionAlgorithm: str + encryptionType: str path: str @@ -15150,66 +20641,29 @@ namespace azure.mgmt.cosmosdb.types resource: ClientEncryptionKeyResource - class azure.mgmt.cosmosdb.types.ClientEncryptionKeyGetProperties(TypedDict, total=False): - key "resource": ForwardRef('ClientEncryptionKeyGetPropertiesResource', module='types') - resource: ClientEncryptionKeyGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): - key "encryptionAlgorithm": str - key "id": str - key "keyWrapMetadata": ForwardRef('KeyWrapMetadata', module='types') - key "wrappedDataEncryptionKey": str - encryption_algorithm: str - etag: str - id: str - key_wrap_metadata: KeyWrapMetadata - rid: str - ts: float - wrapped_data_encryption_key: str - - - class azure.mgmt.cosmosdb.types.ClientEncryptionKeyGetResults(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('ClientEncryptionKeyGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: ClientEncryptionKeyGetProperties - system_data: SystemData - type: str - - class azure.mgmt.cosmosdb.types.ClientEncryptionKeyResource(TypedDict, total=False): key "encryptionAlgorithm": str key "id": str key "keyWrapMetadata": ForwardRef('KeyWrapMetadata', module='types') key "wrappedDataEncryptionKey": str - encryption_algorithm: str + encryptionAlgorithm: str id: str - key_wrap_metadata: KeyWrapMetadata - wrapped_data_encryption_key: str + keyWrapMetadata: KeyWrapMetadata + wrappedDataEncryptionKey: str class azure.mgmt.cosmosdb.types.ClientEncryptionPolicy(TypedDict, total=False): key "includedPaths": Required[list[ClientEncryptionIncludedPath]] key "policyFormatVersion": Required[int] - included_paths: list[ClientEncryptionIncludedPath] - policy_format_version: int - - - class azure.mgmt.cosmosdb.types.CloudError(TypedDict, total=False): - key "error": ForwardRef('ErrorResponseAutoGenerated', module='types') - error: ErrorResponseAutoGenerated + includedPaths: list[ClientEncryptionIncludedPath] + policyFormatVersion: int class azure.mgmt.cosmosdb.types.ClusterKey(TypedDict, total=False): key "name": str key "orderBy": str name: str - order_by: str + orderBy: str class azure.mgmt.cosmosdb.types.ClusterResource(ProxyResource): @@ -15225,7 +20679,7 @@ namespace azure.mgmt.cosmosdb.types location: str name: str properties: ClusterResourceProperties - system_data: SystemData + systemData: SystemData tags: dict[str, str] type: str @@ -15237,6 +20691,7 @@ namespace azure.mgmt.cosmosdb.types key "cassandraAuditLoggingEnabled": bool key "cassandraVersion": str key "clusterNameOverride": str + key "clusterType": Union[str, ClusterType] key "deallocated": bool key "delegatedManagementSubnetId": str key "hoursBetweenBackups": int @@ -15248,38 +20703,32 @@ namespace azure.mgmt.cosmosdb.types key "repairEnabled": bool key "restoreFromBackupId": str key "scheduledEventStrategy": Union[str, ScheduledEventStrategy] - authentication_method: Union[str, AuthenticationMethod] - auto_replicate: Union[str, AutoReplicate] - azure_connection_method: Union[str, AzureConnectionType] + authenticationMethod: Union[str, AuthenticationMethod] + autoReplicate: Union[str, AutoReplicate] + azureConnectionMethod: Union[str, AzureConnectionType] backupSchedules: list[BackupSchedule] - backup_schedules: list[BackupSchedule] - cassandra_audit_logging_enabled: bool - cassandra_version: str + cassandraAuditLoggingEnabled: bool + cassandraVersion: str clientCertificates: list[Certificate] - client_certificates: list[Certificate] - cluster_name_override: str + clusterNameOverride: str + clusterType: Union[str, ClusterType] deallocated: bool - delegated_management_subnet_id: str + delegatedManagementSubnetId: str extensions: list[str] externalDataCenters: list[str] externalGossipCertificates: list[Certificate] externalSeedNodes: list[SeedNode] - external_data_centers: list[str] - external_gossip_certificates: list[Certificate] - external_seed_nodes: list[SeedNode] gossipCertificates: list[Certificate] - gossip_certificates: list[Certificate] - hours_between_backups: int - initial_cassandra_admin_password: str - private_link_resource_id: str - prometheus_endpoint: SeedNode - provision_error: CassandraError - provisioning_state: Union[str, ManagedCassandraProvisioningState] - repair_enabled: bool - restore_from_backup_id: str - scheduled_event_strategy: Union[str, ScheduledEventStrategy] + hoursBetweenBackups: int + initialCassandraAdminPassword: str + privateLinkResourceId: str + prometheusEndpoint: SeedNode + provisionError: CassandraError + provisioningState: Union[str, ManagedCassandraProvisioningState] + repairEnabled: bool + restoreFromBackupId: str + scheduledEventStrategy: Union[str, ScheduledEventStrategy] seedNodes: list[SeedNode] - seed_nodes: list[SeedNode] class azure.mgmt.cosmosdb.types.Column(TypedDict, total=False): @@ -15289,18 +20738,26 @@ namespace azure.mgmt.cosmosdb.types type: str - class azure.mgmt.cosmosdb.types.CommandOutput(TypedDict, total=False): - key "commandOutput": str - command_output: str - - + class azure.mgmt.cosmosdb.types.CommandAsyncPostBody(TypedDict): + key "arguments": Any + key "cassandra-stop-start": bool + key "command": Required[str] + key "host": Required[str] + key "readWrite": bool + arguments: Any + cassandra-stop-start: bool + command: str + host: str + readWrite: bool + + class azure.mgmt.cosmosdb.types.CommandPostBody(TypedDict): key "cassandra-stop-start": bool key "command": Required[str] key "host": Required[str] key "readwrite": bool arguments: dict[str, str] - cassandra_stop_start: bool + cassandra-stop-start: bool command: str host: str readwrite: bool @@ -15324,31 +20781,18 @@ namespace azure.mgmt.cosmosdb.types key "conflictResolutionPath": str key "conflictResolutionProcedure": str key "mode": Union[str, ConflictResolutionMode] - conflict_resolution_path: str - conflict_resolution_procedure: str + conflictResolutionPath: str + conflictResolutionProcedure: str mode: Union[str, ConflictResolutionMode] - class azure.mgmt.cosmosdb.types.ConnectionError(TypedDict, total=False): - key "connectionState": Union[str, ConnectionState] - key "exception": str - key "iPFrom": str - key "iPTo": str - key "port": int - connection_state: Union[str, ConnectionState] - exception: str - i_p_from: str - i_p_to: str - port: int - - class azure.mgmt.cosmosdb.types.ConsistencyPolicy(TypedDict, total=False): key "defaultConsistencyLevel": Required[Union[str, DefaultConsistencyLevel]] key "maxIntervalInSeconds": int key "maxStalenessPrefix": int - default_consistency_level: Union[str, DefaultConsistencyLevel] - max_interval_in_seconds: int - max_staleness_prefix: int + defaultConsistencyLevel: Union[str, DefaultConsistencyLevel] + maxIntervalInSeconds: int + maxStalenessPrefix: int class azure.mgmt.cosmosdb.types.ContainerPartitionKey(TypedDict, total=False): @@ -15357,15 +20801,10 @@ namespace azure.mgmt.cosmosdb.types key "version": int kind: Union[str, PartitionKind] paths: list[str] - system_key: bool + systemKey: bool version: int - class azure.mgmt.cosmosdb.types.ContinuousBackupInformation(TypedDict, total=False): - key "latestRestorableTimestamp": str - latest_restorable_timestamp: str - - class azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation(TypedDict, total=False): key "location": str location: str @@ -15375,8 +20814,8 @@ namespace azure.mgmt.cosmosdb.types key "continuousModeProperties": ForwardRef('ContinuousModeProperties', module='types') key "migrationState": ForwardRef('BackupPolicyMigrationState', module='types') key "type": Required[Literal[BackupPolicyType.CONTINUOUS]] - continuous_mode_properties: ContinuousModeProperties - migration_state: BackupPolicyMigrationState + continuousModeProperties: ContinuousModeProperties + migrationState: BackupPolicyMigrationState type: Literal[BackupPolicyType.CONTINUOUS] @@ -15385,23 +20824,156 @@ namespace azure.mgmt.cosmosdb.types tier: Union[str, ContinuousTier] + class azure.mgmt.cosmosdb.types.CopyJobGetResults(ProxyResource): + key "id": str + key "name": str + key "properties": Required[CopyJobProperties] + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: CopyJobProperties + systemData: SystemData + type: str + + + class azure.mgmt.cosmosdb.types.CopyJobProperties(TypedDict, total=False): + key "duration": str + key "error": ForwardRef('ErrorResponse', module='types') + key "jobProperties": Required[BaseCopyJobProperties] + key "lastUpdatedUtcTime": str + key "mode": Union[str, CopyJobMode] + key "processedCount": int + key "status": Union[str, CopyJobStatus] + key "totalCount": int + key "workerCount": int + duration: str + error: ErrorResponse + jobProperties: BaseCopyJobProperties + lastUpdatedUtcTime: str + mode: Union[str, CopyJobMode] + processedCount: int + status: Union[str, CopyJobStatus] + totalCount: int + workerCount: int + + + class azure.mgmt.cosmosdb.types.CopyJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB_STORAGE_TO_CASSANDRA_RU = "AzureBlobStorageToCassandraRU" + CASSANDRA_RU_TO_AZURE_BLOB_STORAGE = "CassandraRUToAzureBlobStorage" + CASSANDRA_RU_TO_CASSANDRA_RU = "CassandraRUToCassandraRU" + MONGO_RU_TO_MONGO_RU = "MongoRUToMongoRU" + MONGO_RU_TO_MONGO_V_CORE = "MongoRUToMongoVCore" + NO_SQL_RU_TO_NO_SQL_RU = "NoSqlRUToNoSqlRU" + + class azure.mgmt.cosmosdb.types.CorsPolicy(TypedDict, total=False): key "allowedHeaders": str key "allowedMethods": str key "allowedOrigins": Required[str] key "exposedHeaders": str key "maxAgeInSeconds": int - allowed_headers: str - allowed_methods: str - allowed_origins: str - exposed_headers: str - max_age_in_seconds: int + allowedHeaders: str + allowedMethods: str + allowedOrigins: str + exposedHeaders: str + maxAgeInSeconds: int + + + class azure.mgmt.cosmosdb.types.CosmosCassandraDataTransferDataSourceSink(TypedDict, total=False): + key "component": Required[Literal[DataTransferComponent.COSMOS_DB_CASSANDRA]] + key "keyspaceName": Required[str] + key "remoteAccountName": str + key "tableName": Required[str] + component: Literal[DataTransferComponent.COSMOS_DB_CASSANDRA] + keyspaceName: str + remoteAccountName: str + tableName: str + + + class azure.mgmt.cosmosdb.types.CosmosDBCassandraTable(TypedDict, total=False): + key "keyspaceName": Required[str] + key "tableName": Required[str] + keyspaceName: str + tableName: str + + + class azure.mgmt.cosmosdb.types.CosmosDBMongoCollection(TypedDict, total=False): + key "collectionName": Required[str] + key "databaseName": Required[str] + collectionName: str + databaseName: str + + + class azure.mgmt.cosmosdb.types.CosmosDBMongoVCoreCollection(TypedDict, total=False): + key "collectionName": Required[str] + key "databaseName": Required[str] + collectionName: str + databaseName: str + + + class azure.mgmt.cosmosdb.types.CosmosDBNoSqlContainer(TypedDict, total=False): + key "containerName": Required[str] + key "databaseName": Required[str] + containerName: str + databaseName: str + + + class azure.mgmt.cosmosdb.types.CosmosDBSourceSinkDetails(TypedDict, total=False): + key "remoteAccountName": str + remoteAccountName: str + + + class azure.mgmt.cosmosdb.types.CosmosMongoDataTransferDataSourceSink(TypedDict, total=False): + key "collectionName": Required[str] + key "component": Required[Literal[DataTransferComponent.COSMOS_DB_MONGO]] + key "databaseName": Required[str] + key "remoteAccountName": str + collectionName: str + component: Literal[DataTransferComponent.COSMOS_DB_MONGO] + databaseName: str + remoteAccountName: str + + + class azure.mgmt.cosmosdb.types.CosmosMongoVCoreDataTransferDataSourceSink(TypedDict, total=False): + key "collectionName": Required[str] + key "component": Required[Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE]] + key "connectionStringKeyVaultUri": str + key "databaseName": Required[str] + key "hostName": str + collectionName: str + component: Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE] + connectionStringKeyVaultUri: str + databaseName: str + hostName: str + + + class azure.mgmt.cosmosdb.types.CosmosSqlDataTransferDataSourceSink(TypedDict, total=False): + key "component": Required[Literal[DataTransferComponent.COSMOS_DB_SQL]] + key "containerName": Required[str] + key "databaseName": Required[str] + key "remoteAccountName": str + component: Literal[DataTransferComponent.COSMOS_DB_SQL] + containerName: str + databaseName: str + remoteAccountName: str + + + class azure.mgmt.cosmosdb.types.CreateJobRequest(ARMProxyResource): + key "id": str + key "name": str + key "properties": Required[DataTransferJobProperties] + key "type": str + id: str + name: str + properties: DataTransferJobProperties + type: str class azure.mgmt.cosmosdb.types.CreateUpdateOptions(TypedDict, total=False): key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') key "throughput": int - autoscale_settings: AutoscaleSettings + autoscaleSettings: AutoscaleSettings throughput: int @@ -15414,7 +20986,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: DataCenterResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -15434,66 +21006,88 @@ namespace azure.mgmt.cosmosdb.types key "provisionError": ForwardRef('CassandraError', module='types') key "provisioningState": Union[str, ManagedCassandraProvisioningState] key "sku": str - authentication_method_ldap_properties: AuthenticationMethodLdapProperties - availability_zone: bool - backup_storage_customer_key_uri: str - base64_encoded_cassandra_yaml_fragment: str - data_center_location: str + authenticationMethodLdapProperties: AuthenticationMethodLdapProperties + availabilityZone: bool + backupStorageCustomerKeyUri: str + base64EncodedCassandraYamlFragment: str + dataCenterLocation: str deallocated: bool - delegated_subnet_id: str - disk_capacity: int - disk_sku: str - managed_disk_customer_key_uri: str - node_count: int - private_endpoint_ip_address: str - provision_error: CassandraError - provisioning_state: Union[str, ManagedCassandraProvisioningState] + delegatedSubnetId: str + diskCapacity: int + diskSku: str + managedDiskCustomerKeyUri: str + nodeCount: int + privateEndpointIpAddress: str + provisionError: CassandraError + provisioningState: Union[str, ManagedCassandraProvisioningState] seedNodes: list[SeedNode] - seed_nodes: list[SeedNode] sku: str - class azure.mgmt.cosmosdb.types.DataTransferRegionalServiceResource(RegionalServiceResource): - key "location": str - key "name": str - key "status": Union[str, ServiceStatus] - location: str - name: str - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.types.DataMaskingPolicy(TypedDict, total=False): + key "isPolicyEnabled": bool + excludedPaths: list[DataMaskingPolicyExcludedPathsItem] + includedPaths: list[DataMaskingPolicyIncludedPathsItem] + isPolicyEnabled: bool - class azure.mgmt.cosmosdb.types.DataTransferServiceResourceCreateUpdateProperties(TypedDict, total=False): - key "instanceCount": int - key "instanceSize": Union[str, ServiceSize] - key "serviceType": Required[Literal[ServiceType.DATA_TRANSFER]] - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.DATA_TRANSFER] + class azure.mgmt.cosmosdb.types.DataMaskingPolicyExcludedPathsItem(TypedDict, total=False): + key "path": Required[str] + path: str + + + class azure.mgmt.cosmosdb.types.DataMaskingPolicyIncludedPathsItem(TypedDict, total=False): + key "length": int + key "path": Required[str] + key "startPosition": int + key "strategy": str + length: int + path: str + startPosition: int + strategy: str + + + class azure.mgmt.cosmosdb.types.DataTransferComponent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + AZURE_BLOB_STORAGE = "AzureBlobStorage" + BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK = "BaseCosmosDataTransferDataSourceSink" + COSMOS_DB_CASSANDRA = "CosmosDBCassandra" + COSMOS_DB_MONGO = "CosmosDBMongo" + COSMOS_DB_MONGO_V_CORE = "CosmosDBMongoVCore" + COSMOS_DB_SQL = "CosmosDBSql" + + class azure.mgmt.cosmosdb.types.DataTransferJobProperties(TypedDict, total=False): + key "destination": Required[DataTransferDataSourceSink] + key "duration": str + key "error": ForwardRef('ErrorResponseAutoGenerated', module='types') + key "jobName": str + key "lastUpdatedUtcTime": str + key "mode": Union[str, DataTransferJobMode] + key "processedCount": int + key "source": Required[DataTransferDataSourceSink] + key "status": str + key "totalCount": int + key "workerCount": int + destination: DataTransferDataSourceSink + duration: str + error: ErrorResponseAutoGenerated + jobName: str + lastUpdatedUtcTime: str + mode: Union[str, DataTransferJobMode] + processedCount: int + source: DataTransferDataSourceSink + status: str + totalCount: int + workerCount: int - class azure.mgmt.cosmosdb.types.DataTransferServiceResourceProperties(TypedDict, total=False): - key "creationTime": str + + class azure.mgmt.cosmosdb.types.DataTransferServiceResourceCreateUpdateProperties(TypedDict, total=False): key "instanceCount": int key "instanceSize": Union[str, ServiceSize] key "serviceType": Required[Literal[ServiceType.DATA_TRANSFER]] - key "status": Union[str, ServiceStatus] - creation_time: str - instance_count: int - instance_size: Union[str, ServiceSize] - locations: list[DataTransferRegionalServiceResource] - service_type: Literal[ServiceType.DATA_TRANSFER] - status: Union[str, ServiceStatus] - - - class azure.mgmt.cosmosdb.types.DatabaseAccountConnectionString(TypedDict, total=False): - key "connectionString": str - key "description": str - key "keyKind": Union[str, Kind] - key "type": Union[str, Type] - connection_string: str - description: str - key_kind: Union[str, Kind] - type: Union[str, Type] + instanceCount: int + instanceSize: Union[str, ServiceSize] + serviceType: Literal[ServiceType.DATA_TRANSFER] class azure.mgmt.cosmosdb.types.DatabaseAccountCreateUpdateParameters(ARMResourceProperties): @@ -15519,6 +21113,7 @@ namespace azure.mgmt.cosmosdb.types key "apiProperties": ForwardRef('ApiProperties', module='types') key "backupPolicy": ForwardRef('BackupPolicy', module='types') key "capacity": ForwardRef('Capacity', module='types') + key "capacityMode": Union[str, CapacityMode] key "connectorOffer": Union[str, ConnectorOffer] key "consistencyPolicy": ForwardRef('ConsistencyPolicy', module='types') key "createMode": Union[str, CreateMode] @@ -15526,13 +21121,16 @@ namespace azure.mgmt.cosmosdb.types key "databaseAccountOfferType": Required[Literal["Standard"]] key "defaultIdentity": str key "defaultPriorityLevel": Union[str, DefaultPriorityLevel] + key "diagnosticLogSettings": ForwardRef('DiagnosticLogSettings', module='types') key "disableKeyBasedMetadataWriteAccess": bool key "disableLocalAuth": bool + key "enableAllVersionsAndDeletesChangeFeed": bool key "enableAnalyticalStorage": bool key "enableAutomaticFailover": bool key "enableBurstCapacity": bool key "enableCassandraConnector": bool key "enableFreeTier": bool + key "enableMaterializedViews": bool key "enableMultipleWriteLocations": bool key "enablePartitionMerge": bool key "enablePerRegionPerPartitionAutoscale": bool @@ -15546,153 +21144,48 @@ namespace azure.mgmt.cosmosdb.types key "networkAclBypass": Union[str, NetworkAclBypass] key "publicNetworkAccess": Union[str, PublicNetworkAccess] key "restoreParameters": ForwardRef('RestoreParameters', module='types') - analytical_storage_configuration: AnalyticalStorageConfiguration - api_properties: ApiProperties - backup_policy: BackupPolicy - capabilities: list[Capability] - capacity: Capacity - connector_offer: Union[str, ConnectorOffer] - consistency_policy: ConsistencyPolicy - cors: list[CorsPolicy] - create_mode: Union[str, CreateMode] - customer_managed_key_status: str - database_account_offer_type: Literal[Standard] - default_identity: str - default_priority_level: Union[str, DefaultPriorityLevel] - disable_key_based_metadata_write_access: bool - disable_local_auth: bool - enable_analytical_storage: bool - enable_automatic_failover: bool - enable_burst_capacity: bool - enable_cassandra_connector: bool - enable_free_tier: bool - enable_multiple_write_locations: bool - enable_partition_merge: bool - enable_per_region_per_partition_autoscale: bool - enable_priority_based_execution: bool - enforce_hierarchical_partition_key_id_last_level: bool - ipRules: list[IpAddressOrRange] - ip_rules: list[IpAddressOrRange] - is_virtual_network_filter_enabled: bool - key_vault_key_uri: str - keys_metadata: DatabaseAccountKeysMetadata - locations: list[Location] - minimal_tls_version: Union[str, MinimalTlsVersion] - networkAclBypassResourceIds: list[str] - network_acl_bypass: Union[str, NetworkAclBypass] - network_acl_bypass_resource_ids: list[str] - public_network_access: Union[str, PublicNetworkAccess] - restore_parameters: RestoreParameters - virtualNetworkRules: list[VirtualNetworkRule] - virtual_network_rules: list[VirtualNetworkRule] - - - class azure.mgmt.cosmosdb.types.DatabaseAccountGetProperties(TypedDict, total=False): - key "analyticalStorageConfiguration": ForwardRef('AnalyticalStorageConfiguration', module='types') - key "apiProperties": ForwardRef('ApiProperties', module='types') - key "backupPolicy": ForwardRef('BackupPolicy', module='types') - key "capacity": ForwardRef('Capacity', module='types') - key "connectorOffer": Union[str, ConnectorOffer] - key "consistencyPolicy": ForwardRef('ConsistencyPolicy', module='types') - key "createMode": Union[str, CreateMode] - key "customerManagedKeyStatus": str - key "databaseAccountOfferType": Literal["Standard"] - key "defaultIdentity": str - key "defaultPriorityLevel": Union[str, DefaultPriorityLevel] - key "disableKeyBasedMetadataWriteAccess": bool - key "disableLocalAuth": bool - key "documentEndpoint": str - key "enableAnalyticalStorage": bool - key "enableAutomaticFailover": bool - key "enableBurstCapacity": bool - key "enableCassandraConnector": bool - key "enableFreeTier": bool - key "enableMultipleWriteLocations": bool - key "enablePartitionMerge": bool - key "enablePerRegionPerPartitionAutoscale": bool - key "enablePriorityBasedExecution": bool - key "enforceHierarchicalPartitionKeyIdLastLevel": bool - key "instanceId": str - key "isVirtualNetworkFilterEnabled": bool - key "keyVaultKeyUri": str - key "keyVaultKeyUriVersion": str - key "keysMetadata": ForwardRef('DatabaseAccountKeysMetadata', module='types') - key "minimalTlsVersion": Union[str, MinimalTlsVersion] - key "networkAclBypass": Union[str, NetworkAclBypass] - key "provisioningState": str - key "publicNetworkAccess": Union[str, PublicNetworkAccess] - key "restoreParameters": ForwardRef('RestoreParameters', module='types') - analytical_storage_configuration: AnalyticalStorageConfiguration - api_properties: ApiProperties - backup_policy: BackupPolicy + key "softDeleteConfiguration": ForwardRef('SoftDeleteConfiguration', module='types') + analyticalStorageConfiguration: AnalyticalStorageConfiguration + apiProperties: ApiProperties + backupPolicy: BackupPolicy capabilities: list[Capability] capacity: Capacity - connector_offer: Union[str, ConnectorOffer] - consistency_policy: ConsistencyPolicy + capacityMode: Union[str, CapacityMode] + connectorOffer: Union[str, ConnectorOffer] + consistencyPolicy: ConsistencyPolicy cors: list[CorsPolicy] - create_mode: Union[str, CreateMode] - customer_managed_key_status: str - database_account_offer_type: Literal[Standard] - default_identity: str - default_priority_level: Union[str, DefaultPriorityLevel] - disable_key_based_metadata_write_access: bool - disable_local_auth: bool - document_endpoint: str - enable_analytical_storage: bool - enable_automatic_failover: bool - enable_burst_capacity: bool - enable_cassandra_connector: bool - enable_free_tier: bool - enable_multiple_write_locations: bool - enable_partition_merge: bool - enable_per_region_per_partition_autoscale: bool - enable_priority_based_execution: bool - enforce_hierarchical_partition_key_id_last_level: bool - failoverPolicies: list[FailoverPolicy] - failover_policies: list[FailoverPolicy] - instance_id: str + createMode: Union[str, CreateMode] + customerManagedKeyStatus: str + databaseAccountOfferType: Literal[Standard] + defaultIdentity: str + defaultPriorityLevel: Union[str, DefaultPriorityLevel] + diagnosticLogSettings: DiagnosticLogSettings + disableKeyBasedMetadataWriteAccess: bool + disableLocalAuth: bool + enableAllVersionsAndDeletesChangeFeed: bool + enableAnalyticalStorage: bool + enableAutomaticFailover: bool + enableBurstCapacity: bool + enableCassandraConnector: bool + enableFreeTier: bool + enableMaterializedViews: bool + enableMultipleWriteLocations: bool + enablePartitionMerge: bool + enablePerRegionPerPartitionAutoscale: bool + enablePriorityBasedExecution: bool + enforceHierarchicalPartitionKeyIdLastLevel: bool ipRules: list[IpAddressOrRange] - ip_rules: list[IpAddressOrRange] - is_virtual_network_filter_enabled: bool - key_vault_key_uri: str - key_vault_key_uri_version: str - keys_metadata: DatabaseAccountKeysMetadata + isVirtualNetworkFilterEnabled: bool + keyVaultKeyUri: str + keysMetadata: DatabaseAccountKeysMetadata locations: list[Location] - minimal_tls_version: Union[str, MinimalTlsVersion] + minimalTlsVersion: Union[str, MinimalTlsVersion] + networkAclBypass: Union[str, NetworkAclBypass] networkAclBypassResourceIds: list[str] - network_acl_bypass: Union[str, NetworkAclBypass] - network_acl_bypass_resource_ids: list[str] - privateEndpointConnections: list[PrivateEndpointConnection] - private_endpoint_connections: list[PrivateEndpointConnection] - provisioning_state: str - public_network_access: Union[str, PublicNetworkAccess] - readLocations: list[Location] - read_locations: list[Location] - restore_parameters: RestoreParameters + publicNetworkAccess: Union[str, PublicNetworkAccess] + restoreParameters: RestoreParameters + softDeleteConfiguration: SoftDeleteConfiguration virtualNetworkRules: list[VirtualNetworkRule] - virtual_network_rules: list[VirtualNetworkRule] - writeLocations: list[Location] - write_locations: list[Location] - - - class azure.mgmt.cosmosdb.types.DatabaseAccountGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "kind": Union[str, DatabaseAccountKind] - key "location": str - key "name": str - key "properties": ForwardRef('DatabaseAccountGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - kind: Union[str, DatabaseAccountKind] - location: str - name: str - properties: DatabaseAccountGetProperties - system_data: SystemData - tags: dict[str, str] - type: str class azure.mgmt.cosmosdb.types.DatabaseAccountKeysMetadata(TypedDict, total=False): @@ -15700,38 +21193,17 @@ namespace azure.mgmt.cosmosdb.types key "primaryReadonlyMasterKey": ForwardRef('AccountKeyMetadata', module='types') key "secondaryMasterKey": ForwardRef('AccountKeyMetadata', module='types') key "secondaryReadonlyMasterKey": ForwardRef('AccountKeyMetadata', module='types') - primary_master_key: AccountKeyMetadata - primary_readonly_master_key: AccountKeyMetadata - secondary_master_key: AccountKeyMetadata - secondary_readonly_master_key: AccountKeyMetadata - - - class azure.mgmt.cosmosdb.types.DatabaseAccountListConnectionStringsResult(TypedDict, total=False): - connectionStrings: list[DatabaseAccountConnectionString] - connection_strings: list[DatabaseAccountConnectionString] - - - class azure.mgmt.cosmosdb.types.DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): - key "primaryMasterKey": str - key "primaryReadonlyMasterKey": str - key "secondaryMasterKey": str - key "secondaryReadonlyMasterKey": str - primary_master_key: str - primary_readonly_master_key: str - secondary_master_key: str - secondary_readonly_master_key: str - - - class azure.mgmt.cosmosdb.types.DatabaseAccountListReadOnlyKeysResult(TypedDict, total=False): - key "primaryReadonlyMasterKey": str - key "secondaryReadonlyMasterKey": str - primary_readonly_master_key: str - secondary_readonly_master_key: str + primaryMasterKey: AccountKeyMetadata + primaryReadonlyMasterKey: AccountKeyMetadata + secondaryMasterKey: AccountKeyMetadata + secondaryReadonlyMasterKey: AccountKeyMetadata class azure.mgmt.cosmosdb.types.DatabaseAccountRegenerateKeyParameters(TypedDict, total=False): key "keyKind": Required[Union[str, KeyKind]] - key_kind: Union[str, KeyKind] + key "skipAccountKeysLastUsageCheck": bool + keyKind: Union[str, KeyKind] + skipAccountKeysLastUsageCheck: bool class azure.mgmt.cosmosdb.types.DatabaseAccountUpdateParameters(TypedDict, total=False): @@ -15749,18 +21221,22 @@ namespace azure.mgmt.cosmosdb.types key "apiProperties": ForwardRef('ApiProperties', module='types') key "backupPolicy": ForwardRef('BackupPolicy', module='types') key "capacity": ForwardRef('Capacity', module='types') + key "capacityMode": Union[str, CapacityMode] key "connectorOffer": Union[str, ConnectorOffer] key "consistencyPolicy": ForwardRef('ConsistencyPolicy', module='types') key "customerManagedKeyStatus": str key "defaultIdentity": str key "defaultPriorityLevel": Union[str, DefaultPriorityLevel] + key "diagnosticLogSettings": ForwardRef('DiagnosticLogSettings', module='types') key "disableKeyBasedMetadataWriteAccess": bool key "disableLocalAuth": bool + key "enableAllVersionsAndDeletesChangeFeed": bool key "enableAnalyticalStorage": bool key "enableAutomaticFailover": bool key "enableBurstCapacity": bool key "enableCassandraConnector": bool key "enableFreeTier": bool + key "enableMaterializedViews": bool key "enableMultipleWriteLocations": bool key "enablePartitionMerge": bool key "enablePerRegionPerPartitionAutoscale": bool @@ -15772,49 +21248,56 @@ namespace azure.mgmt.cosmosdb.types key "minimalTlsVersion": Union[str, MinimalTlsVersion] key "networkAclBypass": Union[str, NetworkAclBypass] key "publicNetworkAccess": Union[str, PublicNetworkAccess] - analytical_storage_configuration: AnalyticalStorageConfiguration - api_properties: ApiProperties - backup_policy: BackupPolicy + key "softDeleteConfiguration": ForwardRef('SoftDeleteConfiguration', module='types') + analyticalStorageConfiguration: AnalyticalStorageConfiguration + apiProperties: ApiProperties + backupPolicy: BackupPolicy capabilities: list[Capability] capacity: Capacity - connector_offer: Union[str, ConnectorOffer] - consistency_policy: ConsistencyPolicy + capacityMode: Union[str, CapacityMode] + connectorOffer: Union[str, ConnectorOffer] + consistencyPolicy: ConsistencyPolicy cors: list[CorsPolicy] - customer_managed_key_status: str - default_identity: str - default_priority_level: Union[str, DefaultPriorityLevel] - disable_key_based_metadata_write_access: bool - disable_local_auth: bool - enable_analytical_storage: bool - enable_automatic_failover: bool - enable_burst_capacity: bool - enable_cassandra_connector: bool - enable_free_tier: bool - enable_multiple_write_locations: bool - enable_partition_merge: bool - enable_per_region_per_partition_autoscale: bool - enable_priority_based_execution: bool - enforce_hierarchical_partition_key_id_last_level: bool + customerManagedKeyStatus: str + defaultIdentity: str + defaultPriorityLevel: Union[str, DefaultPriorityLevel] + diagnosticLogSettings: DiagnosticLogSettings + disableKeyBasedMetadataWriteAccess: bool + disableLocalAuth: bool + enableAllVersionsAndDeletesChangeFeed: bool + enableAnalyticalStorage: bool + enableAutomaticFailover: bool + enableBurstCapacity: bool + enableCassandraConnector: bool + enableFreeTier: bool + enableMaterializedViews: bool + enableMultipleWriteLocations: bool + enablePartitionMerge: bool + enablePerRegionPerPartitionAutoscale: bool + enablePriorityBasedExecution: bool + enforceHierarchicalPartitionKeyIdLastLevel: bool ipRules: list[IpAddressOrRange] - ip_rules: list[IpAddressOrRange] - is_virtual_network_filter_enabled: bool - key_vault_key_uri: str - keys_metadata: DatabaseAccountKeysMetadata + isVirtualNetworkFilterEnabled: bool + keyVaultKeyUri: str + keysMetadata: DatabaseAccountKeysMetadata locations: list[Location] - minimal_tls_version: Union[str, MinimalTlsVersion] + minimalTlsVersion: Union[str, MinimalTlsVersion] + networkAclBypass: Union[str, NetworkAclBypass] networkAclBypassResourceIds: list[str] - network_acl_bypass: Union[str, NetworkAclBypass] - network_acl_bypass_resource_ids: list[str] - public_network_access: Union[str, PublicNetworkAccess] + publicNetworkAccess: Union[str, PublicNetworkAccess] + softDeleteConfiguration: SoftDeleteConfiguration virtualNetworkRules: list[VirtualNetworkRule] - virtual_network_rules: list[VirtualNetworkRule] class azure.mgmt.cosmosdb.types.DatabaseRestoreResource(TypedDict, total=False): key "databaseName": str collectionNames: list[str] - collection_names: list[str] - database_name: str + databaseName: str + + + class azure.mgmt.cosmosdb.types.DiagnosticLogSettings(TypedDict, total=False): + key "enableFullTextQuery": Union[str, EnableFullTextQuery] + enableFullTextQuery: Union[str, EnableFullTextQuery] class azure.mgmt.cosmosdb.types.ErrorAdditionalInfo(TypedDict, total=False): @@ -15829,7 +21312,6 @@ namespace azure.mgmt.cosmosdb.types key "message": str key "target": str additionalInfo: list[ErrorAdditionalInfo] - additional_info: list[ErrorAdditionalInfo] code: str details: list[ErrorDetail] message: str @@ -15855,16 +21337,38 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.FailoverPolicies(TypedDict, total=False): key "failoverPolicies": Required[list[FailoverPolicy]] - failover_policies: list[FailoverPolicy] + failoverPolicies: list[FailoverPolicy] class azure.mgmt.cosmosdb.types.FailoverPolicy(TypedDict, total=False): key "failoverPriority": int key "id": str key "locationName": str - failover_priority: int + failoverPriority: int + id: str + locationName: str + + + class azure.mgmt.cosmosdb.types.FleetAnalyticsProperties(TypedDict, total=False): + key "provisioningState": Union[str, Status] + key "storageLocationType": Union[str, FleetAnalyticsPropertiesStorageLocationType] + key "storageLocationUri": str + provisioningState: Union[str, Status] + storageLocationType: Union[str, FleetAnalyticsPropertiesStorageLocationType] + storageLocationUri: str + + + class azure.mgmt.cosmosdb.types.FleetAnalyticsResource(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('FleetAnalyticsProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str id: str - location_name: str + name: str + properties: FleetAnalyticsProperties + systemData: SystemData + type: str class azure.mgmt.cosmosdb.types.FleetResource(TrackedResource): @@ -15878,14 +21382,14 @@ namespace azure.mgmt.cosmosdb.types location: str name: str properties: FleetResourceProperties - system_data: SystemData + systemData: SystemData tags: dict[str, str] type: str class azure.mgmt.cosmosdb.types.FleetResourceProperties(TypedDict, total=False): key "provisioningState": Union[str, Status] - provisioning_state: Union[str, Status] + provisioningState: Union[str, Status] class azure.mgmt.cosmosdb.types.FleetResourceUpdate(TypedDict, total=False): @@ -15897,15 +21401,15 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.FleetspaceAccountProperties(TypedDict, total=False): key "globalDatabaseAccountProperties": ForwardRef('FleetspaceAccountPropertiesGlobalDatabaseAccountProperties', module='types') key "provisioningState": Union[str, Status] - global_database_account_properties: FleetspaceAccountPropertiesGlobalDatabaseAccountProperties - provisioning_state: Union[str, Status] + globalDatabaseAccountProperties: FleetspaceAccountPropertiesGlobalDatabaseAccountProperties + provisioningState: Union[str, Status] class azure.mgmt.cosmosdb.types.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties(TypedDict, total=False): key "armLocation": str key "resourceId": str - arm_location: str - resource_id: str + armLocation: str + resourceId: str class azure.mgmt.cosmosdb.types.FleetspaceAccountResource(ProxyResource): @@ -15917,7 +21421,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: FleetspaceAccountProperties - system_data: SystemData + systemData: SystemData type: str @@ -15927,11 +21431,10 @@ namespace azure.mgmt.cosmosdb.types key "serviceTier": Union[str, FleetspacePropertiesServiceTier] key "throughputPoolConfiguration": ForwardRef('FleetspacePropertiesThroughputPoolConfiguration', module='types') dataRegions: list[str] - data_regions: list[str] - fleetspace_api_kind: Union[str, FleetspacePropertiesFleetspaceApiKind] - provisioning_state: Union[str, Status] - service_tier: Union[str, FleetspacePropertiesServiceTier] - throughput_pool_configuration: FleetspacePropertiesThroughputPoolConfiguration + fleetspaceApiKind: Union[str, FleetspacePropertiesFleetspaceApiKind] + provisioningState: Union[str, Status] + serviceTier: Union[str, FleetspacePropertiesServiceTier] + throughputPoolConfiguration: FleetspacePropertiesThroughputPoolConfiguration class azure.mgmt.cosmosdb.types.FleetspacePropertiesThroughputPoolConfiguration(TypedDict, total=False): @@ -15939,10 +21442,10 @@ namespace azure.mgmt.cosmosdb.types key "maxConsumableRUs": int key "maxThroughput": int key "minThroughput": int - dedicated_r_us: int - max_consumable_r_us: int - max_throughput: int - min_throughput: int + dedicatedRUs: int + maxConsumableRUs: int + maxThroughput: int + minThroughput: int class azure.mgmt.cosmosdb.types.FleetspaceResource(ProxyResource): @@ -15954,7 +21457,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: FleetspaceProperties - system_data: SystemData + systemData: SystemData type: str @@ -15977,128 +21480,150 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.FullTextPolicy(TypedDict, total=False): key "defaultLanguage": str - default_language: str + defaultLanguage: str fullTextPaths: list[FullTextPath] - full_text_paths: list[FullTextPath] - class azure.mgmt.cosmosdb.types.GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - key "graphApiComputeEndpoint": str - key "location": str + class azure.mgmt.cosmosdb.types.GarnetClusterResource(TrackedResource): + key "id": str + key "identity": ForwardRef('ManagedCassandraManagedServiceIdentity', module='types') + key "location": Required[str] key "name": str - key "status": Union[str, ServiceStatus] - graph_api_compute_endpoint: str + key "properties": ForwardRef('GarnetClusterResourceProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + identity: ManagedCassandraManagedServiceIdentity location: str name: str - status: Union[str, ServiceStatus] + properties: GarnetClusterResourceProperties + systemData: SystemData + tags: dict[str, str] + type: str + + + class azure.mgmt.cosmosdb.types.GarnetClusterResourcePatch(TypedDict, total=False): + key "properties": ForwardRef('GarnetClusterResourcePatchProperties', module='types') + properties: GarnetClusterResourcePatchProperties + + + class azure.mgmt.cosmosdb.types.GarnetClusterResourcePatchProperties(TypedDict, total=False): + key "authenticationMethod": Union[str, GarnetAuthenticationType] + key "clusterType": Union[str, ClusterType] + key "persistence": bool + authenticationMethod: Union[str, GarnetAuthenticationType] + clusterType: Union[str, ClusterType] + extensions: list[str] + persistence: bool + + + class azure.mgmt.cosmosdb.types.GarnetClusterResourceProperties(TypedDict, total=False): + key "allocationState": Union[str, AllocationState] + key "authenticationMethod": Union[str, GarnetAuthenticationType] + key "availabilityZone": bool + key "clusterType": Union[str, ClusterType] + key "nodeSku": str + key "persistence": bool + key "provisionError": ForwardRef('ErrorDetail', module='types') + key "provisioningState": Union[str, GarnetCacheProvisioningState] + key "replicationFactor": int + key "shardCount": int + key "subnetId": str + allocationState: Union[str, AllocationState] + authenticationMethod: Union[str, GarnetAuthenticationType] + availabilityZone: bool + clusterType: Union[str, ClusterType] + endPoints: list[GarnetClusterResourcePropertiesEndPointsItem] + extensions: list[str] + nodeSku: str + persistence: bool + provisionError: ErrorDetail + provisioningState: Union[str, GarnetCacheProvisioningState] + replicationFactor: int + shardCount: int + subnetId: str + + + class azure.mgmt.cosmosdb.types.GarnetClusterResourcePropertiesEndPointsItem(TypedDict, total=False): + key "ipAddress": str + key "port": int + ipAddress: str + port: int class azure.mgmt.cosmosdb.types.GraphAPIComputeServiceResourceCreateUpdateProperties(TypedDict, total=False): key "instanceCount": int key "instanceSize": Union[str, ServiceSize] key "serviceType": Required[Literal[ServiceType.GRAPH_API_COMPUTE]] - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] + instanceCount: int + instanceSize: Union[str, ServiceSize] + serviceType: Literal[ServiceType.GRAPH_API_COMPUTE] - class azure.mgmt.cosmosdb.types.GraphAPIComputeServiceResourceProperties(TypedDict, total=False): - key "creationTime": str - key "graphApiComputeEndpoint": str - key "instanceCount": int - key "instanceSize": Union[str, ServiceSize] - key "serviceType": Required[Literal[ServiceType.GRAPH_API_COMPUTE]] - key "status": Union[str, ServiceStatus] - creation_time: str - graph_api_compute_endpoint: str - instance_count: int - instance_size: Union[str, ServiceSize] - locations: list[GraphAPIComputeRegionalServiceResource] - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.types.GraphResource(TypedDict, total=False): + key "id": Required[str] + id: str - class azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): + class azure.mgmt.cosmosdb.types.GraphResourceCreateUpdateParameters(ARMResourceProperties): key "id": str key "identity": ForwardRef('ManagedServiceIdentity', module='types') key "location": str key "name": str - key "properties": Required[GremlinDatabaseCreateUpdateProperties] + key "properties": Required[GraphResourceCreateUpdateProperties] key "type": str id: str identity: ManagedServiceIdentity location: str name: str - properties: GremlinDatabaseCreateUpdateProperties + properties: GraphResourceCreateUpdateProperties tags: dict[str, str] type: str - class azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateProperties(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.GraphResourceCreateUpdateProperties(TypedDict, total=False): key "options": ForwardRef('CreateUpdateOptions', module='types') - key "resource": Required[GremlinDatabaseResource] + key "resource": Required[GraphResource] options: CreateUpdateOptions - resource: GremlinDatabaseResource - - - class azure.mgmt.cosmosdb.types.GremlinDatabaseGetProperties(TypedDict, total=False): - key "options": ForwardRef('GremlinDatabaseGetPropertiesOptions', module='types') - key "resource": ForwardRef('GremlinDatabaseGetPropertiesResource', module='types') - options: GremlinDatabaseGetPropertiesOptions - resource: GremlinDatabaseGetPropertiesResource + resource: GraphResource - class azure.mgmt.cosmosdb.types.GremlinDatabaseGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.GremlinDatabaseGetPropertiesResource(GremlinDatabaseResource): - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] - etag: str - id: str - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.GremlinDatabaseGetResults(ProxyResource): + class azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): key "id": str key "identity": ForwardRef('ManagedServiceIdentity', module='types') key "location": str key "name": str - key "properties": ForwardRef('GremlinDatabaseGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') + key "properties": Required[GremlinDatabaseCreateUpdateProperties] key "type": str id: str identity: ManagedServiceIdentity location: str name: str - properties: GremlinDatabaseGetProperties - system_data: SystemData + properties: GremlinDatabaseCreateUpdateProperties tags: dict[str, str] type: str + class azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateProperties(TypedDict, total=False): + key "options": ForwardRef('CreateUpdateOptions', module='types') + key "resource": Required[GremlinDatabaseResource] + options: CreateUpdateOptions + resource: GremlinDatabaseResource + + class azure.mgmt.cosmosdb.types.GremlinDatabaseResource(TypedDict, total=False): key "createMode": Union[str, CreateMode] key "id": Required[str] key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] + createMode: Union[str, CreateMode] id: str - restore_parameters: ResourceRestoreParameters + restoreParameters: ResourceRestoreParameters class azure.mgmt.cosmosdb.types.GremlinDatabaseRestoreResource(TypedDict, total=False): key "databaseName": str - database_name: str + databaseName: str graphNames: list[str] - graph_names: list[str] class azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters(ARMResourceProperties): @@ -16124,21 +21649,7 @@ namespace azure.mgmt.cosmosdb.types resource: GremlinGraphResource - class azure.mgmt.cosmosdb.types.GremlinGraphGetProperties(TypedDict, total=False): - key "options": ForwardRef('GremlinGraphGetPropertiesOptions', module='types') - key "resource": ForwardRef('GremlinGraphGetPropertiesResource', module='types') - options: GremlinGraphGetPropertiesOptions - resource: GremlinGraphGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.GremlinGraphGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.GremlinGraphGetPropertiesResource(GremlinGraphResource): + class azure.mgmt.cosmosdb.types.GremlinGraphResource(TypedDict, total=False): key "analyticalStorageTtl": int key "conflictResolutionPolicy": ForwardRef('ConflictResolutionPolicy', module='types') key "createMode": Union[str, CreateMode] @@ -16148,60 +21659,18 @@ namespace azure.mgmt.cosmosdb.types key "partitionKey": ForwardRef('ContainerPartitionKey', module='types') key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') key "uniqueKeyPolicy": ForwardRef('UniqueKeyPolicy', module='types') - analytical_storage_ttl: int - conflict_resolution_policy: ConflictResolutionPolicy - create_mode: Union[str, CreateMode] - default_ttl: int - etag: str + analyticalStorageTtl: int + conflictResolutionPolicy: ConflictResolutionPolicy + createMode: Union[str, CreateMode] + defaultTtl: int id: str - indexing_policy: IndexingPolicy - partition_key: ContainerPartitionKey - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - unique_key_policy: UniqueKeyPolicy + indexingPolicy: IndexingPolicy + partitionKey: ContainerPartitionKey + restoreParameters: ResourceRestoreParameters + uniqueKeyPolicy: UniqueKeyPolicy - class azure.mgmt.cosmosdb.types.GremlinGraphGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('GremlinGraphGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: GremlinGraphGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - - class azure.mgmt.cosmosdb.types.GremlinGraphResource(TypedDict, total=False): - key "analyticalStorageTtl": int - key "conflictResolutionPolicy": ForwardRef('ConflictResolutionPolicy', module='types') - key "createMode": Union[str, CreateMode] - key "defaultTtl": int - key "id": Required[str] - key "indexingPolicy": ForwardRef('IndexingPolicy', module='types') - key "partitionKey": ForwardRef('ContainerPartitionKey', module='types') - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - key "uniqueKeyPolicy": ForwardRef('UniqueKeyPolicy', module='types') - analytical_storage_ttl: int - conflict_resolution_policy: ConflictResolutionPolicy - create_mode: Union[str, CreateMode] - default_ttl: int - id: str - indexing_policy: IndexingPolicy - partition_key: ContainerPartitionKey - restore_parameters: ResourceRestoreParameters - unique_key_policy: UniqueKeyPolicy - - - class azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource(ProxyResource): + class azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource(ProxyResource): key "id": str key "name": str key "properties": ForwardRef('GremlinRoleAssignmentResourceProperties', module='types') @@ -16210,7 +21679,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: GremlinRoleAssignmentResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -16219,9 +21688,9 @@ namespace azure.mgmt.cosmosdb.types key "provisioningState": str key "roleDefinitionId": str key "scope": str - principal_id: str - provisioning_state: str - role_definition_id: str + principalId: str + provisioningState: str + roleDefinitionId: str scope: str @@ -16234,7 +21703,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: GremlinRoleDefinitionResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -16243,10 +21712,9 @@ namespace azure.mgmt.cosmosdb.types key "roleName": str key "type": Union[str, RoleDefinitionType] assignableScopes: list[str] - assignable_scopes: list[str] id: str permissions: list[Permission] - role_name: str + roleName: str type: Union[str, RoleDefinitionType] @@ -16260,7 +21728,7 @@ namespace azure.mgmt.cosmosdb.types key "dataType": Union[str, DataType] key "kind": Union[str, IndexKind] key "precision": int - data_type: Union[str, DataType] + dataType: Union[str, DataType] kind: Union[str, IndexKind] precision: int @@ -16270,23 +21738,17 @@ namespace azure.mgmt.cosmosdb.types key "indexingMode": Union[str, IndexingMode] automatic: bool compositeIndexes: list[list[CompositePath]] - composite_indexes: list[list[CompositePath]] excludedPaths: list[ExcludedPath] - excluded_paths: list[ExcludedPath] fullTextIndexes: list[FullTextIndexPath] - full_text_indexes: list[FullTextIndexPath] includedPaths: list[IncludedPath] - included_paths: list[IncludedPath] - indexing_mode: Union[str, IndexingMode] + indexingMode: Union[str, IndexingMode] spatialIndexes: list[SpatialSpec] - spatial_indexes: list[SpatialSpec] vectorIndexes: list[VectorIndex] - vector_indexes: list[VectorIndex] class azure.mgmt.cosmosdb.types.IpAddressOrRange(TypedDict, total=False): key "ipAddressOrRange": str - ip_address_or_range: str + ipAddressOrRange: str class azure.mgmt.cosmosdb.types.KeyWrapMetadata(TypedDict, total=False): @@ -16307,164 +21769,74 @@ namespace azure.mgmt.cosmosdb.types key "isZoneRedundant": bool key "locationName": str key "provisioningState": str - document_endpoint: str - failover_priority: int + documentEndpoint: str + failoverPriority: int id: str - is_zone_redundant: bool - location_name: str - provisioning_state: str - - - class azure.mgmt.cosmosdb.types.LocationGetResult(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('LocationProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: LocationProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.LocationProperties(TypedDict, total=False): - key "isResidencyRestricted": bool - key "isSubscriptionRegionAccessAllowedForAz": bool - key "isSubscriptionRegionAccessAllowedForRegular": bool - key "status": Union[str, Status] - key "supportsAvailabilityZone": bool - backupStorageRedundancies: list[Union[str, BackupStorageRedundancy]] - backup_storage_redundancies: list[Union[str, BackupStorageRedundancy]] - is_residency_restricted: bool - is_subscription_region_access_allowed_for_az: bool - is_subscription_region_access_allowed_for_regular: bool - status: Union[str, Status] - supports_availability_zone: bool + isZoneRedundant: bool + locationName: str + provisioningState: str class azure.mgmt.cosmosdb.types.ManagedCassandraManagedServiceIdentity(TypedDict, total=False): key "principalId": str key "tenantId": str key "type": Union[str, ManagedCassandraResourceIdentityType] - principal_id: str - tenant_id: str + principalId: str + tenantId: str type: Union[str, ManagedCassandraResourceIdentityType] - class azure.mgmt.cosmosdb.types.ManagedCassandraReaperStatus(TypedDict, total=False): - key "healthy": bool - healthy: bool - repairRunIds: dict[str, str] - repairSchedules: dict[str, str] - repair_run_ids: dict[str, str] - repair_schedules: dict[str, str] - - class azure.mgmt.cosmosdb.types.ManagedServiceIdentity(TypedDict, total=False): key "principalId": str key "tenantId": str key "type": Union[str, ResourceIdentityType] - principal_id: str - tenant_id: str + principalId: str + tenantId: str type: Union[str, ResourceIdentityType] userAssignedIdentities: dict[str, ManagedServiceIdentityUserAssignedIdentity] - user_assigned_identities: dict[str, ManagedServiceIdentityUserAssignedIdentity] class azure.mgmt.cosmosdb.types.ManagedServiceIdentityUserAssignedIdentity(TypedDict, total=False): key "clientId": str key "principalId": str - client_id: str - principal_id: str + clientId: str + principalId: str - class azure.mgmt.cosmosdb.types.MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): - key "location": str - key "name": str - key "status": Union[str, ServiceStatus] - location: str - name: str - status: Union[str, ServiceStatus] + class azure.mgmt.cosmosdb.types.MaterializedViewDefinition(TypedDict, total=False): + key "definition": Required[str] + key "sourceCollectionId": Required[str] + key "sourceCollectionRid": str + key "throughputBucketForBuild": int + definition: str + sourceCollectionId: str + sourceCollectionRid: str + throughputBucketForBuild: int - class azure.mgmt.cosmosdb.types.MaterializedViewsBuilderServiceResourceCreateUpdateProperties(TypedDict, total=False): - key "instanceCount": int - key "instanceSize": Union[str, ServiceSize] - key "serviceType": Required[Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER]] - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] + class azure.mgmt.cosmosdb.types.MaterializedViewDetails(TypedDict, total=False): + key "id": str + _rid: str + id: str - class azure.mgmt.cosmosdb.types.MaterializedViewsBuilderServiceResourceProperties(TypedDict, total=False): - key "creationTime": str + class azure.mgmt.cosmosdb.types.MaterializedViewsBuilderServiceResourceCreateUpdateProperties(TypedDict, total=False): key "instanceCount": int key "instanceSize": Union[str, ServiceSize] key "serviceType": Required[Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER]] - key "status": Union[str, ServiceStatus] - creation_time: str - instance_count: int - instance_size: Union[str, ServiceSize] - locations: list[MaterializedViewsBuilderRegionalServiceResource] - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] - status: Union[str, ServiceStatus] + instanceCount: int + instanceSize: Union[str, ServiceSize] + serviceType: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] - class azure.mgmt.cosmosdb.types.Metric(TypedDict, total=False): - key "endTime": str - key "name": ForwardRef('MetricName', module='types') - key "startTime": str - key "timeGrain": str - key "unit": Union[str, UnitType] - end_time: str - metricValues: list[MetricValue] - metric_values: list[MetricValue] - name: MetricName - start_time: str - time_grain: str - unit: Union[str, UnitType] - - - class azure.mgmt.cosmosdb.types.MetricAvailability(TypedDict, total=False): - key "retention": str - key "timeGrain": str - retention: str - time_grain: str - + class azure.mgmt.cosmosdb.types.MaterializedViewsProperties(TypedDict, total=False): + key "throughputBucketForBuild": int + throughputBucketForBuild: int - class azure.mgmt.cosmosdb.types.MetricDefinition(TypedDict, total=False): - key "name": ForwardRef('MetricName', module='types') - key "primaryAggregationType": Union[str, PrimaryAggregationType] - key "resourceUri": str - key "unit": Union[str, UnitType] - metricAvailabilities: list[MetricAvailability] - metric_availabilities: list[MetricAvailability] - name: MetricName - primary_aggregation_type: Union[str, PrimaryAggregationType] - resource_uri: str - unit: Union[str, UnitType] - - class azure.mgmt.cosmosdb.types.MetricName(TypedDict, total=False): - key "localizedValue": str - key "value": str - localized_value: str - value: str - - - class azure.mgmt.cosmosdb.types.MetricValue(TypedDict, total=False): - key "average": float - key "maximum": float - key "minimum": float - key "timestamp": str - key "total": float - average: float - count: int - maximum: float - minimum: float - timestamp: str - total: float + class azure.mgmt.cosmosdb.types.MergeParameters(TypedDict, total=False): + key "isDryRun": bool + isDryRun: bool class azure.mgmt.cosmosdb.types.MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): @@ -16490,67 +21862,17 @@ namespace azure.mgmt.cosmosdb.types resource: MongoDBCollectionResource - class azure.mgmt.cosmosdb.types.MongoDBCollectionGetProperties(TypedDict, total=False): - key "options": ForwardRef('MongoDBCollectionGetPropertiesOptions', module='types') - key "resource": ForwardRef('MongoDBCollectionGetPropertiesResource', module='types') - options: MongoDBCollectionGetPropertiesOptions - resource: MongoDBCollectionGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.MongoDBCollectionGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource): - key "analyticalStorageTtl": int - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - analytical_storage_ttl: int - create_mode: Union[str, CreateMode] - etag: str - id: str - indexes: list[MongoIndex] - restore_parameters: ResourceRestoreParameters - rid: str - shardKey: dict[str, str] - shard_key: dict[str, str] - ts: float - - - class azure.mgmt.cosmosdb.types.MongoDBCollectionGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('MongoDBCollectionGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: MongoDBCollectionGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.MongoDBCollectionResource(TypedDict, total=False): key "analyticalStorageTtl": int key "createMode": Union[str, CreateMode] key "id": Required[str] key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - analytical_storage_ttl: int - create_mode: Union[str, CreateMode] + analyticalStorageTtl: int + createMode: Union[str, CreateMode] id: str indexes: list[MongoIndex] - restore_parameters: ResourceRestoreParameters + restoreParameters: ResourceRestoreParameters shardKey: dict[str, str] - shard_key: dict[str, str] class azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): @@ -16576,57 +21898,13 @@ namespace azure.mgmt.cosmosdb.types resource: MongoDBDatabaseResource - class azure.mgmt.cosmosdb.types.MongoDBDatabaseGetProperties(TypedDict, total=False): - key "options": ForwardRef('MongoDBDatabaseGetPropertiesOptions', module='types') - key "resource": ForwardRef('MongoDBDatabaseGetPropertiesResource', module='types') - options: MongoDBDatabaseGetPropertiesOptions - resource: MongoDBDatabaseGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.MongoDBDatabaseGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource): - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] - etag: str - id: str - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.MongoDBDatabaseGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('MongoDBDatabaseGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: MongoDBDatabaseGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.MongoDBDatabaseResource(TypedDict, total=False): key "createMode": Union[str, CreateMode] key "id": Required[str] key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] + createMode: Union[str, CreateMode] id: str - restore_parameters: ResourceRestoreParameters + restoreParameters: ResourceRestoreParameters class azure.mgmt.cosmosdb.types.MongoIndex(TypedDict, total=False): @@ -16638,13 +21916,12 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.MongoIndexKeys(TypedDict, total=False): keys: list[str] - keys_property: list[str] class azure.mgmt.cosmosdb.types.MongoIndexOptions(TypedDict, total=False): key "expireAfterSeconds": int key "unique": bool - expire_after_seconds: int + expireAfterSeconds: int unique: bool @@ -16657,7 +21934,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: MongoMIRoleAssignmentResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -16666,748 +21943,309 @@ namespace azure.mgmt.cosmosdb.types key "provisioningState": str key "roleDefinitionId": str key "scope": str - principal_id: str - provisioning_state: str - role_definition_id: str + principalId: str + provisioningState: str + roleDefinitionId: str scope: str class azure.mgmt.cosmosdb.types.MongoMIRoleDefinitionResource(ProxyResource): key "id": str key "name": str - key "properties": ForwardRef('MongoMIRoleDefinitionResourceProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: MongoMIRoleDefinitionResourceProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.MongoMIRoleDefinitionResourceProperties(TypedDict, total=False): - key "id": str - key "roleName": str - key "type": Union[str, RoleDefinitionType] - assignableScopes: list[str] - assignable_scopes: list[str] - id: str - permissions: list[Permission] - role_name: str - type: Union[str, RoleDefinitionType] - - - class azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters(TypedDict, total=False): - key "properties": ForwardRef('MongoRoleDefinitionResource', module='types') - properties: MongoRoleDefinitionResource - - - class azure.mgmt.cosmosdb.types.MongoRoleDefinitionGetResults(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('MongoRoleDefinitionResource', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: MongoRoleDefinitionResource - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.MongoRoleDefinitionResource(TypedDict, total=False): - key "databaseName": str - key "roleName": str - key "type": Union[str, MongoRoleDefinitionType] - database_name: str - privileges: list[Privilege] - role_name: str - roles: list[Role] - type: Union[str, MongoRoleDefinitionType] - - - class azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters(TypedDict, total=False): - key "properties": ForwardRef('MongoUserDefinitionResource', module='types') - properties: MongoUserDefinitionResource - - - class azure.mgmt.cosmosdb.types.MongoUserDefinitionGetResults(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('MongoUserDefinitionResource', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: MongoUserDefinitionResource - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.MongoUserDefinitionResource(TypedDict, total=False): - key "customData": str - key "databaseName": str - key "mechanisms": str - key "password": str - key "userName": str - custom_data: str - database_name: str - mechanisms: str - password: str - roles: list[Role] - user_name: str - - - class azure.mgmt.cosmosdb.types.NotebookWorkspace(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('NotebookWorkspaceProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: NotebookWorkspaceProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.NotebookWorkspaceConnectionInfoResult(TypedDict, total=False): - key "authToken": str - key "notebookServerEndpoint": str - auth_token: str - notebook_server_endpoint: str - - - class azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): - key "id": str - key "name": str - key "type": str - id: str - name: str - type: str - - - class azure.mgmt.cosmosdb.types.NotebookWorkspaceProperties(TypedDict, total=False): - key "notebookServerEndpoint": str - key "status": str - notebook_server_endpoint: str - status: str - - - class azure.mgmt.cosmosdb.types.Operation(TypedDict, total=False): - key "display": ForwardRef('OperationDisplay', module='types') - key "name": str - display: OperationDisplay - name: str - - - class azure.mgmt.cosmosdb.types.OperationDisplay(TypedDict, total=False): - key "Description": str - key "Operation": str - key "Provider": str - key "Resource": str - description: str - operation: str - provider: str - resource: str - - - class azure.mgmt.cosmosdb.types.OptionsResource(TypedDict, total=False): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.PartitionMetric(Metric): - key "endTime": str - key "name": ForwardRef('MetricName', module='types') - key "partitionId": str - key "partitionKeyRangeId": str - key "startTime": str - key "timeGrain": str - key "unit": Union[str, UnitType] - end_time: str - metricValues: list[MetricValue] - metric_values: list[MetricValue] - name: MetricName - partition_id: str - partition_key_range_id: str - start_time: str - time_grain: str - unit: Union[str, UnitType] - - - class azure.mgmt.cosmosdb.types.PartitionUsage(Usage): - key "currentValue": int - key "limit": int - key "name": ForwardRef('MetricName', module='types') - key "partitionId": str - key "partitionKeyRangeId": str - key "quotaPeriod": str - key "unit": Union[str, UnitType] - current_value: int - limit: int - name: MetricName - partition_id: str - partition_key_range_id: str - quota_period: str - unit: Union[str, UnitType] - - - class azure.mgmt.cosmosdb.types.PercentileMetric(TypedDict, total=False): - key "endTime": str - key "name": ForwardRef('MetricName', module='types') - key "startTime": str - key "timeGrain": str - key "unit": Union[str, UnitType] - end_time: str - metricValues: list[PercentileMetricValue] - metric_values: list[PercentileMetricValue] - name: MetricName - start_time: str - time_grain: str - unit: Union[str, UnitType] - - - class azure.mgmt.cosmosdb.types.PercentileMetricValue(MetricValue): - key "P10": float - key "P25": float - key "P50": float - key "P75": float - key "P90": float - key "P95": float - key "P99": float - key "average": float - key "maximum": float - key "minimum": float - key "timestamp": str - key "total": float - average: float - count: int - maximum: float - minimum: float - p10: float - p25: float - p50: float - p75: float - p90: float - p95: float - p99: float - timestamp: str - total: float - - - class azure.mgmt.cosmosdb.types.PeriodicModeBackupPolicy(TypedDict, total=False): - key "migrationState": ForwardRef('BackupPolicyMigrationState', module='types') - key "periodicModeProperties": ForwardRef('PeriodicModeProperties', module='types') - key "type": Required[Literal[BackupPolicyType.PERIODIC]] - migration_state: BackupPolicyMigrationState - periodic_mode_properties: PeriodicModeProperties - type: Literal[BackupPolicyType.PERIODIC] - - - class azure.mgmt.cosmosdb.types.PeriodicModeProperties(TypedDict, total=False): - key "backupIntervalInMinutes": int - key "backupRetentionIntervalInHours": int - key "backupStorageRedundancy": Union[str, BackupStorageRedundancy] - backup_interval_in_minutes: int - backup_retention_interval_in_hours: int - backup_storage_redundancy: Union[str, BackupStorageRedundancy] - - - class azure.mgmt.cosmosdb.types.Permission(TypedDict, total=False): - key "id": str - dataActions: list[str] - data_actions: list[str] - id: str - notDataActions: list[str] - not_data_actions: list[str] - - - class azure.mgmt.cosmosdb.types.PrivateEndpointConnection(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('PrivateEndpointConnectionProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: PrivateEndpointConnectionProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.PrivateEndpointConnectionProperties(TypedDict, total=False): - key "groupId": str - key "privateEndpoint": ForwardRef('PrivateEndpointProperty', module='types') - key "privateLinkServiceConnectionState": ForwardRef('PrivateLinkServiceConnectionStateProperty', module='types') - key "provisioningState": str - group_id: str - private_endpoint: PrivateEndpointProperty - private_link_service_connection_state: PrivateLinkServiceConnectionStateProperty - provisioning_state: str - - - class azure.mgmt.cosmosdb.types.PrivateEndpointProperty(TypedDict, total=False): - key "id": str - id: str - - - class azure.mgmt.cosmosdb.types.PrivateLinkResource(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('PrivateLinkResourceProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: PrivateLinkResourceProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.PrivateLinkResourceProperties(TypedDict, total=False): - key "groupId": str - group_id: str - requiredMembers: list[str] - requiredZoneNames: list[str] - required_members: list[str] - required_zone_names: list[str] - - - class azure.mgmt.cosmosdb.types.PrivateLinkServiceConnectionStateProperty(TypedDict, total=False): - key "actionsRequired": str - key "description": str - key "status": str - actions_required: str - description: str - status: str - - - class azure.mgmt.cosmosdb.types.Privilege(TypedDict, total=False): - key "resource": ForwardRef('PrivilegeResource', module='types') - actions: list[str] - resource: PrivilegeResource - - - class azure.mgmt.cosmosdb.types.PrivilegeResource(TypedDict, total=False): - key "collection": str - key "db": str - collection: str - db: str - - - class azure.mgmt.cosmosdb.types.ProxyResource(Resource): - key "id": str - key "name": str - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.RegionForOnlineOffline(TypedDict, total=False): - key "region": Required[str] - region: str - - - class azure.mgmt.cosmosdb.types.RegionalServiceResource(TypedDict, total=False): - key "location": str - key "name": str - key "status": Union[str, ServiceStatus] - location: str - name: str - status: Union[str, ServiceStatus] - - - class azure.mgmt.cosmosdb.types.Resource(TypedDict, total=False): - key "id": str - key "name": str - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.ResourceRestoreParameters(RestoreParametersBase): - key "restoreSource": str - key "restoreTimestampInUtc": str - key "restoreWithTtlDisabled": bool - restore_source: str - restore_timestamp_in_utc: str - restore_with_ttl_disabled: bool - - - class azure.mgmt.cosmosdb.types.RestorableDatabaseAccountGetResult(ProxyResource): - key "id": str - key "location": str - key "name": str - key "properties": ForwardRef('RestorableDatabaseAccountProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - location: str - name: str - properties: RestorableDatabaseAccountProperties - system_data: SystemData - type: str - - - class azure.mgmt.cosmosdb.types.RestorableDatabaseAccountProperties(TypedDict, total=False): - key "accountName": str - key "apiType": Union[str, ApiType] - key "creationTime": str - key "deletionTime": str - key "oldestRestorableTime": str - account_name: str - api_type: Union[str, ApiType] - creation_time: str - deletion_time: str - oldest_restorable_time: str - restorableLocations: list[RestorableLocationResource] - restorable_locations: list[RestorableLocationResource] - - - class azure.mgmt.cosmosdb.types.RestorableGremlinDatabaseGetResult(TypedDict, total=False): - key "id": str - key "name": str - key "properties": ForwardRef('RestorableGremlinDatabaseProperties', module='types') - key "type": str - id: str - name: str - properties: RestorableGremlinDatabaseProperties - type: str - - - class azure.mgmt.cosmosdb.types.RestorableGremlinDatabaseProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableGremlinDatabasePropertiesResource', module='types') - resource: RestorableGremlinDatabasePropertiesResource - - - class azure.mgmt.cosmosdb.types.RestorableGremlinDatabasePropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str - - - class azure.mgmt.cosmosdb.types.RestorableGremlinGraphGetResult(TypedDict, total=False): - key "id": str - key "name": str - key "properties": ForwardRef('RestorableGremlinGraphProperties', module='types') + key "properties": ForwardRef('MongoMIRoleDefinitionResourceProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') key "type": str id: str name: str - properties: RestorableGremlinGraphProperties + properties: MongoMIRoleDefinitionResourceProperties + systemData: SystemData type: str - class azure.mgmt.cosmosdb.types.RestorableGremlinGraphProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableGremlinGraphPropertiesResource', module='types') - resource: RestorableGremlinGraphPropertiesResource + class azure.mgmt.cosmosdb.types.MongoMIRoleDefinitionResourceProperties(TypedDict, total=False): + key "id": str + key "roleName": str + key "type": Union[str, RoleDefinitionType] + assignableScopes: list[str] + id: str + permissions: list[Permission] + roleName: str + type: Union[str, RoleDefinitionType] + + + class azure.mgmt.cosmosdb.types.MongoRUToMongoRUCopyJobProperties(TypedDict, total=False): + key "destinationDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "jobType": Required[Literal[CopyJobType.MONGO_RU_TO_MONGO_RU]] + key "sourceDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "tasks": Required[list[MongoRUToMongoRUCopyJobTask]] + destinationDetails: CosmosDBSourceSinkDetails + jobType: Literal[CopyJobType.MONGO_RU_TO_MONGO_RU] + sourceDetails: CosmosDBSourceSinkDetails + tasks: list[MongoRUToMongoRUCopyJobTask] + + + class azure.mgmt.cosmosdb.types.MongoRUToMongoRUCopyJobTask(BaseCopyJobTask): + key "destination": Required[CosmosDBMongoCollection] + key "processedCount": int + key "source": Required[CosmosDBMongoCollection] + key "totalCount": int + destination: CosmosDBMongoCollection + processedCount: int + source: CosmosDBMongoCollection + totalCount: int + + + class azure.mgmt.cosmosdb.types.MongoRUToMongoVCoreCopyJobProperties(TypedDict, total=False): + key "destinationDetails": Required[MongoVCoreSourceSinkDetails] + key "jobType": Required[Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE]] + key "sourceDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "tasks": Required[list[MongoRUToMongoVCoreCopyJobTask]] + destinationDetails: MongoVCoreSourceSinkDetails + jobType: Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE] + sourceDetails: CosmosDBSourceSinkDetails + tasks: list[MongoRUToMongoVCoreCopyJobTask] + + + class azure.mgmt.cosmosdb.types.MongoRUToMongoVCoreCopyJobTask(BaseCopyJobTask): + key "destination": Required[CosmosDBMongoVCoreCollection] + key "processedCount": int + key "source": Required[CosmosDBMongoCollection] + key "totalCount": int + destination: CosmosDBMongoVCoreCollection + processedCount: int + source: CosmosDBMongoCollection + totalCount: int - class azure.mgmt.cosmosdb.types.RestorableGremlinGraphPropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str + class azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters(TypedDict, total=False): + key "properties": ForwardRef('MongoRoleDefinitionResource', module='types') + properties: MongoRoleDefinitionResource - class azure.mgmt.cosmosdb.types.RestorableGremlinResourcesGetResult(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.MongoRoleDefinitionResource(TypedDict, total=False): key "databaseName": str - key "id": str - key "name": str - key "type": str - database_name: str - graphNames: list[str] - graph_names: list[str] - id: str - name: str - type: str + key "roleName": str + key "type": Union[str, MongoRoleDefinitionType] + databaseName: str + privileges: list[Privilege] + roleName: str + roles: list[Role] + type: Union[str, MongoRoleDefinitionType] - class azure.mgmt.cosmosdb.types.RestorableLocationResource(TypedDict, total=False): - key "creationTime": str - key "deletionTime": str - key "locationName": str - key "regionalDatabaseAccountInstanceId": str - creation_time: str - deletion_time: str - location_name: str - regional_database_account_instance_id: str + class azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters(TypedDict, total=False): + key "properties": ForwardRef('MongoUserDefinitionResource', module='types') + properties: MongoUserDefinitionResource - class azure.mgmt.cosmosdb.types.RestorableMongodbCollectionGetResult(TypedDict, total=False): - key "id": str - key "name": str - key "properties": ForwardRef('RestorableMongodbCollectionProperties', module='types') - key "type": str - id: str - name: str - properties: RestorableMongodbCollectionProperties - type: str + class azure.mgmt.cosmosdb.types.MongoUserDefinitionResource(TypedDict, total=False): + key "customData": str + key "databaseName": str + key "mechanisms": str + key "password": str + key "userName": str + customData: str + databaseName: str + mechanisms: str + password: str + roles: list[Role] + userName: str + + class azure.mgmt.cosmosdb.types.MongoVCoreSourceSinkDetails(TypedDict, total=False): + key "connectionStringKeyVaultUri": str + key "hostName": str + connectionStringKeyVaultUri: str + hostName: str - class azure.mgmt.cosmosdb.types.RestorableMongodbCollectionProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableMongodbCollectionPropertiesResource', module='types') - resource: RestorableMongodbCollectionPropertiesResource + class azure.mgmt.cosmosdb.types.NoSqlRUToNoSqlRUCopyJobProperties(TypedDict, total=False): + key "destinationDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "jobType": Required[Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU]] + key "sourceDetails": ForwardRef('CosmosDBSourceSinkDetails', module='types') + key "tasks": Required[list[NoSqlRUToNoSqlRUCopyJobTask]] + destinationDetails: CosmosDBSourceSinkDetails + jobType: Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU] + sourceDetails: CosmosDBSourceSinkDetails + tasks: list[NoSqlRUToNoSqlRUCopyJobTask] - class azure.mgmt.cosmosdb.types.RestorableMongodbCollectionPropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str + class azure.mgmt.cosmosdb.types.NoSqlRUToNoSqlRUCopyJobTask(BaseCopyJobTask): + key "destination": Required[CosmosDBNoSqlContainer] + key "processedCount": int + key "source": Required[CosmosDBNoSqlContainer] + key "totalCount": int + destination: CosmosDBNoSqlContainer + processedCount: int + source: CosmosDBNoSqlContainer + totalCount: int - class azure.mgmt.cosmosdb.types.RestorableMongodbDatabaseGetResult(TypedDict, total=False): + + class azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): key "id": str key "name": str - key "properties": ForwardRef('RestorableMongodbDatabaseProperties', module='types') key "type": str id: str name: str - properties: RestorableMongodbDatabaseProperties type: str - class azure.mgmt.cosmosdb.types.RestorableMongodbDatabaseProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableMongodbDatabasePropertiesResource', module='types') - resource: RestorableMongodbDatabasePropertiesResource + class azure.mgmt.cosmosdb.types.PeriodicModeBackupPolicy(TypedDict, total=False): + key "migrationState": ForwardRef('BackupPolicyMigrationState', module='types') + key "periodicModeProperties": ForwardRef('PeriodicModeProperties', module='types') + key "type": Required[Literal[BackupPolicyType.PERIODIC]] + migrationState: BackupPolicyMigrationState + periodicModeProperties: PeriodicModeProperties + type: Literal[BackupPolicyType.PERIODIC] - class azure.mgmt.cosmosdb.types.RestorableMongodbDatabasePropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str + class azure.mgmt.cosmosdb.types.PeriodicModeProperties(TypedDict, total=False): + key "backupIntervalInMinutes": int + key "backupRetentionIntervalInHours": int + key "backupStorageRedundancy": Union[str, BackupStorageRedundancy] + backupIntervalInMinutes: int + backupRetentionIntervalInHours: int + backupStorageRedundancy: Union[str, BackupStorageRedundancy] - class azure.mgmt.cosmosdb.types.RestorableMongodbResourcesGetResult(TypedDict, total=False): - key "databaseName": str + class azure.mgmt.cosmosdb.types.Permission(TypedDict, total=False): key "id": str - key "name": str - key "type": str - collectionNames: list[str] - collection_names: list[str] - database_name: str + dataActions: list[str] id: str - name: str - type: str + notDataActions: list[str] - class azure.mgmt.cosmosdb.types.RestorableSqlContainerGetResult(TypedDict, total=False): - key "id": str - key "name": str - key "properties": ForwardRef('RestorableSqlContainerProperties', module='types') - key "type": str + class azure.mgmt.cosmosdb.types.PhysicalPartitionId(TypedDict, total=False): + key "id": Required[str] id: str - name: str - properties: RestorableSqlContainerProperties - type: str - - - class azure.mgmt.cosmosdb.types.RestorableSqlContainerProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableSqlContainerPropertiesResource', module='types') - resource: RestorableSqlContainerPropertiesResource - - class azure.mgmt.cosmosdb.types.RestorableSqlContainerPropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "container": ForwardRef('RestorableSqlContainerPropertiesResourceContainer', module='types') - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - container: RestorableSqlContainerPropertiesResourceContainer - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str - - class azure.mgmt.cosmosdb.types.RestorableSqlContainerPropertiesResourceContainer(SqlContainerResource): - key "analyticalStorageTtl": int - key "clientEncryptionPolicy": ForwardRef('ClientEncryptionPolicy', module='types') - key "conflictResolutionPolicy": ForwardRef('ConflictResolutionPolicy', module='types') - key "createMode": Union[str, CreateMode] - key "defaultTtl": int - key "fullTextPolicy": ForwardRef('FullTextPolicy', module='types') + class azure.mgmt.cosmosdb.types.PhysicalPartitionThroughputInfoResource(TypedDict, total=False): key "id": Required[str] - key "indexingPolicy": ForwardRef('IndexingPolicy', module='types') - key "partitionKey": ForwardRef('ContainerPartitionKey', module='types') - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - key "uniqueKeyPolicy": ForwardRef('UniqueKeyPolicy', module='types') - key "vectorEmbeddingPolicy": ForwardRef('VectorEmbeddingPolicy', module='types') - analytical_storage_ttl: int - client_encryption_policy: ClientEncryptionPolicy - computedProperties: list[ComputedProperty] - computed_properties: list[ComputedProperty] - conflict_resolution_policy: ConflictResolutionPolicy - create_mode: Union[str, CreateMode] - default_ttl: int - etag: str - full_text_policy: FullTextPolicy + key "targetThroughput": float + key "throughput": float id: str - indexing_policy: IndexingPolicy - partition_key: ContainerPartitionKey - restore_parameters: ResourceRestoreParameters - rid: str - self_property: str - ts: float - unique_key_policy: UniqueKeyPolicy - vector_embedding_policy: VectorEmbeddingPolicy + targetThroughput: float + throughput: float - class azure.mgmt.cosmosdb.types.RestorableSqlDatabaseGetResult(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.PrivateEndpointConnection(ProxyResource): key "id": str key "name": str - key "properties": ForwardRef('RestorableSqlDatabaseProperties', module='types') + key "properties": ForwardRef('PrivateEndpointConnectionProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') key "type": str id: str name: str - properties: RestorableSqlDatabaseProperties + properties: PrivateEndpointConnectionProperties + systemData: SystemData type: str - class azure.mgmt.cosmosdb.types.RestorableSqlDatabaseProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableSqlDatabasePropertiesResource', module='types') - resource: RestorableSqlDatabasePropertiesResource + class azure.mgmt.cosmosdb.types.PrivateEndpointConnectionProperties(TypedDict, total=False): + key "groupId": str + key "privateEndpoint": ForwardRef('PrivateEndpointProperty', module='types') + key "privateLinkServiceConnectionState": ForwardRef('PrivateLinkServiceConnectionStateProperty', module='types') + key "provisioningState": str + groupId: str + privateEndpoint: PrivateEndpointProperty + privateLinkServiceConnectionState: PrivateLinkServiceConnectionStateProperty + provisioningState: str - class azure.mgmt.cosmosdb.types.RestorableSqlDatabasePropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "database": ForwardRef('RestorableSqlDatabasePropertiesResourceDatabase', module='types') - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - database: RestorableSqlDatabasePropertiesResourceDatabase - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str + class azure.mgmt.cosmosdb.types.PrivateEndpointProperty(TypedDict, total=False): + key "id": str + id: str - class azure.mgmt.cosmosdb.types.RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource): - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - colls: str - create_mode: Union[str, CreateMode] - etag: str - id: str - restore_parameters: ResourceRestoreParameters - rid: str - self_property: str - ts: float - users: str + class azure.mgmt.cosmosdb.types.PrivateLinkServiceConnectionStateProperty(TypedDict, total=False): + key "actionsRequired": str + key "description": str + key "status": str + actionsRequired: str + description: str + status: str - class azure.mgmt.cosmosdb.types.RestorableSqlResourcesGetResult(TypedDict, total=False): - key "databaseName": str + class azure.mgmt.cosmosdb.types.Privilege(TypedDict, total=False): + key "resource": ForwardRef('PrivilegeResource', module='types') + actions: list[str] + resource: PrivilegeResource + + + class azure.mgmt.cosmosdb.types.PrivilegeResource(TypedDict, total=False): + key "collection": str + key "db": str + collection: str + db: str + + + class azure.mgmt.cosmosdb.types.ProxyResource(Resource): key "id": str key "name": str + key "systemData": ForwardRef('SystemData', module='types') key "type": str - collectionNames: list[str] - collection_names: list[str] - database_name: str id: str name: str + systemData: SystemData type: str - class azure.mgmt.cosmosdb.types.RestorableTableGetResult(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.RedistributeThroughputParameters(ARMResourceProperties): key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": str key "name": str - key "properties": ForwardRef('RestorableTableProperties', module='types') + key "properties": Required[RedistributeThroughputProperties] key "type": str id: str + identity: ManagedServiceIdentity + location: str name: str - properties: RestorableTableProperties + properties: RedistributeThroughputProperties + tags: dict[str, str] type: str - class azure.mgmt.cosmosdb.types.RestorableTableProperties(TypedDict, total=False): - key "resource": ForwardRef('RestorableTablePropertiesResource', module='types') - resource: RestorableTablePropertiesResource + class azure.mgmt.cosmosdb.types.RedistributeThroughputProperties(TypedDict, total=False): + key "resource": Required[RedistributeThroughputPropertiesResource] + resource: RedistributeThroughputPropertiesResource - class azure.mgmt.cosmosdb.types.RestorableTablePropertiesResource(TypedDict, total=False): - key "canUndelete": str - key "canUndeleteReason": str - key "eventTimestamp": str - key "operationType": Union[str, OperationType] - key "ownerId": str - key "ownerResourceId": str - can_undelete: str - can_undelete_reason: str - event_timestamp: str - operation_type: Union[str, OperationType] - owner_id: str - owner_resource_id: str - rid: str + class azure.mgmt.cosmosdb.types.RedistributeThroughputPropertiesResource(TypedDict, total=False): + key "sourcePhysicalPartitionThroughputInfo": Required[list[PhysicalPartitionThroughputInfoResource]] + key "targetPhysicalPartitionThroughputInfo": Required[list[PhysicalPartitionThroughputInfoResource]] + key "throughputPolicy": Required[Union[str, ThroughputPolicyType]] + sourcePhysicalPartitionThroughputInfo: list[PhysicalPartitionThroughputInfoResource] + targetPhysicalPartitionThroughputInfo: list[PhysicalPartitionThroughputInfoResource] + throughputPolicy: Union[str, ThroughputPolicyType] - class azure.mgmt.cosmosdb.types.RestorableTableResourcesGetResult(TypedDict, total=False): + class azure.mgmt.cosmosdb.types.RegionForOnlineOffline(TypedDict, total=False): + key "region": Required[str] + region: str + + + class azure.mgmt.cosmosdb.types.Resource(TypedDict, total=False): key "id": str key "name": str + key "systemData": ForwardRef('SystemData', module='types') key "type": str id: str name: str + systemData: SystemData type: str + class azure.mgmt.cosmosdb.types.ResourceRestoreParameters(RestoreParametersBase): + key "restoreSource": str + key "restoreTimestampInUtc": str + key "restoreWithTtlDisabled": bool + restoreSource: str + restoreTimestampInUtc: str + restoreWithTtlDisabled: bool + + class azure.mgmt.cosmosdb.types.RestoreParameters(RestoreParametersBase): key "restoreMode": Union[str, RestoreMode] key "restoreSource": str @@ -17415,25 +22253,48 @@ namespace azure.mgmt.cosmosdb.types key "restoreWithTtlDisabled": bool key "sourceBackupLocation": str databasesToRestore: list[DatabaseRestoreResource] - databases_to_restore: list[DatabaseRestoreResource] gremlinDatabasesToRestore: list[GremlinDatabaseRestoreResource] - gremlin_databases_to_restore: list[GremlinDatabaseRestoreResource] - restore_mode: Union[str, RestoreMode] - restore_source: str - restore_timestamp_in_utc: str - restore_with_ttl_disabled: bool - source_backup_location: str + restoreMode: Union[str, RestoreMode] + restoreSource: str + restoreTimestampInUtc: str + restoreWithTtlDisabled: bool + sourceBackupLocation: str tablesToRestore: list[str] - tables_to_restore: list[str] class azure.mgmt.cosmosdb.types.RestoreParametersBase(TypedDict, total=False): key "restoreSource": str key "restoreTimestampInUtc": str key "restoreWithTtlDisabled": bool - restore_source: str - restore_timestamp_in_utc: str - restore_with_ttl_disabled: bool + restoreSource: str + restoreTimestampInUtc: str + restoreWithTtlDisabled: bool + + + class azure.mgmt.cosmosdb.types.RetrieveThroughputParameters(ARMResourceProperties): + key "id": str + key "identity": ForwardRef('ManagedServiceIdentity', module='types') + key "location": str + key "name": str + key "properties": Required[RetrieveThroughputProperties] + key "type": str + id: str + identity: ManagedServiceIdentity + location: str + name: str + properties: RetrieveThroughputProperties + tags: dict[str, str] + type: str + + + class azure.mgmt.cosmosdb.types.RetrieveThroughputProperties(TypedDict, total=False): + key "resource": Required[RetrieveThroughputPropertiesResource] + resource: RetrieveThroughputPropertiesResource + + + class azure.mgmt.cosmosdb.types.RetrieveThroughputPropertiesResource(TypedDict, total=False): + key "physicalPartitionIds": Required[list[PhysicalPartitionId]] + physicalPartitionIds: list[PhysicalPartitionId] class azure.mgmt.cosmosdb.types.Role(TypedDict, total=False): @@ -17445,20 +22306,7 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.SeedNode(TypedDict, total=False): key "ipAddress": str - ip_address: str - - - class azure.mgmt.cosmosdb.types.ServiceResource(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('ServiceResourceProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: ServiceResourceProperties - system_data: SystemData - type: str + ipAddress: str class azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters(TypedDict, total=False): @@ -17473,6 +22321,15 @@ namespace azure.mgmt.cosmosdb.types SQL_DEDICATED_GATEWAY = "SqlDedicatedGateway" + class azure.mgmt.cosmosdb.types.SoftDeleteConfiguration(TypedDict, total=False): + key "minMinutesBeforePermanentDeletionAllowed": int + key "softDeleteRetentionPeriodInMinutes": int + key "softDeletionEnabled": bool + minMinutesBeforePermanentDeletionAllowed: int + softDeleteRetentionPeriodInMinutes: int + softDeletionEnabled: bool + + class azure.mgmt.cosmosdb.types.SpatialSpec(TypedDict, total=False): key "path": str path: str @@ -17490,109 +22347,51 @@ namespace azure.mgmt.cosmosdb.types identity: ManagedServiceIdentity location: str name: str - properties: SqlContainerCreateUpdateProperties - tags: dict[str, str] - type: str - - - class azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateProperties(TypedDict, total=False): - key "options": ForwardRef('CreateUpdateOptions', module='types') - key "resource": Required[SqlContainerResource] - options: CreateUpdateOptions - resource: SqlContainerResource - - - class azure.mgmt.cosmosdb.types.SqlContainerGetProperties(TypedDict, total=False): - key "options": ForwardRef('SqlContainerGetPropertiesOptions', module='types') - key "resource": ForwardRef('SqlContainerGetPropertiesResource', module='types') - options: SqlContainerGetPropertiesOptions - resource: SqlContainerGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.SqlContainerGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.SqlContainerGetPropertiesResource(SqlContainerResource): - key "analyticalStorageTtl": int - key "clientEncryptionPolicy": ForwardRef('ClientEncryptionPolicy', module='types') - key "conflictResolutionPolicy": ForwardRef('ConflictResolutionPolicy', module='types') - key "createMode": Union[str, CreateMode] - key "defaultTtl": int - key "fullTextPolicy": ForwardRef('FullTextPolicy', module='types') - key "id": Required[str] - key "indexingPolicy": ForwardRef('IndexingPolicy', module='types') - key "partitionKey": ForwardRef('ContainerPartitionKey', module='types') - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - key "uniqueKeyPolicy": ForwardRef('UniqueKeyPolicy', module='types') - key "vectorEmbeddingPolicy": ForwardRef('VectorEmbeddingPolicy', module='types') - analytical_storage_ttl: int - client_encryption_policy: ClientEncryptionPolicy - computedProperties: list[ComputedProperty] - computed_properties: list[ComputedProperty] - conflict_resolution_policy: ConflictResolutionPolicy - create_mode: Union[str, CreateMode] - default_ttl: int - etag: str - full_text_policy: FullTextPolicy - id: str - indexing_policy: IndexingPolicy - partition_key: ContainerPartitionKey - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - unique_key_policy: UniqueKeyPolicy - vector_embedding_policy: VectorEmbeddingPolicy - - - class azure.mgmt.cosmosdb.types.SqlContainerGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('SqlContainerGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: SqlContainerGetProperties - system_data: SystemData + properties: SqlContainerCreateUpdateProperties tags: dict[str, str] type: str + class azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateProperties(TypedDict, total=False): + key "options": ForwardRef('CreateUpdateOptions', module='types') + key "resource": Required[SqlContainerResource] + options: CreateUpdateOptions + resource: SqlContainerResource + + class azure.mgmt.cosmosdb.types.SqlContainerResource(TypedDict, total=False): key "analyticalStorageTtl": int key "clientEncryptionPolicy": ForwardRef('ClientEncryptionPolicy', module='types') key "conflictResolutionPolicy": ForwardRef('ConflictResolutionPolicy', module='types') key "createMode": Union[str, CreateMode] + key "dataMaskingPolicy": ForwardRef('DataMaskingPolicy', module='types') key "defaultTtl": int key "fullTextPolicy": ForwardRef('FullTextPolicy', module='types') key "id": Required[str] key "indexingPolicy": ForwardRef('IndexingPolicy', module='types') + key "materializedViewDefinition": ForwardRef('MaterializedViewDefinition', module='types') + key "materializedViewsProperties": ForwardRef('MaterializedViewsProperties', module='types') key "partitionKey": ForwardRef('ContainerPartitionKey', module='types') key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') key "uniqueKeyPolicy": ForwardRef('UniqueKeyPolicy', module='types') key "vectorEmbeddingPolicy": ForwardRef('VectorEmbeddingPolicy', module='types') - analytical_storage_ttl: int - client_encryption_policy: ClientEncryptionPolicy + analyticalStorageTtl: int + clientEncryptionPolicy: ClientEncryptionPolicy computedProperties: list[ComputedProperty] - computed_properties: list[ComputedProperty] - conflict_resolution_policy: ConflictResolutionPolicy - create_mode: Union[str, CreateMode] - default_ttl: int - full_text_policy: FullTextPolicy + conflictResolutionPolicy: ConflictResolutionPolicy + createMode: Union[str, CreateMode] + dataMaskingPolicy: DataMaskingPolicy + defaultTtl: int + fullTextPolicy: FullTextPolicy id: str - indexing_policy: IndexingPolicy - partition_key: ContainerPartitionKey - restore_parameters: ResourceRestoreParameters - unique_key_policy: UniqueKeyPolicy - vector_embedding_policy: VectorEmbeddingPolicy + indexingPolicy: IndexingPolicy + materializedViewDefinition: MaterializedViewDefinition + materializedViews: list[MaterializedViewDetails] + materializedViewsProperties: MaterializedViewsProperties + partitionKey: ContainerPartitionKey + restoreParameters: ResourceRestoreParameters + uniqueKeyPolicy: UniqueKeyPolicy + vectorEmbeddingPolicy: VectorEmbeddingPolicy class azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters(ARMResourceProperties): @@ -17618,70 +22417,13 @@ namespace azure.mgmt.cosmosdb.types resource: SqlDatabaseResource - class azure.mgmt.cosmosdb.types.SqlDatabaseGetProperties(TypedDict, total=False): - key "options": ForwardRef('SqlDatabaseGetPropertiesOptions', module='types') - key "resource": ForwardRef('SqlDatabaseGetPropertiesResource', module='types') - options: SqlDatabaseGetPropertiesOptions - resource: SqlDatabaseGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.SqlDatabaseGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.SqlDatabaseGetPropertiesResource(SqlDatabaseResource): - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - colls: str - create_mode: Union[str, CreateMode] - etag: str - id: str - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - users: str - - - class azure.mgmt.cosmosdb.types.SqlDatabaseGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('SqlDatabaseGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: SqlDatabaseGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.SqlDatabaseResource(TypedDict, total=False): key "createMode": Union[str, CreateMode] key "id": Required[str] key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] + createMode: Union[str, CreateMode] id: str - restore_parameters: ResourceRestoreParameters - - - class azure.mgmt.cosmosdb.types.SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): - key "location": str - key "name": str - key "sqlDedicatedGatewayEndpoint": str - key "status": Union[str, ServiceStatus] - location: str - name: str - sql_dedicated_gateway_endpoint: str - status: Union[str, ServiceStatus] + restoreParameters: ResourceRestoreParameters class azure.mgmt.cosmosdb.types.SqlDedicatedGatewayServiceResourceCreateUpdateProperties(TypedDict, total=False): @@ -17689,28 +22431,10 @@ namespace azure.mgmt.cosmosdb.types key "instanceCount": int key "instanceSize": Union[str, ServiceSize] key "serviceType": Required[Literal[ServiceType.SQL_DEDICATED_GATEWAY]] - dedicated_gateway_type: Union[str, DedicatedGatewayType] - instance_count: int - instance_size: Union[str, ServiceSize] - service_type: Literal[ServiceType.SQL_DEDICATED_GATEWAY] - - - class azure.mgmt.cosmosdb.types.SqlDedicatedGatewayServiceResourceProperties(TypedDict, total=False): - key "creationTime": str - key "dedicatedGatewayType": Union[str, DedicatedGatewayType] - key "instanceCount": int - key "instanceSize": Union[str, ServiceSize] - key "serviceType": Required[Literal[ServiceType.SQL_DEDICATED_GATEWAY]] - key "sqlDedicatedGatewayEndpoint": str - key "status": Union[str, ServiceStatus] - creation_time: str - dedicated_gateway_type: Union[str, DedicatedGatewayType] - instance_count: int - instance_size: Union[str, ServiceSize] - locations: list[SqlDedicatedGatewayRegionalServiceResource] - service_type: Literal[ServiceType.SQL_DEDICATED_GATEWAY] - sql_dedicated_gateway_endpoint: str - status: Union[str, ServiceStatus] + dedicatedGatewayType: Union[str, DedicatedGatewayType] + instanceCount: int + instanceSize: Union[str, ServiceSize] + serviceType: Literal[ServiceType.SQL_DEDICATED_GATEWAY] class azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters(TypedDict, total=False): @@ -17718,25 +22442,12 @@ namespace azure.mgmt.cosmosdb.types properties: SqlRoleAssignmentResource - class azure.mgmt.cosmosdb.types.SqlRoleAssignmentGetResults(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('SqlRoleAssignmentResource', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: SqlRoleAssignmentResource - system_data: SystemData - type: str - - class azure.mgmt.cosmosdb.types.SqlRoleAssignmentResource(TypedDict, total=False): key "principalId": str key "roleDefinitionId": str key "scope": str - principal_id: str - role_definition_id: str + principalId: str + roleDefinitionId: str scope: str @@ -17745,26 +22456,12 @@ namespace azure.mgmt.cosmosdb.types properties: SqlRoleDefinitionResource - class azure.mgmt.cosmosdb.types.SqlRoleDefinitionGetResults(ProxyResource): - key "id": str - key "name": str - key "properties": ForwardRef('SqlRoleDefinitionResource', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - name: str - properties: SqlRoleDefinitionResource - system_data: SystemData - type: str - - class azure.mgmt.cosmosdb.types.SqlRoleDefinitionResource(TypedDict, total=False): key "roleName": str key "type": Union[str, RoleDefinitionType] assignableScopes: list[str] - assignable_scopes: list[str] permissions: list[Permission] - role_name: str + roleName: str type: Union[str, RoleDefinitionType] @@ -17791,39 +22488,6 @@ namespace azure.mgmt.cosmosdb.types resource: SqlStoredProcedureResource - class azure.mgmt.cosmosdb.types.SqlStoredProcedureGetProperties(TypedDict, total=False): - key "resource": ForwardRef('SqlStoredProcedureGetPropertiesResource', module='types') - resource: SqlStoredProcedureGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource): - key "body": str - key "id": Required[str] - body: str - etag: str - id: str - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.SqlStoredProcedureGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('SqlStoredProcedureGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: SqlStoredProcedureGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.SqlStoredProcedureResource(TypedDict, total=False): key "body": str key "id": Required[str] @@ -17854,43 +22518,6 @@ namespace azure.mgmt.cosmosdb.types resource: SqlTriggerResource - class azure.mgmt.cosmosdb.types.SqlTriggerGetProperties(TypedDict, total=False): - key "resource": ForwardRef('SqlTriggerGetPropertiesResource', module='types') - resource: SqlTriggerGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.SqlTriggerGetPropertiesResource(SqlTriggerResource): - key "body": str - key "id": Required[str] - key "triggerOperation": Union[str, TriggerOperation] - key "triggerType": Union[str, TriggerType] - body: str - etag: str - id: str - rid: str - trigger_operation: Union[str, TriggerOperation] - trigger_type: Union[str, TriggerType] - ts: float - - - class azure.mgmt.cosmosdb.types.SqlTriggerGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('SqlTriggerGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: SqlTriggerGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.SqlTriggerResource(TypedDict, total=False): key "body": str key "id": Required[str] @@ -17898,8 +22525,8 @@ namespace azure.mgmt.cosmosdb.types key "triggerType": Union[str, TriggerType] body: str id: str - trigger_operation: Union[str, TriggerOperation] - trigger_type: Union[str, TriggerType] + triggerOperation: Union[str, TriggerOperation] + triggerType: Union[str, TriggerType] class azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): @@ -17925,39 +22552,6 @@ namespace azure.mgmt.cosmosdb.types resource: SqlUserDefinedFunctionResource - class azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionGetProperties(TypedDict, total=False): - key "resource": ForwardRef('SqlUserDefinedFunctionGetPropertiesResource', module='types') - resource: SqlUserDefinedFunctionGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionGetPropertiesResource(SqlUserDefinedFunctionResource): - key "body": str - key "id": Required[str] - body: str - etag: str - id: str - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('SqlUserDefinedFunctionGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: SqlUserDefinedFunctionGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionResource(TypedDict, total=False): key "body": str key "id": Required[str] @@ -17972,12 +22566,12 @@ namespace azure.mgmt.cosmosdb.types key "lastModifiedAt": str key "lastModifiedBy": str key "lastModifiedByType": Union[str, CreatedByType] - created_at: str - created_by: str - created_by_type: Union[str, CreatedByType] - last_modified_at: str - last_modified_by: str - last_modified_by_type: Union[str, CreatedByType] + createdAt: str + createdBy: str + createdByType: Union[str, CreatedByType] + lastModifiedAt: str + lastModifiedBy: str + lastModifiedByType: Union[str, CreatedByType] class azure.mgmt.cosmosdb.types.TableCreateUpdateParameters(ARMResourceProperties): @@ -18003,57 +22597,13 @@ namespace azure.mgmt.cosmosdb.types resource: TableResource - class azure.mgmt.cosmosdb.types.TableGetProperties(TypedDict, total=False): - key "options": ForwardRef('TableGetPropertiesOptions', module='types') - key "resource": ForwardRef('TableGetPropertiesResource', module='types') - options: TableGetPropertiesOptions - resource: TableGetPropertiesResource - - - class azure.mgmt.cosmosdb.types.TableGetPropertiesOptions(OptionsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettings', module='types') - key "throughput": int - autoscale_settings: AutoscaleSettings - throughput: int - - - class azure.mgmt.cosmosdb.types.TableGetPropertiesResource(TableResource): - key "createMode": Union[str, CreateMode] - key "id": Required[str] - key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] - etag: str - id: str - restore_parameters: ResourceRestoreParameters - rid: str - ts: float - - - class azure.mgmt.cosmosdb.types.TableGetResults(ProxyResource): - key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str - key "name": str - key "properties": ForwardRef('TableGetProperties', module='types') - key "systemData": ForwardRef('SystemData', module='types') - key "type": str - id: str - identity: ManagedServiceIdentity - location: str - name: str - properties: TableGetProperties - system_data: SystemData - tags: dict[str, str] - type: str - - class azure.mgmt.cosmosdb.types.TableResource(TypedDict, total=False): key "createMode": Union[str, CreateMode] key "id": Required[str] key "restoreParameters": ForwardRef('ResourceRestoreParameters', module='types') - create_mode: Union[str, CreateMode] + createMode: Union[str, CreateMode] id: str - restore_parameters: ResourceRestoreParameters + restoreParameters: ResourceRestoreParameters class azure.mgmt.cosmosdb.types.TableRoleAssignmentResource(ProxyResource): @@ -18065,7 +22615,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: TableRoleAssignmentResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -18074,9 +22624,9 @@ namespace azure.mgmt.cosmosdb.types key "provisioningState": str key "roleDefinitionId": str key "scope": str - principal_id: str - provisioning_state: str - role_definition_id: str + principalId: str + provisioningState: str + roleDefinitionId: str scope: str @@ -18089,7 +22639,7 @@ namespace azure.mgmt.cosmosdb.types id: str name: str properties: TableRoleDefinitionResourceProperties - system_data: SystemData + systemData: SystemData type: str @@ -18098,61 +22648,80 @@ namespace azure.mgmt.cosmosdb.types key "roleName": str key "type": Union[str, RoleDefinitionType] assignableScopes: list[str] - assignable_scopes: list[str] id: str permissions: list[Permission] - role_name: str + roleName: str type: Union[str, RoleDefinitionType] + class azure.mgmt.cosmosdb.types.ThroughputBucketResource(TypedDict, total=False): + key "id": Required[int] + key "isDefaultBucket": bool + key "maxThroughputPercentage": Required[int] + id: int + isDefaultBucket: bool + maxThroughputPercentage: int + + class azure.mgmt.cosmosdb.types.ThroughputPolicyResource(TypedDict, total=False): key "incrementPercent": int key "isEnabled": bool - increment_percent: int - is_enabled: bool + incrementPercent: int + isEnabled: bool - class azure.mgmt.cosmosdb.types.ThroughputSettingsGetProperties(TypedDict, total=False): - key "resource": ForwardRef('ThroughputSettingsGetPropertiesResource', module='types') - resource: ThroughputSettingsGetPropertiesResource + class azure.mgmt.cosmosdb.types.ThroughputPoolAccountProperties(TypedDict, total=False): + key "accountInstanceId": str + key "accountLocation": str + key "accountResourceIdentifier": str + key "provisioningState": Union[str, Status] + accountInstanceId: str + accountLocation: str + accountResourceIdentifier: str + provisioningState: Union[str, Status] - class azure.mgmt.cosmosdb.types.ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): - key "autoscaleSettings": ForwardRef('AutoscaleSettingsResource', module='types') - key "instantMaximumThroughput": str - key "minimumThroughput": str - key "offerReplacePending": str - key "softAllowedMaximumThroughput": str - key "throughput": int - autoscale_settings: AutoscaleSettingsResource - etag: str - instant_maximum_throughput: str - minimum_throughput: str - offer_replace_pending: str - rid: str - soft_allowed_maximum_throughput: str - throughput: int - ts: float + class azure.mgmt.cosmosdb.types.ThroughputPoolAccountResource(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ThroughputPoolAccountProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ThroughputPoolAccountProperties + systemData: SystemData + type: str + + + class azure.mgmt.cosmosdb.types.ThroughputPoolProperties(TypedDict, total=False): + key "maxThroughput": int + key "provisioningState": Union[str, Status] + maxThroughput: int + provisioningState: Union[str, Status] - class azure.mgmt.cosmosdb.types.ThroughputSettingsGetResults(ProxyResource): + class azure.mgmt.cosmosdb.types.ThroughputPoolResource(TrackedResource): key "id": str - key "identity": ForwardRef('ManagedServiceIdentity', module='types') - key "location": str + key "location": Required[str] key "name": str - key "properties": ForwardRef('ThroughputSettingsGetProperties', module='types') + key "properties": ForwardRef('ThroughputPoolProperties', module='types') key "systemData": ForwardRef('SystemData', module='types') key "type": str id: str - identity: ManagedServiceIdentity location: str name: str - properties: ThroughputSettingsGetProperties - system_data: SystemData + properties: ThroughputPoolProperties + systemData: SystemData tags: dict[str, str] type: str + class azure.mgmt.cosmosdb.types.ThroughputPoolUpdate(TypedDict, total=False): + key "properties": ForwardRef('ThroughputPoolProperties', module='types') + properties: ThroughputPoolProperties + + class azure.mgmt.cosmosdb.types.ThroughputSettingsResource(TypedDict, total=False): key "autoscaleSettings": ForwardRef('AutoscaleSettingsResource', module='types') key "instantMaximumThroughput": str @@ -18160,12 +22729,13 @@ namespace azure.mgmt.cosmosdb.types key "offerReplacePending": str key "softAllowedMaximumThroughput": str key "throughput": int - autoscale_settings: AutoscaleSettingsResource - instant_maximum_throughput: str - minimum_throughput: str - offer_replace_pending: str - soft_allowed_maximum_throughput: str + autoscaleSettings: AutoscaleSettingsResource + instantMaximumThroughput: str + minimumThroughput: str + offerReplacePending: str + softAllowedMaximumThroughput: str throughput: int + throughputBuckets: list[ThroughputBucketResource] class azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters(ARMResourceProperties): @@ -18198,7 +22768,7 @@ namespace azure.mgmt.cosmosdb.types id: str location: str name: str - system_data: SystemData + systemData: SystemData tags: dict[str, str] type: str @@ -18209,20 +22779,6 @@ namespace azure.mgmt.cosmosdb.types class azure.mgmt.cosmosdb.types.UniqueKeyPolicy(TypedDict, total=False): uniqueKeys: list[UniqueKey] - unique_keys: list[UniqueKey] - - - class azure.mgmt.cosmosdb.types.Usage(TypedDict, total=False): - key "currentValue": int - key "limit": int - key "name": ForwardRef('MetricName', module='types') - key "quotaPeriod": str - key "unit": Union[str, UnitType] - current_value: int - limit: int - name: MetricName - quota_period: str - unit: Union[str, UnitType] class azure.mgmt.cosmosdb.types.VectorEmbedding(TypedDict, total=False): @@ -18230,15 +22786,14 @@ namespace azure.mgmt.cosmosdb.types key "dimensions": Required[int] key "distanceFunction": Required[Union[str, DistanceFunction]] key "path": Required[str] - data_type: Union[str, VectorDataType] + dataType: Union[str, VectorDataType] dimensions: int - distance_function: Union[str, DistanceFunction] + distanceFunction: Union[str, DistanceFunction] path: str class azure.mgmt.cosmosdb.types.VectorEmbeddingPolicy(TypedDict, total=False): vectorEmbeddings: list[VectorEmbedding] - vector_embeddings: list[VectorEmbedding] class azure.mgmt.cosmosdb.types.VectorIndex(TypedDict, total=False): @@ -18246,19 +22801,18 @@ namespace azure.mgmt.cosmosdb.types key "path": Required[str] key "quantizationByteSize": int key "type": Required[Union[str, VectorIndexType]] - indexing_search_list_size: int + indexingSearchListSize: int path: str - quantization_byte_size: int + quantizationByteSize: int type: Union[str, VectorIndexType] vectorIndexShardKey: list[str] - vector_index_shard_key: list[str] class azure.mgmt.cosmosdb.types.VirtualNetworkRule(TypedDict, total=False): key "id": str key "ignoreMissingVNetServiceEndpoint": bool id: str - ignore_missing_v_net_service_endpoint: bool + ignoreMissingVNetServiceEndpoint: bool ``` \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/api.metadata.yml b/sdk/cosmos/azure-mgmt-cosmosdb/api.metadata.yml index 1979e136d718..222d3a3ecfab 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/api.metadata.yml +++ b/sdk/cosmos/azure-mgmt-cosmosdb/api.metadata.yml @@ -1,3 +1,3 @@ -apiMdSha256: bb5e955fa86d927ddfc7f300e2fed8ec6c99d9e7bc8d3fd2b6dea6566014580d -parserVersion: 0.3.28 -pythonVersion: 3.13.13 +apiMdSha256: 7d63bde47bed9d7f9cb7bd2254d79dd01b620e5c2a32df1f10c6e9a1146c77df +parserVersion: 0.3.31 +pythonVersion: 3.13.15 diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/apiview-properties.json b/sdk/cosmos/azure-mgmt-cosmosdb/apiview-properties.json index 63719b5949b3..91bda90fe1e8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/apiview-properties.json +++ b/sdk/cosmos/azure-mgmt-cosmosdb/apiview-properties.json @@ -1,6 +1,9 @@ { "CrossLanguagePackageId": "Microsoft.DocumentDB", "CrossLanguageDefinitionId": { + "azure.mgmt.cosmosdb.models.AccessRule": "Azure.ResourceManager.CommonTypes.AccessRule", + "azure.mgmt.cosmosdb.models.AccessRuleProperties": "Azure.ResourceManager.CommonTypes.AccessRuleProperties", + "azure.mgmt.cosmosdb.models.AccessRulePropertiesSubscriptionsItem": "Customizations.AccessRulePropertiesSubscriptionsItem", "azure.mgmt.cosmosdb.models.AccountKeyMetadata": "Microsoft.DocumentDB.AccountKeyMetadata", "azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration": "Microsoft.DocumentDB.AnalyticalStorageConfiguration", "azure.mgmt.cosmosdb.models.ApiProperties": "Microsoft.DocumentDB.ApiProperties", @@ -10,12 +13,23 @@ "azure.mgmt.cosmosdb.models.AutoscaleSettings": "Microsoft.DocumentDB.AutoscaleSettings", "azure.mgmt.cosmosdb.models.AutoscaleSettingsResource": "Microsoft.DocumentDB.AutoscaleSettingsResource", "azure.mgmt.cosmosdb.models.AutoUpgradePolicyResource": "Microsoft.DocumentDB.AutoUpgradePolicyResource", + "azure.mgmt.cosmosdb.models.AzureBlobContainer": "Microsoft.DocumentDB.AzureBlobContainer", + "azure.mgmt.cosmosdb.models.DataTransferDataSourceSink": "Microsoft.DocumentDB.DataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.AzureBlobDataTransferDataSourceSink": "Microsoft.DocumentDB.AzureBlobDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.AzureBlobSourceSinkDetails": "Microsoft.DocumentDB.AzureBlobSourceSinkDetails", "azure.mgmt.cosmosdb.models.BackupInformation": "Microsoft.DocumentDB.BackupInformation", "azure.mgmt.cosmosdb.models.BackupPolicy": "Microsoft.DocumentDB.BackupPolicy", "azure.mgmt.cosmosdb.models.BackupPolicyMigrationState": "Microsoft.DocumentDB.BackupPolicyMigrationState", + "azure.mgmt.cosmosdb.models.BackupResource": "Microsoft.DocumentDB.BackupResource", "azure.mgmt.cosmosdb.models.BackupSchedule": "Microsoft.DocumentDB.BackupSchedule", + "azure.mgmt.cosmosdb.models.BaseCopyJobProperties": "Microsoft.DocumentDB.BaseCopyJobProperties", + "azure.mgmt.cosmosdb.models.BaseCopyJobTask": "Microsoft.DocumentDB.BaseCopyJobTask", + "azure.mgmt.cosmosdb.models.BaseCosmosDataTransferDataSourceSink": "Microsoft.DocumentDB.BaseCosmosDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.BlobToCassandraRUCopyJobProperties": "Microsoft.DocumentDB.BlobToCassandraRUCopyJobProperties", + "azure.mgmt.cosmosdb.models.BlobToCassandraRUCopyJobTask": "Microsoft.DocumentDB.BlobToCassandraRUCopyJobTask", "azure.mgmt.cosmosdb.models.Capability": "Microsoft.DocumentDB.Capability", "azure.mgmt.cosmosdb.models.Capacity": "Microsoft.DocumentDB.Capacity", + "azure.mgmt.cosmosdb.models.CapacityModeChangeTransitionState": "Microsoft.DocumentDB.CapacityModeChangeTransitionState", "azure.mgmt.cosmosdb.models.CassandraClusterDataCenterNodeItem": "Microsoft.DocumentDB.ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems", "azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus": "Microsoft.DocumentDB.CassandraClusterPublicStatus", "azure.mgmt.cosmosdb.models.CassandraClusterPublicStatusDataCentersItem": "Microsoft.DocumentDB.CassandraClusterPublicStatusDataCentersItem", @@ -35,6 +49,10 @@ "azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResourceProperties": "Microsoft.DocumentDB.CassandraRoleAssignmentResourceProperties", "azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource": "Microsoft.DocumentDB.CassandraRoleDefinitionResource", "azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResourceProperties": "Microsoft.DocumentDB.CassandraRoleDefinitionResourceProperties", + "azure.mgmt.cosmosdb.models.CassandraRUToBlobCopyJobProperties": "Microsoft.DocumentDB.CassandraRUToBlobCopyJobProperties", + "azure.mgmt.cosmosdb.models.CassandraRUToBlobCopyJobTask": "Microsoft.DocumentDB.CassandraRUToBlobCopyJobTask", + "azure.mgmt.cosmosdb.models.CassandraRUToCassandraRUCopyJobProperties": "Microsoft.DocumentDB.CassandraRUToCassandraRUCopyJobProperties", + "azure.mgmt.cosmosdb.models.CassandraRUToCassandraRUCopyJobTask": "Microsoft.DocumentDB.CassandraRUToCassandraRUCopyJobTask", "azure.mgmt.cosmosdb.models.CassandraSchema": "Microsoft.DocumentDB.CassandraSchema", "azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters": "Microsoft.DocumentDB.CassandraTableCreateUpdateParameters", "azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateProperties": "Microsoft.DocumentDB.CassandraTableCreateUpdateProperties", @@ -43,7 +61,16 @@ "azure.mgmt.cosmosdb.models.CassandraTableResource": "Microsoft.DocumentDB.CassandraTableResource", "azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource": "Microsoft.DocumentDB.CassandraTableGetPropertiesResource", "azure.mgmt.cosmosdb.models.CassandraTableGetResults": "Microsoft.DocumentDB.CassandraTableGetResults", + "azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters": "Microsoft.DocumentDB.CassandraViewCreateUpdateParameters", + "azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateProperties": "Microsoft.DocumentDB.CassandraViewCreateUpdateProperties", + "azure.mgmt.cosmosdb.models.CassandraViewGetProperties": "Microsoft.DocumentDB.CassandraViewGetProperties", + "azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions": "Microsoft.DocumentDB.CassandraViewGetPropertiesOptions", + "azure.mgmt.cosmosdb.models.CassandraViewResource": "Microsoft.DocumentDB.CassandraViewResource", + "azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource": "Microsoft.DocumentDB.CassandraViewGetPropertiesResource", + "azure.mgmt.cosmosdb.models.CassandraViewGetResults": "Microsoft.DocumentDB.CassandraViewGetResults", "azure.mgmt.cosmosdb.models.Certificate": "Microsoft.DocumentDB.Certificate", + "azure.mgmt.cosmosdb.models.ChaosFaultProperties": "Microsoft.DocumentDB.chaosFaultProperties", + "azure.mgmt.cosmosdb.models.ChaosFaultResource": "Microsoft.DocumentDB.chaosFaultResource", "azure.mgmt.cosmosdb.models.ClientEncryptionIncludedPath": "Microsoft.DocumentDB.ClientEncryptionIncludedPath", "azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters": "Microsoft.DocumentDB.ClientEncryptionKeyCreateUpdateParameters", "azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateProperties": "Microsoft.DocumentDB.ClientEncryptionKeyCreateUpdateProperties", @@ -57,8 +84,10 @@ "azure.mgmt.cosmosdb.models.ClusterResource": "Microsoft.DocumentDB.ClusterResource", "azure.mgmt.cosmosdb.models.ClusterResourceProperties": "Microsoft.DocumentDB.ClusterResourceProperties", "azure.mgmt.cosmosdb.models.Column": "Microsoft.DocumentDB.Column", + "azure.mgmt.cosmosdb.models.CommandAsyncPostBody": "Microsoft.DocumentDB.CommandAsyncPostBody", "azure.mgmt.cosmosdb.models.CommandOutput": "Microsoft.DocumentDB.CommandOutput", "azure.mgmt.cosmosdb.models.CommandPostBody": "Microsoft.DocumentDB.CommandPostBody", + "azure.mgmt.cosmosdb.models.CommandPublicResource": "Microsoft.DocumentDB.CommandPublicResource", "azure.mgmt.cosmosdb.models.CompositePath": "Microsoft.DocumentDB.CompositePath", "azure.mgmt.cosmosdb.models.ComputedProperty": "Microsoft.DocumentDB.ComputedProperty", "azure.mgmt.cosmosdb.models.ConflictResolutionPolicy": "Microsoft.DocumentDB.ConflictResolutionPolicy", @@ -69,7 +98,19 @@ "azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation": "Microsoft.DocumentDB.ContinuousBackupRestoreLocation", "azure.mgmt.cosmosdb.models.ContinuousModeBackupPolicy": "Microsoft.DocumentDB.ContinuousModeBackupPolicy", "azure.mgmt.cosmosdb.models.ContinuousModeProperties": "Microsoft.DocumentDB.ContinuousModeProperties", + "azure.mgmt.cosmosdb.models.CopyJobGetResults": "Microsoft.DocumentDB.CopyJobGetResults", + "azure.mgmt.cosmosdb.models.CopyJobProperties": "Microsoft.DocumentDB.CopyJobProperties", "azure.mgmt.cosmosdb.models.CorsPolicy": "Microsoft.DocumentDB.CorsPolicy", + "azure.mgmt.cosmosdb.models.CosmosCassandraDataTransferDataSourceSink": "Microsoft.DocumentDB.CosmosCassandraDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.CosmosDBCassandraTable": "Microsoft.DocumentDB.CosmosDBCassandraTable", + "azure.mgmt.cosmosdb.models.CosmosDBMongoCollection": "Microsoft.DocumentDB.CosmosDBMongoCollection", + "azure.mgmt.cosmosdb.models.CosmosDBMongoVCoreCollection": "Microsoft.DocumentDB.CosmosDBMongoVCoreCollection", + "azure.mgmt.cosmosdb.models.CosmosDBNoSqlContainer": "Microsoft.DocumentDB.CosmosDBNoSqlContainer", + "azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails": "Microsoft.DocumentDB.CosmosDBSourceSinkDetails", + "azure.mgmt.cosmosdb.models.CosmosMongoDataTransferDataSourceSink": "Microsoft.DocumentDB.CosmosMongoDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.CosmosMongoVCoreDataTransferDataSourceSink": "Microsoft.DocumentDB.CosmosMongoVCoreDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.CosmosSqlDataTransferDataSourceSink": "Microsoft.DocumentDB.CosmosSqlDataTransferDataSourceSink", + "azure.mgmt.cosmosdb.models.CreateJobRequest": "Microsoft.DocumentDB.CreateJobRequest", "azure.mgmt.cosmosdb.models.CreateUpdateOptions": "Microsoft.DocumentDB.CreateUpdateOptions", "azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString": "Microsoft.DocumentDB.DatabaseAccountConnectionString", "azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateParameters": "Microsoft.DocumentDB.DatabaseAccountCreateUpdateParameters", @@ -86,12 +127,18 @@ "azure.mgmt.cosmosdb.models.DatabaseRestoreResource": "Microsoft.DocumentDB.DatabaseRestoreResource", "azure.mgmt.cosmosdb.models.DataCenterResource": "Microsoft.DocumentDB.DataCenterResource", "azure.mgmt.cosmosdb.models.DataCenterResourceProperties": "Microsoft.DocumentDB.DataCenterResourceProperties", + "azure.mgmt.cosmosdb.models.DataMaskingPolicy": "Microsoft.DocumentDB.DataMaskingPolicy", + "azure.mgmt.cosmosdb.models.DataMaskingPolicyExcludedPathsItem": "Microsoft.DocumentDB.DataMaskingPolicyExcludedPathsItem", + "azure.mgmt.cosmosdb.models.DataMaskingPolicyIncludedPathsItem": "Microsoft.DocumentDB.DataMaskingPolicyIncludedPathsItem", + "azure.mgmt.cosmosdb.models.DataTransferJobGetResults": "Microsoft.DocumentDB.DataTransferJobGetResults", + "azure.mgmt.cosmosdb.models.DataTransferJobProperties": "Microsoft.DocumentDB.DataTransferJobProperties", "azure.mgmt.cosmosdb.models.RegionalServiceResource": "Microsoft.DocumentDB.RegionalServiceResource", "azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource": "Microsoft.DocumentDB.DataTransferRegionalServiceResource", "azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties": "Microsoft.DocumentDB.ServiceResourceCreateUpdateProperties", "azure.mgmt.cosmosdb.models.DataTransferServiceResourceCreateUpdateProperties": "Microsoft.DocumentDB.DataTransferServiceResourceCreateUpdateProperties", "azure.mgmt.cosmosdb.models.ServiceResourceProperties": "Microsoft.DocumentDB.ServiceResourceProperties", "azure.mgmt.cosmosdb.models.DataTransferServiceResourceProperties": "Microsoft.DocumentDB.DataTransferServiceResourceProperties", + "azure.mgmt.cosmosdb.models.DiagnosticLogSettings": "Microsoft.DocumentDB.DiagnosticLogSettings", "azure.mgmt.cosmosdb.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", "azure.mgmt.cosmosdb.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", "azure.mgmt.cosmosdb.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", @@ -99,6 +146,8 @@ "azure.mgmt.cosmosdb.models.ExcludedPath": "Microsoft.DocumentDB.ExcludedPath", "azure.mgmt.cosmosdb.models.FailoverPolicies": "Microsoft.DocumentDB.FailoverPolicies", "azure.mgmt.cosmosdb.models.FailoverPolicy": "Microsoft.DocumentDB.FailoverPolicy", + "azure.mgmt.cosmosdb.models.FleetAnalyticsProperties": "Microsoft.DocumentDB.FleetAnalyticsProperties", + "azure.mgmt.cosmosdb.models.FleetAnalyticsResource": "Microsoft.DocumentDB.FleetAnalyticsResource", "azure.mgmt.cosmosdb.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", "azure.mgmt.cosmosdb.models.FleetResource": "Microsoft.DocumentDB.FleetResource", "azure.mgmt.cosmosdb.models.FleetResourceProperties": "Microsoft.DocumentDB.FleetResourceProperties", @@ -113,9 +162,21 @@ "azure.mgmt.cosmosdb.models.FullTextIndexPath": "Microsoft.DocumentDB.FullTextIndexPath", "azure.mgmt.cosmosdb.models.FullTextPath": "Microsoft.DocumentDB.FullTextPath", "azure.mgmt.cosmosdb.models.FullTextPolicy": "Microsoft.DocumentDB.FullTextPolicy", + "azure.mgmt.cosmosdb.models.GarnetClusterResource": "Microsoft.DocumentDB.GarnetClusterResource", + "azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch": "Microsoft.DocumentDB.GarnetClusterResourcePatch", + "azure.mgmt.cosmosdb.models.GarnetClusterResourcePatchProperties": "Microsoft.DocumentDB.GarnetClusterResourcePatchProperties", + "azure.mgmt.cosmosdb.models.GarnetClusterResourceProperties": "Microsoft.DocumentDB.GarnetClusterResourceProperties", + "azure.mgmt.cosmosdb.models.GarnetClusterResourcePropertiesEndPointsItem": "Microsoft.DocumentDB.GarnetClusterResourcePropertiesEndPointsItem", "azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource": "Microsoft.DocumentDB.GraphAPIComputeRegionalServiceResource", "azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceCreateUpdateProperties": "Microsoft.DocumentDB.GraphAPIComputeServiceResourceCreateUpdateProperties", "azure.mgmt.cosmosdb.models.GraphAPIComputeServiceResourceProperties": "Microsoft.DocumentDB.GraphAPIComputeServiceResourceProperties", + "azure.mgmt.cosmosdb.models.GraphResource": "Microsoft.DocumentDB.GraphResource", + "azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateParameters": "Microsoft.DocumentDB.GraphResourceCreateUpdateParameters", + "azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateProperties": "Microsoft.DocumentDB.GraphResourceCreateUpdateProperties", + "azure.mgmt.cosmosdb.models.GraphResourceGetProperties": "Microsoft.DocumentDB.GraphResourceGetProperties", + "azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions": "Microsoft.DocumentDB.GraphResourceGetPropertiesOptions", + "azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource": "Microsoft.DocumentDB.GraphResourceGetPropertiesResource", + "azure.mgmt.cosmosdb.models.GraphResourceGetResults": "Microsoft.DocumentDB.GraphResourceGetResults", "azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters": "Microsoft.DocumentDB.GremlinDatabaseCreateUpdateParameters", "azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateProperties": "Microsoft.DocumentDB.GremlinDatabaseCreateUpdateProperties", "azure.mgmt.cosmosdb.models.GremlinDatabaseGetProperties": "Microsoft.DocumentDB.GremlinDatabaseGetProperties", @@ -147,9 +208,13 @@ "azure.mgmt.cosmosdb.models.ManagedCassandraReaperStatus": "Microsoft.DocumentDB.ManagedCassandraReaperStatus", "azure.mgmt.cosmosdb.models.ManagedServiceIdentity": "Microsoft.DocumentDB.ManagedServiceIdentity", "azure.mgmt.cosmosdb.models.ManagedServiceIdentityUserAssignedIdentity": "Microsoft.DocumentDB.ManagedServiceIdentityUserAssignedIdentities", + "azure.mgmt.cosmosdb.models.MaterializedViewDefinition": "Microsoft.DocumentDB.MaterializedViewDefinition", + "azure.mgmt.cosmosdb.models.MaterializedViewDetails": "Microsoft.DocumentDB.MaterializedViewDetails", "azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource": "Microsoft.DocumentDB.MaterializedViewsBuilderRegionalServiceResource", "azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceCreateUpdateProperties": "Microsoft.DocumentDB.MaterializedViewsBuilderServiceResourceCreateUpdateProperties", "azure.mgmt.cosmosdb.models.MaterializedViewsBuilderServiceResourceProperties": "Microsoft.DocumentDB.MaterializedViewsBuilderServiceResourceProperties", + "azure.mgmt.cosmosdb.models.MaterializedViewsProperties": "Microsoft.DocumentDB.MaterializedViewsProperties", + "azure.mgmt.cosmosdb.models.MergeParameters": "Microsoft.DocumentDB.MergeParameters", "azure.mgmt.cosmosdb.models.Metric": "Microsoft.DocumentDB.Metric", "azure.mgmt.cosmosdb.models.MetricAvailability": "Microsoft.DocumentDB.MetricAvailability", "azure.mgmt.cosmosdb.models.MetricDefinition": "Microsoft.DocumentDB.MetricDefinition", @@ -179,9 +244,20 @@ "azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters": "Microsoft.DocumentDB.MongoRoleDefinitionCreateUpdateParameters", "azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults": "Microsoft.DocumentDB.MongoRoleDefinitionGetResults", "azure.mgmt.cosmosdb.models.MongoRoleDefinitionResource": "Microsoft.DocumentDB.MongoRoleDefinitionResource", + "azure.mgmt.cosmosdb.models.MongoRUToMongoRUCopyJobProperties": "Microsoft.DocumentDB.MongoRUToMongoRUCopyJobProperties", + "azure.mgmt.cosmosdb.models.MongoRUToMongoRUCopyJobTask": "Microsoft.DocumentDB.MongoRUToMongoRUCopyJobTask", + "azure.mgmt.cosmosdb.models.MongoRUToMongoVCoreCopyJobProperties": "Microsoft.DocumentDB.MongoRUToMongoVCoreCopyJobProperties", + "azure.mgmt.cosmosdb.models.MongoRUToMongoVCoreCopyJobTask": "Microsoft.DocumentDB.MongoRUToMongoVCoreCopyJobTask", "azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters": "Microsoft.DocumentDB.MongoUserDefinitionCreateUpdateParameters", "azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults": "Microsoft.DocumentDB.MongoUserDefinitionGetResults", "azure.mgmt.cosmosdb.models.MongoUserDefinitionResource": "Microsoft.DocumentDB.MongoUserDefinitionResource", + "azure.mgmt.cosmosdb.models.MongoVCoreSourceSinkDetails": "Microsoft.DocumentDB.MongoVCoreSourceSinkDetails", + "azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeter", + "azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfiguration", + "azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProperties": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeterConfigurationProperties", + "azure.mgmt.cosmosdb.models.NetworkSecurityProfile": "Azure.ResourceManager.CommonTypes.NetworkSecurityProfile", + "azure.mgmt.cosmosdb.models.NoSqlRUToNoSqlRUCopyJobProperties": "Microsoft.DocumentDB.NoSqlRUToNoSqlRUCopyJobProperties", + "azure.mgmt.cosmosdb.models.NoSqlRUToNoSqlRUCopyJobTask": "Microsoft.DocumentDB.NoSqlRUToNoSqlRUCopyJobTask", "azure.mgmt.cosmosdb.models.NotebookWorkspace": "Microsoft.DocumentDB.NotebookWorkspace", "azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult": "Microsoft.DocumentDB.NotebookWorkspaceConnectionInfoResult", "azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters": "Microsoft.DocumentDB.NotebookWorkspaceCreateUpdateParameters", @@ -196,6 +272,14 @@ "azure.mgmt.cosmosdb.models.PeriodicModeBackupPolicy": "Microsoft.DocumentDB.PeriodicModeBackupPolicy", "azure.mgmt.cosmosdb.models.PeriodicModeProperties": "Microsoft.DocumentDB.PeriodicModeProperties", "azure.mgmt.cosmosdb.models.Permission": "Microsoft.DocumentDB.Permission", + "azure.mgmt.cosmosdb.models.PhysicalPartitionId": "Microsoft.DocumentDB.PhysicalPartitionId", + "azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfo": "Microsoft.DocumentDB.physicalPartitionStorageInfo", + "azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection": "Microsoft.DocumentDB.PhysicalPartitionStorageInfoCollection", + "azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoProperties": "Microsoft.DocumentDB.PhysicalPartitionThroughputInfoProperties", + "azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource": "Microsoft.DocumentDB.PhysicalPartitionThroughputInfoResource", + "azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult": "Microsoft.DocumentDB.PhysicalPartitionThroughputInfoResult", + "azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultProperties": "Microsoft.DocumentDB.PhysicalPartitionThroughputInfoResultProperties", + "azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource": "Microsoft.DocumentDB.PhysicalPartitionThroughputInfoResultPropertiesResource", "azure.mgmt.cosmosdb.models.PrivateEndpointConnection": "Microsoft.DocumentDB.PrivateEndpointConnection", "azure.mgmt.cosmosdb.models.PrivateEndpointConnectionProperties": "Microsoft.DocumentDB.PrivateEndpointConnectionProperties", "azure.mgmt.cosmosdb.models.PrivateEndpointProperty": "Microsoft.DocumentDB.PrivateEndpointProperty", @@ -204,7 +288,13 @@ "azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty": "Microsoft.DocumentDB.PrivateLinkServiceConnectionStateProperty", "azure.mgmt.cosmosdb.models.Privilege": "Microsoft.DocumentDB.Privilege", "azure.mgmt.cosmosdb.models.PrivilegeResource": "Microsoft.DocumentDB.PrivilegeResource", + "azure.mgmt.cosmosdb.models.ProvisioningIssue": "Azure.ResourceManager.CommonTypes.ProvisioningIssue", + "azure.mgmt.cosmosdb.models.ProvisioningIssueProperties": "Azure.ResourceManager.CommonTypes.ProvisioningIssueProperties", + "azure.mgmt.cosmosdb.models.RedistributeThroughputParameters": "Microsoft.DocumentDB.RedistributeThroughputParameters", + "azure.mgmt.cosmosdb.models.RedistributeThroughputProperties": "Microsoft.DocumentDB.RedistributeThroughputProperties", + "azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource": "Microsoft.DocumentDB.RedistributeThroughputPropertiesResource", "azure.mgmt.cosmosdb.models.RegionForOnlineOffline": "Microsoft.DocumentDB.RegionForOnlineOffline", + "azure.mgmt.cosmosdb.models.ResourceAssociation": "Azure.ResourceManager.CommonTypes.ResourceAssociation", "azure.mgmt.cosmosdb.models.RestoreParametersBase": "Microsoft.DocumentDB.RestoreParametersBase", "azure.mgmt.cosmosdb.models.ResourceRestoreParameters": "Microsoft.DocumentDB.ResourceRestoreParameters", "azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult": "Microsoft.DocumentDB.RestorableDatabaseAccountGetResult", @@ -240,10 +330,27 @@ "azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource": "Microsoft.DocumentDB.RestorableTablePropertiesResource", "azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult": "Microsoft.DocumentDB.RestorableTableResourcesGetResult", "azure.mgmt.cosmosdb.models.RestoreParameters": "Microsoft.DocumentDB.RestoreParameters", + "azure.mgmt.cosmosdb.models.RetrieveThroughputParameters": "Microsoft.DocumentDB.RetrieveThroughputParameters", + "azure.mgmt.cosmosdb.models.RetrieveThroughputProperties": "Microsoft.DocumentDB.RetrieveThroughputProperties", + "azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource": "Microsoft.DocumentDB.RetrieveThroughputPropertiesResource", "azure.mgmt.cosmosdb.models.Role": "Microsoft.DocumentDB.Role", "azure.mgmt.cosmosdb.models.SeedNode": "Microsoft.DocumentDB.SeedNode", "azure.mgmt.cosmosdb.models.ServiceResource": "Microsoft.DocumentDB.ServiceResource", "azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters": "Microsoft.DocumentDB.ServiceResourceCreateUpdateParameters", + "azure.mgmt.cosmosdb.models.SoftDeleteConfiguration": "Microsoft.DocumentDB.SoftDeleteConfiguration", + "azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountGetResult": "Microsoft.DocumentDB.SoftDeletedDatabaseAccountGetResult", + "azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountProperties": "Microsoft.DocumentDB.SoftDeletedDatabaseAccountProperties", + "azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountResource": "Microsoft.DocumentDB.SoftDeletedDatabaseAccountResource", + "azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult": "Microsoft.DocumentDB.SoftDeletedDatabaseAccountsListResult", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerGetResult": "Microsoft.DocumentDB.SoftDeletedSqlContainerGetResult", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerProperties": "Microsoft.DocumentDB.SoftDeletedSqlContainerProperties", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerResource": "Microsoft.DocumentDB.SoftDeletedSqlContainerResource", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlContainersListResult": "Microsoft.DocumentDB.SoftDeletedSqlContainersListResult", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseGetResult": "Microsoft.DocumentDB.SoftDeletedSqlDatabaseGetResult", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseProperties": "Microsoft.DocumentDB.SoftDeletedSqlDatabaseProperties", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseResource": "Microsoft.DocumentDB.SoftDeletedSqlDatabaseResource", + "azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabasesListResult": "Microsoft.DocumentDB.SoftDeletedSqlDatabasesListResult", + "azure.mgmt.cosmosdb.models.SoftDeletionMetadata": "Microsoft.DocumentDB.SoftDeletionMetadata", "azure.mgmt.cosmosdb.models.SpatialSpec": "Microsoft.DocumentDB.SpatialSpec", "azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateParameters": "Microsoft.DocumentDB.SqlContainerCreateUpdateParameters", "azure.mgmt.cosmosdb.models.SqlContainerCreateUpdateProperties": "Microsoft.DocumentDB.SqlContainerCreateUpdateProperties", @@ -296,7 +403,13 @@ "azure.mgmt.cosmosdb.models.TableRoleAssignmentResourceProperties": "Microsoft.DocumentDB.TableRoleAssignmentResourceProperties", "azure.mgmt.cosmosdb.models.TableRoleDefinitionResource": "Microsoft.DocumentDB.TableRoleDefinitionResource", "azure.mgmt.cosmosdb.models.TableRoleDefinitionResourceProperties": "Microsoft.DocumentDB.TableRoleDefinitionResourceProperties", + "azure.mgmt.cosmosdb.models.ThroughputBucketResource": "Microsoft.DocumentDB.ThroughputBucketResource", "azure.mgmt.cosmosdb.models.ThroughputPolicyResource": "Microsoft.DocumentDB.ThroughputPolicyResource", + "azure.mgmt.cosmosdb.models.ThroughputPoolAccountProperties": "Microsoft.DocumentDB.ThroughputPoolAccountProperties", + "azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource": "Microsoft.DocumentDB.ThroughputPoolAccountResource", + "azure.mgmt.cosmosdb.models.ThroughputPoolProperties": "Microsoft.DocumentDB.ThroughputPoolProperties", + "azure.mgmt.cosmosdb.models.ThroughputPoolResource": "Microsoft.DocumentDB.ThroughputPoolResource", + "azure.mgmt.cosmosdb.models.ThroughputPoolUpdate": "Microsoft.DocumentDB.ThroughputPoolUpdate", "azure.mgmt.cosmosdb.models.ThroughputSettingsGetProperties": "Microsoft.DocumentDB.ThroughputSettingsGetProperties", "azure.mgmt.cosmosdb.models.ThroughputSettingsResource": "Microsoft.DocumentDB.ThroughputSettingsResource", "azure.mgmt.cosmosdb.models.ThroughputSettingsGetPropertiesResource": "Microsoft.DocumentDB.ThroughputSettingsGetPropertiesResource", @@ -322,6 +435,9 @@ "azure.mgmt.cosmosdb.models.ContinuousTier": "Microsoft.DocumentDB.ContinuousTier", "azure.mgmt.cosmosdb.models.BackupStorageRedundancy": "Microsoft.DocumentDB.BackupStorageRedundancy", "azure.mgmt.cosmosdb.models.NetworkAclBypass": "Microsoft.DocumentDB.NetworkAclBypass", + "azure.mgmt.cosmosdb.models.EnableFullTextQuery": "Microsoft.DocumentDB.EnableFullTextQuery", + "azure.mgmt.cosmosdb.models.CapacityMode": "Microsoft.DocumentDB.CapacityMode", + "azure.mgmt.cosmosdb.models.CapacityModeTransitionStatus": "Microsoft.DocumentDB.CapacityModeTransitionStatus", "azure.mgmt.cosmosdb.models.MinimalTlsVersion": "Microsoft.DocumentDB.MinimalTlsVersion", "azure.mgmt.cosmosdb.models.DefaultPriorityLevel": "Microsoft.DocumentDB.DefaultPriorityLevel", "azure.mgmt.cosmosdb.models.ResourceIdentityType": "Microsoft.DocumentDB.ResourceIdentityType", @@ -331,6 +447,10 @@ "azure.mgmt.cosmosdb.models.KeyKind": "Microsoft.DocumentDB.KeyKind", "azure.mgmt.cosmosdb.models.UnitType": "Microsoft.DocumentDB.UnitType", "azure.mgmt.cosmosdb.models.PrimaryAggregationType": "Microsoft.DocumentDB.PrimaryAggregationType", + "azure.mgmt.cosmosdb.models.CopyJobType": "Microsoft.DocumentDB.CopyJobType", + "azure.mgmt.cosmosdb.models.CopyJobStatus": "Microsoft.DocumentDB.CopyJobStatus", + "azure.mgmt.cosmosdb.models.CopyJobMode": "Microsoft.DocumentDB.CopyJobMode", + "azure.mgmt.cosmosdb.models.ThroughputPolicyType": "Microsoft.DocumentDB.ThroughputPolicyType", "azure.mgmt.cosmosdb.models.IndexingMode": "Microsoft.DocumentDB.IndexingMode", "azure.mgmt.cosmosdb.models.DataType": "Microsoft.DocumentDB.DataType", "azure.mgmt.cosmosdb.models.IndexKind": "Microsoft.DocumentDB.IndexKind", @@ -345,14 +465,29 @@ "azure.mgmt.cosmosdb.models.TriggerOperation": "Microsoft.DocumentDB.TriggerOperation", "azure.mgmt.cosmosdb.models.RoleDefinitionType": "Microsoft.DocumentDB.RoleDefinitionType", "azure.mgmt.cosmosdb.models.MongoRoleDefinitionType": "Microsoft.DocumentDB.MongoRoleDefinitionType", + "azure.mgmt.cosmosdb.models.DataTransferComponent": "Microsoft.DocumentDB.DataTransferComponent", + "azure.mgmt.cosmosdb.models.DataTransferJobMode": "Microsoft.DocumentDB.DataTransferJobMode", + "azure.mgmt.cosmosdb.models.GarnetCacheProvisioningState": "Microsoft.DocumentDB.GarnetCacheProvisioningState", + "azure.mgmt.cosmosdb.models.GarnetAuthenticationType": "Microsoft.DocumentDB.GarnetAuthenticationType", + "azure.mgmt.cosmosdb.models.AllocationState": "Microsoft.DocumentDB.AllocationState", + "azure.mgmt.cosmosdb.models.ClusterType": "Microsoft.DocumentDB.ClusterType", + "azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType": "Microsoft.DocumentDB.ManagedCassandraResourceIdentityType", + "azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfigurationProvisioningState": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeterConfigurationProvisioningState", + "azure.mgmt.cosmosdb.models.IssueType": "Azure.ResourceManager.CommonTypes.IssueType", + "azure.mgmt.cosmosdb.models.Severity": "Azure.ResourceManager.CommonTypes.Severity", + "azure.mgmt.cosmosdb.models.AccessRuleDirection": "Azure.ResourceManager.CommonTypes.AccessRuleDirection", + "azure.mgmt.cosmosdb.models.ResourceAssociationAccessMode": "Azure.ResourceManager.CommonTypes.ResourceAssociationAccessMode", "azure.mgmt.cosmosdb.models.NotebookWorkspaceName": "Microsoft.DocumentDB.NotebookWorkspaceName", + "azure.mgmt.cosmosdb.models.SoftDeleteActionKind": "Microsoft.DocumentDB.SoftDeleteActionKind", + "azure.mgmt.cosmosdb.models.SupportedActions": "Microsoft.DocumentDB.SupportedActions", "azure.mgmt.cosmosdb.models.Status": "Microsoft.DocumentDB.Status", "azure.mgmt.cosmosdb.models.ManagedCassandraProvisioningState": "Microsoft.DocumentDB.ManagedCassandraProvisioningState", "azure.mgmt.cosmosdb.models.AuthenticationMethod": "Microsoft.DocumentDB.AuthenticationMethod", "azure.mgmt.cosmosdb.models.AutoReplicate": "Microsoft.DocumentDB.AutoReplicate", "azure.mgmt.cosmosdb.models.ScheduledEventStrategy": "Microsoft.DocumentDB.ScheduledEventStrategy", "azure.mgmt.cosmosdb.models.AzureConnectionType": "Microsoft.DocumentDB.AzureConnectionType", - "azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType": "Microsoft.DocumentDB.ManagedCassandraResourceIdentityType", + "azure.mgmt.cosmosdb.models.CommandStatus": "Microsoft.DocumentDB.CommandStatus", + "azure.mgmt.cosmosdb.models.BackupState": "Microsoft.DocumentDB.BackupState", "azure.mgmt.cosmosdb.models.ConnectionState": "Microsoft.DocumentDB.ConnectionState", "azure.mgmt.cosmosdb.models.NodeState": "Microsoft.DocumentDB.NodeState", "azure.mgmt.cosmosdb.models.ApiType": "Microsoft.DocumentDB.ApiType", @@ -361,6 +496,7 @@ "azure.mgmt.cosmosdb.models.ServiceType": "Microsoft.DocumentDB.ServiceType", "azure.mgmt.cosmosdb.models.ServiceStatus": "Microsoft.DocumentDB.ServiceStatus", "azure.mgmt.cosmosdb.models.DedicatedGatewayType": "Microsoft.DocumentDB.DedicatedGatewayType", + "azure.mgmt.cosmosdb.models.FleetAnalyticsPropertiesStorageLocationType": "Microsoft.DocumentDB.FleetAnalyticsPropertiesStorageLocationType", "azure.mgmt.cosmosdb.models.FleetspacePropertiesFleetspaceApiKind": "Microsoft.DocumentDB.FleetspacePropertiesFleetspaceApiKind", "azure.mgmt.cosmosdb.models.FleetspacePropertiesServiceTier": "Microsoft.DocumentDB.FleetspacePropertiesServiceTier", "azure.mgmt.cosmosdb.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", @@ -401,6 +537,28 @@ "azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations.list_metric_definitions": "Microsoft.DocumentDB.DatabaseAccounts.listMetricDefinitions", "azure.mgmt.cosmosdb.operations.DatabaseAccountsOperations.check_name_exists": "Microsoft.DocumentDB.DatabaseAccountsOperationGroup.checkNameExists", "azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations.check_name_exists": "Microsoft.DocumentDB.DatabaseAccountsOperationGroup.checkNameExists", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.get": "Microsoft.DocumentDB.CopyJobs.get", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.get": "Microsoft.DocumentDB.CopyJobs.get", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.create": "Microsoft.DocumentDB.CopyJobs.create", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.create": "Microsoft.DocumentDB.CopyJobs.create", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.list_by_database_account": "Microsoft.DocumentDB.CopyJobs.listByDatabaseAccount", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.list_by_database_account": "Microsoft.DocumentDB.CopyJobs.listByDatabaseAccount", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.pause": "Microsoft.DocumentDB.CopyJobs.pause", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.pause": "Microsoft.DocumentDB.CopyJobs.pause", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.resume": "Microsoft.DocumentDB.CopyJobs.resume", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.resume": "Microsoft.DocumentDB.CopyJobs.resume", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.cancel": "Microsoft.DocumentDB.CopyJobs.cancel", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.cancel": "Microsoft.DocumentDB.CopyJobs.cancel", + "azure.mgmt.cosmosdb.operations.CopyJobsOperations.complete": "Microsoft.DocumentDB.CopyJobs.complete", + "azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations.complete": "Microsoft.DocumentDB.CopyJobs.complete", + "azure.mgmt.cosmosdb.operations.GraphResourcesOperations.get_graph": "Microsoft.DocumentDB.GraphResources.getGraph", + "azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations.get_graph": "Microsoft.DocumentDB.GraphResources.getGraph", + "azure.mgmt.cosmosdb.operations.GraphResourcesOperations.begin_create_update_graph": "Microsoft.DocumentDB.GraphResources.createUpdateGraph", + "azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations.begin_create_update_graph": "Microsoft.DocumentDB.GraphResources.createUpdateGraph", + "azure.mgmt.cosmosdb.operations.GraphResourcesOperations.begin_delete_graph_resource": "Microsoft.DocumentDB.GraphResources.deleteGraphResource", + "azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations.begin_delete_graph_resource": "Microsoft.DocumentDB.GraphResources.deleteGraphResource", + "azure.mgmt.cosmosdb.operations.GraphResourcesOperations.list_graphs": "Microsoft.DocumentDB.GraphResources.listGraphs", + "azure.mgmt.cosmosdb.aio.operations.GraphResourcesOperations.list_graphs": "Microsoft.DocumentDB.GraphResources.listGraphs", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.get_sql_database": "Microsoft.DocumentDB.SqlResources.getSqlDatabase", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.get_sql_database": "Microsoft.DocumentDB.SqlResources.getSqlDatabase", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_create_update_sql_database": "Microsoft.DocumentDB.SqlResources.createUpdateSqlDatabase", @@ -409,6 +567,8 @@ "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_delete_sql_database": "Microsoft.DocumentDB.SqlResources.deleteSqlDatabase", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.list_sql_databases": "Microsoft.DocumentDB.SqlResources.listSqlDatabases", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.list_sql_databases": "Microsoft.DocumentDB.SqlResources.listSqlDatabases", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_sql_database_partition_merge": "Microsoft.DocumentDB.SqlResources.sqlDatabasePartitionMerge", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_sql_database_partition_merge": "Microsoft.DocumentDB.SqlResources.sqlDatabasePartitionMerge", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.get_sql_database_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.getSqlDatabaseThroughput", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.get_sql_database_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.getSqlDatabaseThroughput", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_update_sql_database_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.updateSqlDatabaseThroughput", @@ -417,6 +577,10 @@ "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_migrate_sql_database_to_autoscale": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.migrateSqlDatabaseToAutoscale", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_migrate_sql_database_to_manual_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.migrateSqlDatabaseToManualThroughput", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_migrate_sql_database_to_manual_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.migrateSqlDatabaseToManualThroughput", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_sql_database_retrieve_throughput_distribution": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.sqlDatabaseRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_sql_database_retrieve_throughput_distribution": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.sqlDatabaseRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_sql_database_redistribute_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.sqlDatabaseRedistributeThroughput", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_sql_database_redistribute_throughput": "Microsoft.DocumentDB.ThroughputSettingsGetResultsOperationGroup.sqlDatabaseRedistributeThroughput", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.get_sql_container_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.getSqlContainerThroughput", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.get_sql_container_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.getSqlContainerThroughput", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_update_sql_container_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.updateSqlContainerThroughput", @@ -425,6 +589,10 @@ "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_migrate_sql_container_to_autoscale": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.migrateSqlContainerToAutoscale", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_migrate_sql_container_to_manual_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.migrateSqlContainerToManualThroughput", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_migrate_sql_container_to_manual_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.migrateSqlContainerToManualThroughput", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.sqlContainerRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_sql_container_retrieve_throughput_distribution": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.sqlContainerRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_sql_container_redistribute_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.sqlContainerRedistributeThroughput", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_sql_container_redistribute_throughput": "Microsoft.DocumentDB.SqlResourcesThroughputSettingsGetResultsOperationGroup.sqlContainerRedistributeThroughput", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.get_client_encryption_key": "Microsoft.DocumentDB.ClientEncryptionKeyGetResultsOperationGroup.getClientEncryptionKey", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.get_client_encryption_key": "Microsoft.DocumentDB.ClientEncryptionKeyGetResultsOperationGroup.getClientEncryptionKey", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_create_update_client_encryption_key": "Microsoft.DocumentDB.ClientEncryptionKeyGetResultsOperationGroup.createUpdateClientEncryptionKey", @@ -439,6 +607,8 @@ "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_delete_sql_container": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.deleteSqlContainer", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.list_sql_containers": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.listSqlContainers", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.list_sql_containers": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.listSqlContainers", + "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_list_sql_container_partition_merge": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.listSqlContainerPartitionMerge", + "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_list_sql_container_partition_merge": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.listSqlContainerPartitionMerge", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.begin_retrieve_continuous_backup_information": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.retrieveContinuousBackupInformation", "azure.mgmt.cosmosdb.aio.operations.SqlResourcesOperations.begin_retrieve_continuous_backup_information": "Microsoft.DocumentDB.SqlContainerGetResultsOperationGroup.retrieveContinuousBackupInformation", "azure.mgmt.cosmosdb.operations.SqlResourcesOperations.get_sql_stored_procedure": "Microsoft.DocumentDB.SqlStoredProcedureGetResultsOperationGroup.getSqlStoredProcedure", @@ -489,10 +659,18 @@ "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_database_to_autoscale": "Microsoft.DocumentDB.MongoDBResources.migrateMongoDBDatabaseToAutoscale", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_database_to_manual_throughput": "Microsoft.DocumentDB.MongoDBResources.migrateMongoDBDatabaseToManualThroughput", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_database_to_manual_throughput": "Microsoft.DocumentDB.MongoDBResources.migrateMongoDBDatabaseToManualThroughput", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_mongo_db_database_retrieve_throughput_distribution": "Microsoft.DocumentDB.MongoDBResources.mongoDBDatabaseRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_mongo_db_database_retrieve_throughput_distribution": "Microsoft.DocumentDB.MongoDBResources.mongoDBDatabaseRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_mongo_db_database_redistribute_throughput": "Microsoft.DocumentDB.MongoDBResources.mongoDBDatabaseRedistributeThroughput", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_mongo_db_database_redistribute_throughput": "Microsoft.DocumentDB.MongoDBResources.mongoDBDatabaseRedistributeThroughput", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.get_mongo_db_collection_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.getMongoDBCollectionThroughput", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.get_mongo_db_collection_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.getMongoDBCollectionThroughput", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_update_mongo_db_collection_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.updateMongoDBCollectionThroughput", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_update_mongo_db_collection_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.updateMongoDBCollectionThroughput", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.mongoDBContainerRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_mongo_db_container_retrieve_throughput_distribution": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.mongoDBContainerRetrieveThroughputDistribution", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.mongoDBContainerRedistributeThroughput", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_mongo_db_container_redistribute_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.mongoDBContainerRedistributeThroughput", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_collection_to_autoscale": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.migrateMongoDBCollectionToAutoscale", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_collection_to_autoscale": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.migrateMongoDBCollectionToAutoscale", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_migrate_mongo_db_collection_to_manual_throughput": "Microsoft.DocumentDB.MongoDBResourcesThroughputSettingsGetResultsOperationGroup.migrateMongoDBCollectionToManualThroughput", @@ -505,6 +683,8 @@ "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_delete_mongo_db_database": "Microsoft.DocumentDB.MongoDBDatabaseGetResultsOperationGroup.deleteMongoDBDatabase", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.list_mongo_db_databases": "Microsoft.DocumentDB.MongoDBDatabaseGetResultsOperationGroup.listMongoDBDatabases", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.list_mongo_db_databases": "Microsoft.DocumentDB.MongoDBDatabaseGetResultsOperationGroup.listMongoDBDatabases", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_mongo_db_database_partition_merge": "Microsoft.DocumentDB.MongoDBDatabaseGetResultsOperationGroup.mongoDBDatabasePartitionMerge", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_mongo_db_database_partition_merge": "Microsoft.DocumentDB.MongoDBDatabaseGetResultsOperationGroup.mongoDBDatabasePartitionMerge", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.get_mongo_db_collection": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.getMongoDBCollection", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.get_mongo_db_collection": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.getMongoDBCollection", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_create_update_mongo_db_collection": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.createUpdateMongoDBCollection", @@ -513,6 +693,8 @@ "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_delete_mongo_db_collection": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.deleteMongoDBCollection", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.list_mongo_db_collections": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.listMongoDBCollections", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.list_mongo_db_collections": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.listMongoDBCollections", + "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.listMongoDBCollectionPartitionMerge", + "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_list_mongo_db_collection_partition_merge": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.listMongoDBCollectionPartitionMerge", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.begin_retrieve_continuous_backup_information": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.retrieveContinuousBackupInformation", "azure.mgmt.cosmosdb.aio.operations.MongoDBResourcesOperations.begin_retrieve_continuous_backup_information": "Microsoft.DocumentDB.MongoDBCollectionGetResultsOperationGroup.retrieveContinuousBackupInformation", "azure.mgmt.cosmosdb.operations.MongoDBResourcesOperations.get_mongo_role_definition": "Microsoft.DocumentDB.MongoRoleDefinitionGetResultsOperationGroup.getMongoRoleDefinition", @@ -581,6 +763,14 @@ "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_migrate_cassandra_table_to_autoscale": "Microsoft.DocumentDB.CassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraTableToAutoscale", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_migrate_cassandra_table_to_manual_throughput": "Microsoft.DocumentDB.CassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraTableToManualThroughput", "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_migrate_cassandra_table_to_manual_throughput": "Microsoft.DocumentDB.CassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraTableToManualThroughput", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.get_cassandra_view_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.getCassandraViewThroughput", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.get_cassandra_view_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.getCassandraViewThroughput", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_update_cassandra_view_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.updateCassandraViewThroughput", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_update_cassandra_view_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.updateCassandraViewThroughput", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraViewToAutoscale", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_migrate_cassandra_view_to_autoscale": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraViewToAutoscale", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraViewToManualThroughput", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_migrate_cassandra_view_to_manual_throughput": "Microsoft.DocumentDB.ViewCassandraResourcesThroughputSettingsGetResultsOperationGroup.migrateCassandraViewToManualThroughput", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.get_cassandra_keyspace": "Microsoft.DocumentDB.CassandraKeyspaceGetResultsOperationGroup.getCassandraKeyspace", "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.get_cassandra_keyspace": "Microsoft.DocumentDB.CassandraKeyspaceGetResultsOperationGroup.getCassandraKeyspace", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_create_update_cassandra_keyspace": "Microsoft.DocumentDB.CassandraKeyspaceGetResultsOperationGroup.createUpdateCassandraKeyspace", @@ -597,6 +787,14 @@ "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_delete_cassandra_table": "Microsoft.DocumentDB.CassandraTableGetResultsOperationGroup.deleteCassandraTable", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.list_cassandra_tables": "Microsoft.DocumentDB.CassandraTableGetResultsOperationGroup.listCassandraTables", "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.list_cassandra_tables": "Microsoft.DocumentDB.CassandraTableGetResultsOperationGroup.listCassandraTables", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.get_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.getCassandraView", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.get_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.getCassandraView", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_create_update_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.createUpdateCassandraView", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_create_update_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.createUpdateCassandraView", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_delete_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.deleteCassandraView", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.begin_delete_cassandra_view": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.deleteCassandraView", + "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.list_cassandra_views": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.listCassandraViews", + "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.list_cassandra_views": "Microsoft.DocumentDB.CassandraViewGetResultsOperationGroup.listCassandraViews", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.get_cassandra_role_definition": "Microsoft.DocumentDB.CassandraRoleDefinitionResources.getCassandraRoleDefinition", "azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations.get_cassandra_role_definition": "Microsoft.DocumentDB.CassandraRoleDefinitionResources.getCassandraRoleDefinition", "azure.mgmt.cosmosdb.operations.CassandraResourcesOperations.begin_create_update_cassandra_role_definition": "Microsoft.DocumentDB.CassandraRoleDefinitionResources.createUpdateCassandraRoleDefinition", @@ -663,6 +861,38 @@ "azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations.begin_delete_gremlin_role_assignment": "Microsoft.DocumentDB.GremlinRoleAssignmentResources.deleteGremlinRoleAssignment", "azure.mgmt.cosmosdb.operations.GremlinResourcesOperations.list_gremlin_role_assignments": "Microsoft.DocumentDB.GremlinRoleAssignmentResources.listGremlinRoleAssignments", "azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations.list_gremlin_role_assignments": "Microsoft.DocumentDB.GremlinRoleAssignmentResources.listGremlinRoleAssignments", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.get": "Microsoft.DocumentDB.DataTransferJobs.get", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.get": "Microsoft.DocumentDB.DataTransferJobs.get", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.create": "Microsoft.DocumentDB.DataTransferJobs.create", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.create": "Microsoft.DocumentDB.DataTransferJobs.create", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.list_by_database_account": "Microsoft.DocumentDB.DataTransferJobs.listByDatabaseAccount", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.list_by_database_account": "Microsoft.DocumentDB.DataTransferJobs.listByDatabaseAccount", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.pause": "Microsoft.DocumentDB.DataTransferJobs.pause", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.pause": "Microsoft.DocumentDB.DataTransferJobs.pause", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.resume": "Microsoft.DocumentDB.DataTransferJobs.resume", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.resume": "Microsoft.DocumentDB.DataTransferJobs.resume", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.cancel": "Microsoft.DocumentDB.DataTransferJobs.cancel", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.cancel": "Microsoft.DocumentDB.DataTransferJobs.cancel", + "azure.mgmt.cosmosdb.operations.DataTransferJobsOperations.complete": "Microsoft.DocumentDB.DataTransferJobs.complete", + "azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations.complete": "Microsoft.DocumentDB.DataTransferJobs.complete", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.get": "Microsoft.DocumentDB.GarnetClusters.get", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.get": "Microsoft.DocumentDB.GarnetClusters.get", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.begin_create_update": "Microsoft.DocumentDB.GarnetClusters.createUpdate", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.begin_create_update": "Microsoft.DocumentDB.GarnetClusters.createUpdate", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.begin_update": "Microsoft.DocumentDB.GarnetClusters.update", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.begin_update": "Microsoft.DocumentDB.GarnetClusters.update", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.begin_delete": "Microsoft.DocumentDB.GarnetClusters.delete", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.begin_delete": "Microsoft.DocumentDB.GarnetClusters.delete", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.list_by_resource_group": "Microsoft.DocumentDB.GarnetClusters.listByResourceGroup", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.list_by_resource_group": "Microsoft.DocumentDB.GarnetClusters.listByResourceGroup", + "azure.mgmt.cosmosdb.operations.GarnetClustersOperations.list_by_subscription": "Microsoft.DocumentDB.GarnetClusters.listBySubscription", + "azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations.list_by_subscription": "Microsoft.DocumentDB.GarnetClusters.listBySubscription", + "azure.mgmt.cosmosdb.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.cosmosdb.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.cosmosdb.operations.NetworkSecurityPerimeterConfigurationsOperations.list": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.list", + "azure.mgmt.cosmosdb.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.list": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.list", + "azure.mgmt.cosmosdb.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.reconcile", + "azure.mgmt.cosmosdb.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.DocumentDB.NetworkSecurityPerimeterConfigurations.reconcile", "azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations.get": "Microsoft.DocumentDB.NotebookWorkspaces.get", "azure.mgmt.cosmosdb.aio.operations.NotebookWorkspacesOperations.get": "Microsoft.DocumentDB.NotebookWorkspaces.get", "azure.mgmt.cosmosdb.operations.NotebookWorkspacesOperations.begin_create_or_update": "Microsoft.DocumentDB.NotebookWorkspaces.createOrUpdate", @@ -689,6 +919,38 @@ "azure.mgmt.cosmosdb.aio.operations.PrivateLinkResourcesOperations.get": "Microsoft.DocumentDB.PrivateLinkResources.get", "azure.mgmt.cosmosdb.operations.PrivateLinkResourcesOperations.list_by_database_account": "Microsoft.DocumentDB.PrivateLinkResources.listByDatabaseAccount", "azure.mgmt.cosmosdb.aio.operations.PrivateLinkResourcesOperations.list_by_database_account": "Microsoft.DocumentDB.PrivateLinkResources.listByDatabaseAccount", + "azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations.get": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.get", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations.get": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.get", + "azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations.list_by_location": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.listByLocation", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations.list_by_location": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.listByLocation", + "azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations.list_by_resource_group_and_location": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.listByResourceGroupAndLocation", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations.list_by_resource_group_and_location": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.listByResourceGroupAndLocation", + "azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.restore", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.restore", + "azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.purge", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedDatabaseAccounts.purge", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations.get": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.get", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations.get": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.get", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations.list": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.list", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations.list": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.list", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.restore", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.restore", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.purge", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedSqlDatabases.purge", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations.get": "Microsoft.DocumentDB.SoftDeletedSqlContainers.get", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations.get": "Microsoft.DocumentDB.SoftDeletedSqlContainers.get", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations.list": "Microsoft.DocumentDB.SoftDeletedSqlContainers.list", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations.list": "Microsoft.DocumentDB.SoftDeletedSqlContainers.list", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedSqlContainers.restore", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations.begin_restore": "Microsoft.DocumentDB.SoftDeletedSqlContainers.restore", + "azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedSqlContainers.purge", + "azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations.begin_purge": "Microsoft.DocumentDB.SoftDeletedSqlContainers.purge", + "azure.mgmt.cosmosdb.operations.ChaosFaultOperations.get": "Microsoft.DocumentDB.ChaosFaultResources.get", + "azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations.get": "Microsoft.DocumentDB.ChaosFaultResources.get", + "azure.mgmt.cosmosdb.operations.ChaosFaultOperations.begin_enable_disable": "Microsoft.DocumentDB.ChaosFaultResources.enableDisable", + "azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations.begin_enable_disable": "Microsoft.DocumentDB.ChaosFaultResources.enableDisable", + "azure.mgmt.cosmosdb.operations.ChaosFaultOperations.list": "Microsoft.DocumentDB.ChaosFaultResources.list", + "azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations.list": "Microsoft.DocumentDB.ChaosFaultResources.list", "azure.mgmt.cosmosdb.operations.DatabaseOperations.list_metrics": "Microsoft.DocumentDB.DatabaseAccounts.databaseListMetrics", "azure.mgmt.cosmosdb.aio.operations.DatabaseOperations.list_metrics": "Microsoft.DocumentDB.DatabaseAccounts.databaseListMetrics", "azure.mgmt.cosmosdb.operations.DatabaseOperations.list_usages": "Microsoft.DocumentDB.DatabaseAccounts.databaseListUsages", @@ -739,6 +1001,16 @@ "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.list_by_subscription": "Microsoft.DocumentDB.ClusterResources.listBySubscription", "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.begin_invoke_command": "Microsoft.DocumentDB.ClusterResources.invokeCommand", "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.begin_invoke_command": "Microsoft.DocumentDB.ClusterResources.invokeCommand", + "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.begin_invoke_command_async": "Microsoft.DocumentDB.ClusterResources.invokeCommandAsync", + "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.begin_invoke_command_async": "Microsoft.DocumentDB.ClusterResources.invokeCommandAsync", + "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.list_command": "Microsoft.DocumentDB.ClusterResources.listCommand", + "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.list_command": "Microsoft.DocumentDB.ClusterResources.listCommand", + "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.get_command_async": "Microsoft.DocumentDB.ClusterResources.getCommandAsync", + "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.get_command_async": "Microsoft.DocumentDB.ClusterResources.getCommandAsync", + "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.list_backups": "Microsoft.DocumentDB.ClusterResources.listBackups", + "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.list_backups": "Microsoft.DocumentDB.ClusterResources.listBackups", + "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.get_backup": "Microsoft.DocumentDB.ClusterResources.getBackup", + "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.get_backup": "Microsoft.DocumentDB.ClusterResources.getBackup", "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.begin_deallocate": "Microsoft.DocumentDB.ClusterResources.deallocate", "azure.mgmt.cosmosdb.aio.operations.CassandraClustersOperations.begin_deallocate": "Microsoft.DocumentDB.ClusterResources.deallocate", "azure.mgmt.cosmosdb.operations.CassandraClustersOperations.begin_start": "Microsoft.DocumentDB.ClusterResources.start", @@ -791,6 +1063,26 @@ "azure.mgmt.cosmosdb.aio.operations.ServiceOperations.begin_delete": "Microsoft.DocumentDB.ServiceResources.delete", "azure.mgmt.cosmosdb.operations.ServiceOperations.list": "Microsoft.DocumentDB.ServiceResources.list", "azure.mgmt.cosmosdb.aio.operations.ServiceOperations.list": "Microsoft.DocumentDB.ServiceResources.list", + "azure.mgmt.cosmosdb.operations.ThroughputPoolOperations.get": "Microsoft.DocumentDB.ThroughputPoolResources.get", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations.get": "Microsoft.DocumentDB.ThroughputPoolResources.get", + "azure.mgmt.cosmosdb.operations.ThroughputPoolOperations.begin_create_or_update": "Microsoft.DocumentDB.ThroughputPoolResources.createOrUpdate", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations.begin_create_or_update": "Microsoft.DocumentDB.ThroughputPoolResources.createOrUpdate", + "azure.mgmt.cosmosdb.operations.ThroughputPoolOperations.begin_update": "Microsoft.DocumentDB.ThroughputPoolResources.update", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations.begin_update": "Microsoft.DocumentDB.ThroughputPoolResources.update", + "azure.mgmt.cosmosdb.operations.ThroughputPoolOperations.begin_delete": "Microsoft.DocumentDB.ThroughputPoolResources.delete", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations.begin_delete": "Microsoft.DocumentDB.ThroughputPoolResources.delete", + "azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations.list_by_resource_group": "Microsoft.DocumentDB.ThroughputPoolResources.listByResourceGroup", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolsOperations.list_by_resource_group": "Microsoft.DocumentDB.ThroughputPoolResources.listByResourceGroup", + "azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations.list": "Microsoft.DocumentDB.ThroughputPoolResources.list", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolsOperations.list": "Microsoft.DocumentDB.ThroughputPoolResources.list", + "azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations.get": "Microsoft.DocumentDB.ThroughputPoolAccountResources.get", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations.get": "Microsoft.DocumentDB.ThroughputPoolAccountResources.get", + "azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations.begin_create": "Microsoft.DocumentDB.ThroughputPoolAccountResources.create", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations.begin_create": "Microsoft.DocumentDB.ThroughputPoolAccountResources.create", + "azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations.begin_delete": "Microsoft.DocumentDB.ThroughputPoolAccountResources.delete", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations.begin_delete": "Microsoft.DocumentDB.ThroughputPoolAccountResources.delete", + "azure.mgmt.cosmosdb.operations.ThroughputPoolAccountsOperations.list": "Microsoft.DocumentDB.ThroughputPoolAccountResources.list", + "azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountsOperations.list": "Microsoft.DocumentDB.ThroughputPoolAccountResources.list", "azure.mgmt.cosmosdb.operations.MongoMIResourcesOperations.get_mongo_mi_role_definition": "Microsoft.DocumentDB.MongoMIRoleDefinitionResources.getMongoMIRoleDefinition", "azure.mgmt.cosmosdb.aio.operations.MongoMIResourcesOperations.get_mongo_mi_role_definition": "Microsoft.DocumentDB.MongoMIRoleDefinitionResources.getMongoMIRoleDefinition", "azure.mgmt.cosmosdb.operations.MongoMIResourcesOperations.begin_create_update_mongo_mi_role_definition": "Microsoft.DocumentDB.MongoMIRoleDefinitionResources.createUpdateMongoMIRoleDefinition", @@ -819,6 +1111,14 @@ "azure.mgmt.cosmosdb.aio.operations.FleetOperations.list_by_resource_group": "Microsoft.DocumentDB.FleetResources.listByResourceGroup", "azure.mgmt.cosmosdb.operations.FleetOperations.list": "Microsoft.DocumentDB.FleetResources.list", "azure.mgmt.cosmosdb.aio.operations.FleetOperations.list": "Microsoft.DocumentDB.FleetResources.list", + "azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations.get": "Microsoft.DocumentDB.FleetAnalyticsResources.get", + "azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations.get": "Microsoft.DocumentDB.FleetAnalyticsResources.get", + "azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations.create": "Microsoft.DocumentDB.FleetAnalyticsResources.create", + "azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations.create": "Microsoft.DocumentDB.FleetAnalyticsResources.create", + "azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations.begin_delete": "Microsoft.DocumentDB.FleetAnalyticsResources.delete", + "azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations.begin_delete": "Microsoft.DocumentDB.FleetAnalyticsResources.delete", + "azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations.list": "Microsoft.DocumentDB.FleetAnalyticsResources.list", + "azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations.list": "Microsoft.DocumentDB.FleetAnalyticsResources.list", "azure.mgmt.cosmosdb.operations.FleetspaceOperations.get": "Microsoft.DocumentDB.FleetspaceResources.get", "azure.mgmt.cosmosdb.aio.operations.FleetspaceOperations.get": "Microsoft.DocumentDB.FleetspaceResources.get", "azure.mgmt.cosmosdb.operations.FleetspaceOperations.begin_create": "Microsoft.DocumentDB.FleetspaceResources.create", @@ -838,5 +1138,5 @@ "azure.mgmt.cosmosdb.operations.FleetspaceAccountOperations.list": "Microsoft.DocumentDB.FleetspaceAccountResources.list", "azure.mgmt.cosmosdb.aio.operations.FleetspaceAccountOperations.list": "Microsoft.DocumentDB.FleetspaceAccountResources.list" }, - "CrossLanguageVersion": "3b6896c407fd" + "CrossLanguageVersion": "f8868ace270b" } \ No newline at end of file diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_client.py index 78130cd719fc..8f496e16df44 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_client.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -23,20 +24,27 @@ CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, + ChaosFaultOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, + CopyJobsOperations, + DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, + FleetAnalyticsOperations, FleetOperations, FleetspaceAccountOperations, FleetspaceOperations, + GarnetClustersOperations, + GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, MongoMIResourcesOperations, + NetworkSecurityPerimeterConfigurationsOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, @@ -59,8 +67,15 @@ RestorableTableResourcesOperations, RestorableTablesOperations, ServiceOperations, + SoftDeletedDatabaseAccountsOperations, + SoftDeletedSqlContainersOperations, + SoftDeletedSqlDatabasesOperations, SqlResourcesOperations, TableResourcesOperations, + ThroughputPoolAccountOperations, + ThroughputPoolAccountsOperations, + ThroughputPoolOperations, + ThroughputPoolsOperations, ) if sys.version_info >= (3, 11): @@ -73,13 +88,17 @@ from azure.core.credentials import TokenCredential -class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes +class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Azure Cosmos DB Throughput Pool REST API. :ivar operations: Operations operations :vartype operations: azure.mgmt.cosmosdb.operations.Operations :ivar database_accounts: DatabaseAccountsOperations operations :vartype database_accounts: azure.mgmt.cosmosdb.operations.DatabaseAccountsOperations + :ivar copy_jobs: CopyJobsOperations operations + :vartype copy_jobs: azure.mgmt.cosmosdb.operations.CopyJobsOperations + :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 @@ -90,6 +109,14 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes :vartype cassandra_resources: azure.mgmt.cosmosdb.operations.CassandraResourcesOperations :ivar gremlin_resources: GremlinResourcesOperations operations :vartype gremlin_resources: azure.mgmt.cosmosdb.operations.GremlinResourcesOperations + :ivar data_transfer_jobs: DataTransferJobsOperations operations + :vartype data_transfer_jobs: azure.mgmt.cosmosdb.operations.DataTransferJobsOperations + :ivar garnet_clusters: GarnetClustersOperations operations + :vartype garnet_clusters: azure.mgmt.cosmosdb.operations.GarnetClustersOperations + :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 @@ -97,6 +124,17 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes azure.mgmt.cosmosdb.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cosmosdb.operations.PrivateLinkResourcesOperations + :ivar soft_deleted_database_accounts: SoftDeletedDatabaseAccountsOperations operations + :vartype soft_deleted_database_accounts: + azure.mgmt.cosmosdb.operations.SoftDeletedDatabaseAccountsOperations + :ivar soft_deleted_sql_databases: SoftDeletedSqlDatabasesOperations operations + :vartype soft_deleted_sql_databases: + azure.mgmt.cosmosdb.operations.SoftDeletedSqlDatabasesOperations + :ivar soft_deleted_sql_containers: SoftDeletedSqlContainersOperations operations + :vartype soft_deleted_sql_containers: + azure.mgmt.cosmosdb.operations.SoftDeletedSqlContainersOperations + :ivar chaos_fault: ChaosFaultOperations operations + :vartype chaos_fault: azure.mgmt.cosmosdb.operations.ChaosFaultOperations :ivar database: DatabaseOperations operations :vartype database: azure.mgmt.cosmosdb.operations.DatabaseOperations :ivar collection: CollectionOperations operations @@ -166,10 +204,22 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes azure.mgmt.cosmosdb.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.operations.ServiceOperations + :ivar throughput_pool: ThroughputPoolOperations operations + :vartype throughput_pool: azure.mgmt.cosmosdb.operations.ThroughputPoolOperations + :ivar throughput_pools: ThroughputPoolsOperations operations + :vartype throughput_pools: azure.mgmt.cosmosdb.operations.ThroughputPoolsOperations + :ivar throughput_pool_account: ThroughputPoolAccountOperations operations + :vartype throughput_pool_account: + azure.mgmt.cosmosdb.operations.ThroughputPoolAccountOperations + :ivar throughput_pool_accounts: ThroughputPoolAccountsOperations operations + :vartype throughput_pool_accounts: + azure.mgmt.cosmosdb.operations.ThroughputPoolAccountsOperations :ivar mongo_mi_resources: MongoMIResourcesOperations operations :vartype mongo_mi_resources: azure.mgmt.cosmosdb.operations.MongoMIResourcesOperations :ivar fleet: FleetOperations operations :vartype fleet: azure.mgmt.cosmosdb.operations.FleetOperations + :ivar fleet_analytics: FleetAnalyticsOperations operations + :vartype fleet_analytics: azure.mgmt.cosmosdb.operations.FleetAnalyticsOperations :ivar fleetspace: FleetspaceOperations operations :vartype fleetspace: azure.mgmt.cosmosdb.operations.FleetspaceOperations :ivar fleetspace_account: FleetspaceAccountOperations operations @@ -183,9 +233,10 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" - and None. Default value is None. If not set, the operation's default API version will be used. - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-04-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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. @@ -242,6 +293,8 @@ def __init__( self.database_accounts = DatabaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.copy_jobs = CopyJobsOperations(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 @@ -253,6 +306,13 @@ def __init__( self.gremlin_resources = GremlinResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.data_transfer_jobs = DataTransferJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.garnet_clusters = GarnetClustersOperations(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 ) @@ -262,6 +322,16 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.soft_deleted_database_accounts = SoftDeletedDatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.soft_deleted_sql_databases = SoftDeletedSqlDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.soft_deleted_sql_containers = SoftDeletedSqlContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.chaos_fault = ChaosFaultOperations(self._client, self._config, self._serialize, self._deserialize) self.database = DatabaseOperations(self._client, self._config, self._serialize, self._deserialize) self.collection = CollectionOperations(self._client, self._config, self._serialize, self._deserialize) self.collection_region = CollectionRegionOperations( @@ -333,10 +403,21 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pool = ThroughputPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pools = ThroughputPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_account = ThroughputPoolAccountOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_accounts = ThroughputPoolAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.mongo_mi_resources = MongoMIResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.fleet = FleetOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_analytics = FleetAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.fleetspace = FleetspaceOperations(self._client, self._config, self._serialize, self._deserialize) self.fleetspace_account = FleetspaceAccountOperations( self._client, self._config, self._serialize, self._deserialize 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 ecdb24da379c..0c2dfff69e53 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_configuration.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,7 +19,7 @@ from azure.core.credentials import TokenCredential -class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes +class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for CosmosDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -33,9 +34,10 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" - and None. Default value is None. If not set, the operation's default API version will be used. - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-04-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +49,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-03-15") + api_version: str = kwargs.pop("api_version", "2026-04-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/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/model_base.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/model_base.py index a79d3782e99c..88aaf1823543 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/model_base.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/model_base.py @@ -158,7 +158,15 @@ def _is_readonly(p): class SdkJSONEncoder(JSONEncoder): - """A JSON encoder that's capable of serializing datetime objects and bytes.""" + """A JSON encoder that's capable of serializing datetime objects and bytes. + + :param args: Additional positional arguments passed to the base ``JSONEncoder``. + :type args: typing.Any + :keyword exclude_readonly: Whether to exclude readonly properties. Defaults to False. + :paramtype exclude_readonly: bool + :keyword format: The format to use for serialization. Defaults to None. + :paramtype format: typing.Optional[str] + """ def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): super().__init__(*args, **kwargs) @@ -342,6 +350,12 @@ def _deserialize_int_as_str(attr): return int(attr) +def _deserialize_bool_as_str(attr): + if isinstance(attr, bool): + return attr + return attr.lower() == "true" + + _DESERIALIZE_MAPPING = { datetime: _deserialize_datetime, date: _deserialize_date, @@ -369,6 +383,8 @@ def _deserialize_int_as_str(attr): def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is bool and rf and rf._format == "str": + return _deserialize_bool_as_str if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: @@ -458,21 +474,21 @@ def __ne__(self, other: typing.Any) -> bool: def keys(self) -> typing.KeysView[str]: """ - :returns: a set-like object providing a view on D's keys + :returns: a set-like object providing a view on the mapping's keys :rtype: ~typing.KeysView """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: """ - :returns: an object providing a view on D's values + :returns: an object providing a view on the mapping's values :rtype: ~typing.ValuesView """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: """ - :returns: set-like object providing a view on D's items + :returns: a set-like object providing a view on the mapping's items :rtype: ~typing.ItemsView """ return self._data.items() @@ -482,7 +498,7 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ try: @@ -517,19 +533,19 @@ def popitem(self) -> tuple[str, typing.Any]: Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple - :raises KeyError: if D is empty. + :raises KeyError: if the dictionary is empty. """ return self._data.popitem() def clear(self) -> None: """ - Remove all items from D. + Remove all items from the dictionary. """ self._data.clear() def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ - Updates D from mapping/iterable E and F. + Update the dictionary from a mapping or an iterable of key-value pairs. :param any args: Either a mapping object or an iterable of key-value pairs. """ self._data.update(*args, **kwargs) @@ -542,10 +558,11 @@ def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ - Same as calling D.get(k, d), and setting D[k]=d if k not found + Return the value for key if key is in the dictionary; otherwise set the key to + default and return default. :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary - :returns: D[k] if k in D, else d. + :returns: The value for key if key is in the dictionary, else default. :rtype: any """ if default is _UNSET: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/serialization.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/serialization.py index 75906e2eb77f..ae08f9d89f74 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/serialization.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_utils/serialization.py @@ -480,7 +480,11 @@ def _decode_attribute_map_key(key): class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" + """Request object model serializer. + + :param classes: Mapping of model names to model types, used to resolve models during serialization. + :type classes: typing.Optional[typing.Mapping[str, type]] + """ basic_types = {str: "str", int: "int", bool: "bool", float: "float"} diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_validation.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator 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 31ee4ffef3bd..619a96301629 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 = "10.0.0" +VERSION = "10.1.0b1" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_client.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_client.py index 5ec21efa1013..938de4142a41 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_client.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_client.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -23,20 +24,27 @@ CassandraClustersOperations, CassandraDataCentersOperations, CassandraResourcesOperations, + ChaosFaultOperations, CollectionOperations, CollectionPartitionOperations, CollectionPartitionRegionOperations, CollectionRegionOperations, + CopyJobsOperations, + DataTransferJobsOperations, DatabaseAccountRegionOperations, DatabaseAccountsOperations, DatabaseOperations, + FleetAnalyticsOperations, FleetOperations, FleetspaceAccountOperations, FleetspaceOperations, + GarnetClustersOperations, + GraphResourcesOperations, GremlinResourcesOperations, LocationsOperations, MongoDBResourcesOperations, MongoMIResourcesOperations, + NetworkSecurityPerimeterConfigurationsOperations, NotebookWorkspacesOperations, Operations, PartitionKeyRangeIdOperations, @@ -59,8 +67,15 @@ RestorableTableResourcesOperations, RestorableTablesOperations, ServiceOperations, + SoftDeletedDatabaseAccountsOperations, + SoftDeletedSqlContainersOperations, + SoftDeletedSqlDatabasesOperations, SqlResourcesOperations, TableResourcesOperations, + ThroughputPoolAccountOperations, + ThroughputPoolAccountsOperations, + ThroughputPoolOperations, + ThroughputPoolsOperations, ) if sys.version_info >= (3, 11): @@ -73,13 +88,17 @@ from azure.core.credentials_async import AsyncTokenCredential -class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes +class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Azure Cosmos DB Throughput Pool REST API. :ivar operations: Operations operations :vartype operations: azure.mgmt.cosmosdb.aio.operations.Operations :ivar database_accounts: DatabaseAccountsOperations operations :vartype database_accounts: azure.mgmt.cosmosdb.aio.operations.DatabaseAccountsOperations + :ivar copy_jobs: CopyJobsOperations operations + :vartype copy_jobs: azure.mgmt.cosmosdb.aio.operations.CopyJobsOperations + :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 @@ -90,6 +109,14 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes :vartype cassandra_resources: azure.mgmt.cosmosdb.aio.operations.CassandraResourcesOperations :ivar gremlin_resources: GremlinResourcesOperations operations :vartype gremlin_resources: azure.mgmt.cosmosdb.aio.operations.GremlinResourcesOperations + :ivar data_transfer_jobs: DataTransferJobsOperations operations + :vartype data_transfer_jobs: azure.mgmt.cosmosdb.aio.operations.DataTransferJobsOperations + :ivar garnet_clusters: GarnetClustersOperations operations + :vartype garnet_clusters: azure.mgmt.cosmosdb.aio.operations.GarnetClustersOperations + :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 @@ -98,6 +125,17 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.cosmosdb.aio.operations.PrivateLinkResourcesOperations + :ivar soft_deleted_database_accounts: SoftDeletedDatabaseAccountsOperations operations + :vartype soft_deleted_database_accounts: + azure.mgmt.cosmosdb.aio.operations.SoftDeletedDatabaseAccountsOperations + :ivar soft_deleted_sql_databases: SoftDeletedSqlDatabasesOperations operations + :vartype soft_deleted_sql_databases: + azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlDatabasesOperations + :ivar soft_deleted_sql_containers: SoftDeletedSqlContainersOperations operations + :vartype soft_deleted_sql_containers: + azure.mgmt.cosmosdb.aio.operations.SoftDeletedSqlContainersOperations + :ivar chaos_fault: ChaosFaultOperations operations + :vartype chaos_fault: azure.mgmt.cosmosdb.aio.operations.ChaosFaultOperations :ivar database: DatabaseOperations operations :vartype database: azure.mgmt.cosmosdb.aio.operations.DatabaseOperations :ivar collection: CollectionOperations operations @@ -169,10 +207,22 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes azure.mgmt.cosmosdb.aio.operations.RestorableTableResourcesOperations :ivar service: ServiceOperations operations :vartype service: azure.mgmt.cosmosdb.aio.operations.ServiceOperations + :ivar throughput_pool: ThroughputPoolOperations operations + :vartype throughput_pool: azure.mgmt.cosmosdb.aio.operations.ThroughputPoolOperations + :ivar throughput_pools: ThroughputPoolsOperations operations + :vartype throughput_pools: azure.mgmt.cosmosdb.aio.operations.ThroughputPoolsOperations + :ivar throughput_pool_account: ThroughputPoolAccountOperations operations + :vartype throughput_pool_account: + azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountOperations + :ivar throughput_pool_accounts: ThroughputPoolAccountsOperations operations + :vartype throughput_pool_accounts: + azure.mgmt.cosmosdb.aio.operations.ThroughputPoolAccountsOperations :ivar mongo_mi_resources: MongoMIResourcesOperations operations :vartype mongo_mi_resources: azure.mgmt.cosmosdb.aio.operations.MongoMIResourcesOperations :ivar fleet: FleetOperations operations :vartype fleet: azure.mgmt.cosmosdb.aio.operations.FleetOperations + :ivar fleet_analytics: FleetAnalyticsOperations operations + :vartype fleet_analytics: azure.mgmt.cosmosdb.aio.operations.FleetAnalyticsOperations :ivar fleetspace: FleetspaceOperations operations :vartype fleetspace: azure.mgmt.cosmosdb.aio.operations.FleetspaceOperations :ivar fleetspace_account: FleetspaceAccountOperations operations @@ -186,9 +236,10 @@ class CosmosDBManagementClient: # pylint: disable=too-many-instance-attributes :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" - and None. Default value is None. If not set, the operation's default API version will be used. - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-04-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. 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. @@ -247,6 +298,8 @@ def __init__( self.database_accounts = DatabaseAccountsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.copy_jobs = CopyJobsOperations(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 @@ -258,6 +311,13 @@ def __init__( self.gremlin_resources = GremlinResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.data_transfer_jobs = DataTransferJobsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.garnet_clusters = GarnetClustersOperations(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 ) @@ -267,6 +327,16 @@ def __init__( self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.soft_deleted_database_accounts = SoftDeletedDatabaseAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.soft_deleted_sql_databases = SoftDeletedSqlDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.soft_deleted_sql_containers = SoftDeletedSqlContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.chaos_fault = ChaosFaultOperations(self._client, self._config, self._serialize, self._deserialize) self.database = DatabaseOperations(self._client, self._config, self._serialize, self._deserialize) self.collection = CollectionOperations(self._client, self._config, self._serialize, self._deserialize) self.collection_region = CollectionRegionOperations( @@ -338,10 +408,21 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pool = ThroughputPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.throughput_pools = ThroughputPoolsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_account = ThroughputPoolAccountOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.throughput_pool_accounts = ThroughputPoolAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.mongo_mi_resources = MongoMIResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) self.fleet = FleetOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_analytics = FleetAnalyticsOperations(self._client, self._config, self._serialize, self._deserialize) self.fleetspace = FleetspaceOperations(self._client, self._config, self._serialize, self._deserialize) self.fleetspace_account = FleetspaceAccountOperations( self._client, self._config, self._serialize, self._deserialize 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 46f32580a6f5..9ff847418e85 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -18,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes +class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,docstring-keyword-should-match-keyword-only """Configuration for CosmosDBManagementClient. Note that all parameters used to create this instance are saved as instance @@ -33,9 +34,10 @@ class CosmosDBManagementClientConfiguration: # pylint: disable=too-many-instanc :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" - and None. Default value is None. If not set, the operation's default API version will be used. - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Known values are + "2026-04-01-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -47,7 +49,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2026-03-15") + api_version: str = kwargs.pop("api_version", "2026-04-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/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level 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 fa812606dc52..307a22ea7774 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 @@ -14,14 +14,23 @@ from ._operations import Operations # type: ignore from ._operations import DatabaseAccountsOperations # type: ignore +from ._operations import CopyJobsOperations # type: ignore +from ._operations import GraphResourcesOperations # type: ignore from ._operations import SqlResourcesOperations # type: ignore from ._operations import MongoDBResourcesOperations # type: ignore from ._operations import TableResourcesOperations # type: ignore from ._operations import CassandraResourcesOperations # type: ignore from ._operations import GremlinResourcesOperations # type: ignore +from ._operations import DataTransferJobsOperations # type: ignore +from ._operations import GarnetClustersOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore from ._operations import NotebookWorkspacesOperations # type: ignore from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import SoftDeletedDatabaseAccountsOperations # type: ignore +from ._operations import SoftDeletedSqlDatabasesOperations # type: ignore +from ._operations import SoftDeletedSqlContainersOperations # type: ignore +from ._operations import ChaosFaultOperations # type: ignore from ._operations import DatabaseOperations # type: ignore from ._operations import CollectionOperations # type: ignore from ._operations import CollectionRegionOperations # type: ignore @@ -49,8 +58,13 @@ from ._operations import RestorableTablesOperations # type: ignore from ._operations import RestorableTableResourcesOperations # type: ignore from ._operations import ServiceOperations # type: ignore +from ._operations import ThroughputPoolOperations # type: ignore +from ._operations import ThroughputPoolsOperations # type: ignore +from ._operations import ThroughputPoolAccountOperations # type: ignore +from ._operations import ThroughputPoolAccountsOperations # type: ignore from ._operations import MongoMIResourcesOperations # type: ignore from ._operations import FleetOperations # type: ignore +from ._operations import FleetAnalyticsOperations # type: ignore from ._operations import FleetspaceOperations # type: ignore from ._operations import FleetspaceAccountOperations # type: ignore @@ -61,14 +75,23 @@ __all__ = [ "Operations", "DatabaseAccountsOperations", + "CopyJobsOperations", + "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", + "DataTransferJobsOperations", + "GarnetClustersOperations", + "NetworkSecurityPerimeterConfigurationsOperations", "NotebookWorkspacesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", + "SoftDeletedDatabaseAccountsOperations", + "SoftDeletedSqlDatabasesOperations", + "SoftDeletedSqlContainersOperations", + "ChaosFaultOperations", "DatabaseOperations", "CollectionOperations", "CollectionRegionOperations", @@ -96,8 +119,13 @@ "RestorableTablesOperations", "RestorableTableResourcesOperations", "ServiceOperations", + "ThroughputPoolOperations", + "ThroughputPoolsOperations", + "ThroughputPoolAccountOperations", + "ThroughputPoolAccountsOperations", "MongoMIResourcesOperations", "FleetOperations", + "FleetAnalyticsOperations", "FleetspaceOperations", "FleetspaceAccountOperations", ] 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 7ade07607f79..44c2c0b46f06 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 @@ -36,14 +36,20 @@ from ... import models as _models, types as _types from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer +from ..._validation import api_version_validation from ...operations._operations import ( build_cassandra_clusters_create_update_request, build_cassandra_clusters_deallocate_request, build_cassandra_clusters_delete_request, + build_cassandra_clusters_get_backup_request, + build_cassandra_clusters_get_command_async_request, build_cassandra_clusters_get_request, + build_cassandra_clusters_invoke_command_async_request, build_cassandra_clusters_invoke_command_request, + build_cassandra_clusters_list_backups_request, build_cassandra_clusters_list_by_resource_group_request, build_cassandra_clusters_list_by_subscription_request, + build_cassandra_clusters_list_command_request, build_cassandra_clusters_start_request, build_cassandra_clusters_status_request, build_cassandra_clusters_update_request, @@ -56,26 +62,37 @@ build_cassandra_resources_create_update_cassandra_role_assignment_request, build_cassandra_resources_create_update_cassandra_role_definition_request, build_cassandra_resources_create_update_cassandra_table_request, + build_cassandra_resources_create_update_cassandra_view_request, build_cassandra_resources_delete_cassandra_keyspace_request, build_cassandra_resources_delete_cassandra_role_assignment_request, build_cassandra_resources_delete_cassandra_role_definition_request, build_cassandra_resources_delete_cassandra_table_request, + build_cassandra_resources_delete_cassandra_view_request, build_cassandra_resources_get_cassandra_keyspace_request, build_cassandra_resources_get_cassandra_keyspace_throughput_request, build_cassandra_resources_get_cassandra_role_assignment_request, build_cassandra_resources_get_cassandra_role_definition_request, build_cassandra_resources_get_cassandra_table_request, build_cassandra_resources_get_cassandra_table_throughput_request, + build_cassandra_resources_get_cassandra_view_request, + build_cassandra_resources_get_cassandra_view_throughput_request, build_cassandra_resources_list_cassandra_keyspaces_request, build_cassandra_resources_list_cassandra_role_assignments_request, build_cassandra_resources_list_cassandra_role_definitions_request, build_cassandra_resources_list_cassandra_tables_request, + build_cassandra_resources_list_cassandra_views_request, build_cassandra_resources_migrate_cassandra_keyspace_to_autoscale_request, build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_request, build_cassandra_resources_migrate_cassandra_table_to_autoscale_request, build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_request, + build_cassandra_resources_migrate_cassandra_view_to_autoscale_request, + build_cassandra_resources_migrate_cassandra_view_to_manual_throughput_request, build_cassandra_resources_update_cassandra_keyspace_throughput_request, build_cassandra_resources_update_cassandra_table_throughput_request, + build_cassandra_resources_update_cassandra_view_throughput_request, + build_chaos_fault_enable_disable_request, + build_chaos_fault_get_request, + build_chaos_fault_list_request, build_collection_list_metric_definitions_request, build_collection_list_metrics_request, build_collection_list_usages_request, @@ -83,6 +100,20 @@ build_collection_partition_list_usages_request, build_collection_partition_region_list_metrics_request, build_collection_region_list_metrics_request, + build_copy_jobs_cancel_request, + build_copy_jobs_complete_request, + build_copy_jobs_create_request, + build_copy_jobs_get_request, + build_copy_jobs_list_by_database_account_request, + build_copy_jobs_pause_request, + build_copy_jobs_resume_request, + build_data_transfer_jobs_cancel_request, + build_data_transfer_jobs_complete_request, + build_data_transfer_jobs_create_request, + build_data_transfer_jobs_get_request, + build_data_transfer_jobs_list_by_database_account_request, + build_data_transfer_jobs_pause_request, + build_data_transfer_jobs_resume_request, build_database_account_region_list_metrics_request, build_database_accounts_check_name_exists_request, build_database_accounts_create_or_update_request, @@ -105,6 +136,10 @@ build_database_list_metric_definitions_request, build_database_list_metrics_request, build_database_list_usages_request, + build_fleet_analytics_create_request, + build_fleet_analytics_delete_request, + build_fleet_analytics_get_request, + build_fleet_analytics_list_request, build_fleet_create_request, build_fleet_delete_request, build_fleet_get_request, @@ -120,6 +155,16 @@ build_fleetspace_get_request, build_fleetspace_list_request, build_fleetspace_update_request, + build_garnet_clusters_create_update_request, + build_garnet_clusters_delete_request, + build_garnet_clusters_get_request, + build_garnet_clusters_list_by_resource_group_request, + build_garnet_clusters_list_by_subscription_request, + build_garnet_clusters_update_request, + build_graph_resources_create_update_graph_request, + build_graph_resources_delete_graph_resource_request, + build_graph_resources_get_graph_request, + build_graph_resources_list_graphs_request, build_gremlin_resources_create_update_gremlin_database_request, build_gremlin_resources_create_update_gremlin_graph_request, build_gremlin_resources_create_update_gremlin_role_assignment_request, @@ -161,6 +206,7 @@ build_mongo_db_resources_get_mongo_db_database_throughput_request, build_mongo_db_resources_get_mongo_role_definition_request, build_mongo_db_resources_get_mongo_user_definition_request, + build_mongo_db_resources_list_mongo_db_collection_partition_merge_request, build_mongo_db_resources_list_mongo_db_collections_request, build_mongo_db_resources_list_mongo_db_databases_request, build_mongo_db_resources_list_mongo_role_definitions_request, @@ -169,6 +215,11 @@ build_mongo_db_resources_migrate_mongo_db_collection_to_manual_throughput_request, build_mongo_db_resources_migrate_mongo_db_database_to_autoscale_request, build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_request, + build_mongo_db_resources_mongo_db_container_redistribute_throughput_request, + build_mongo_db_resources_mongo_db_container_retrieve_throughput_distribution_request, + build_mongo_db_resources_mongo_db_database_partition_merge_request, + build_mongo_db_resources_mongo_db_database_redistribute_throughput_request, + build_mongo_db_resources_mongo_db_database_retrieve_throughput_distribution_request, build_mongo_db_resources_retrieve_continuous_backup_information_request, build_mongo_db_resources_update_mongo_db_collection_throughput_request, build_mongo_db_resources_update_mongo_db_database_throughput_request, @@ -180,6 +231,9 @@ build_mongo_mi_resources_get_mongo_mi_role_definition_request, build_mongo_mi_resources_list_mongo_mi_role_assignments_request, build_mongo_mi_resources_list_mongo_mi_role_definitions_request, + build_network_security_perimeter_configurations_get_request, + build_network_security_perimeter_configurations_list_request, + build_network_security_perimeter_configurations_reconcile_request, build_notebook_workspaces_create_or_update_request, build_notebook_workspaces_delete_request, build_notebook_workspaces_get_request, @@ -217,6 +271,19 @@ build_service_delete_request, build_service_get_request, build_service_list_request, + build_soft_deleted_database_accounts_get_request, + build_soft_deleted_database_accounts_list_by_location_request, + build_soft_deleted_database_accounts_list_by_resource_group_and_location_request, + build_soft_deleted_database_accounts_purge_request, + build_soft_deleted_database_accounts_restore_request, + build_soft_deleted_sql_containers_get_request, + build_soft_deleted_sql_containers_list_request, + build_soft_deleted_sql_containers_purge_request, + build_soft_deleted_sql_containers_restore_request, + build_soft_deleted_sql_databases_get_request, + build_soft_deleted_sql_databases_list_request, + build_soft_deleted_sql_databases_purge_request, + build_soft_deleted_sql_databases_restore_request, build_sql_resources_create_update_client_encryption_key_request, build_sql_resources_create_update_sql_container_request, build_sql_resources_create_update_sql_database_request, @@ -243,6 +310,7 @@ build_sql_resources_get_sql_trigger_request, build_sql_resources_get_sql_user_defined_function_request, build_sql_resources_list_client_encryption_keys_request, + build_sql_resources_list_sql_container_partition_merge_request, build_sql_resources_list_sql_containers_request, build_sql_resources_list_sql_databases_request, build_sql_resources_list_sql_role_assignments_request, @@ -255,6 +323,11 @@ build_sql_resources_migrate_sql_database_to_autoscale_request, build_sql_resources_migrate_sql_database_to_manual_throughput_request, build_sql_resources_retrieve_continuous_backup_information_request, + build_sql_resources_sql_container_redistribute_throughput_request, + build_sql_resources_sql_container_retrieve_throughput_distribution_request, + build_sql_resources_sql_database_partition_merge_request, + build_sql_resources_sql_database_redistribute_throughput_request, + build_sql_resources_sql_database_retrieve_throughput_distribution_request, build_sql_resources_update_sql_container_throughput_request, build_sql_resources_update_sql_database_throughput_request, build_table_resources_create_update_table_request, @@ -274,6 +347,16 @@ build_table_resources_migrate_table_to_manual_throughput_request, build_table_resources_retrieve_continuous_backup_information_request, build_table_resources_update_table_throughput_request, + build_throughput_pool_account_create_request, + build_throughput_pool_account_delete_request, + build_throughput_pool_account_get_request, + build_throughput_pool_accounts_list_request, + build_throughput_pool_create_or_update_request, + build_throughput_pool_delete_request, + build_throughput_pool_get_request, + build_throughput_pool_update_request, + build_throughput_pools_list_by_resource_group_request, + build_throughput_pools_list_request, ) from .._configuration import CosmosDBManagementClientConfiguration @@ -282,7 +365,7 @@ List = list -class Operations: +class Operations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -392,7 +475,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods +class DatabaseAccountsOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -2894,14 +2977,14 @@ async def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: return 200 <= response.status_code <= 299 -class SqlResourcesOperations: # pylint: disable=too-many-public-methods +class CopyJobsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`sql_resources` attribute. + :attr:`copy_jobs` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -2912,21 +2995,34 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_sql_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.SqlDatabaseGetResults: - """Gets the SQL database under an existing Azure Cosmos DB database account with the provided - name. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def get( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Get a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: SqlDatabaseGetResults. The SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -2940,12 +3036,12 @@ async def get_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_database_request( + _request = build_copy_jobs_get_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -2972,7 +3068,7 @@ async def get_sql_database( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -2980,279 +3076,143 @@ async def get_sql_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_sql_database_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - create_update_sql_database_parameters: Union[ - _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(create_update_sql_database_parameters, (IOBase, bytes)): - _content = create_update_sql_database_parameters - else: - _content = json.dumps(create_update_sql_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_sql_resources_create_update_sql_database_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @overload - async def begin_create_update_sql_database( + async def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: _models.SqlDatabaseCreateUpdateParameters, + job_name: str, + job_create_parameters: _models.CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :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 SqlDatabaseGetResults. The - SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_database( + async def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: _types.SqlDatabaseCreateUpdateParameters, + job_name: str, + job_create_parameters: _types.CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.types.CopyJobGetResults :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 SqlDatabaseGetResults. The - SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_database( + async def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: IO[bytes], + job_name: str, + job_create_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: IO[bytes] + :param job_name: Name of the Copy 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: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The - SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_database( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: Union[ - _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, IO[bytes] - ], + job_name: str, + job_create_parameters: Union[_models.CopyJobGetResults, _types.CopyJobGetResults, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Is either a SqlDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The - SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Is either a CopyJobGetResults type or a IO[bytes] type. Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CopyJobGetResults or + ~azure.mgmt.cosmosdb.types.CopyJobGetResults or IO[bytes] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlDatabaseGetResults] = 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_database_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - create_update_sql_database_parameters=create_update_sql_database_parameters, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SqlDatabaseGetResults].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SqlDatabaseGetResults]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_sql_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3261,17 +3221,27 @@ async def _delete_sql_database_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_database_request( + content_type = content_type or "application/json" + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _content = json.dumps(job_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_copy_jobs_create_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -3281,121 +3251,62 @@ async def _delete_sql_database_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_delete_sql_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes 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 instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_database_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_databases( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_database_account( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SqlDatabaseGetResults"]: - """Lists the SQL databases under an existing Azure Cosmos DB database account. + ) -> AsyncItemPaged["_models.CopyJobGetResults"]: + """Get a list of Copy 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 SqlDatabaseGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: An iterator like instance of CopyJobGetResults + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CopyJobGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SqlDatabaseGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CopyJobGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -3408,7 +3319,7 @@ def list_sql_databases( def prepare_request(next_link=None): if not next_link: - _request = build_sql_resources_list_sql_databases_request( + _request = build_copy_jobs_list_by_database_account_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -3451,7 +3362,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlDatabaseGetResults], + List[_models.CopyJobGetResults], deserialized.get("value", []), ) if cls: @@ -3470,7 +3381,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3480,22 +3391,34 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_sql_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account - with the provided name. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def pause( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Pause a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -3509,12 +3432,12 @@ async def get_sql_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_database_throughput_request( + _request = build_copy_jobs_pause_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -3541,7 +3464,7 @@ async def get_sql_database_throughput( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -3549,23 +3472,44 @@ async def get_sql_database_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_sql_database_throughput_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncIterator[bytes]: + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def resume( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Resumes a Copy 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 Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3574,27 +3518,17 @@ async def _update_sql_database_throughput_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters - else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_update_sql_database_throughput_request( + _request = build_copy_jobs_resume_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -3604,229 +3538,156 @@ async def _update_sql_database_throughput_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @overload - async def begin_update_sql_database_throughput( - self, - resource_group_name: str, - account_name: str, - database_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 database. + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def cancel( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Cancels a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @overload - async def begin_update_sql_database_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) + + _request = build_copy_jobs_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def complete( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Completes an Online Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update_sql_database_throughput( - self, - resource_group_name: str, - account_name: str, - database_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 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 update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update_sql_database_throughput( - self, - resource_group_name: str, - account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], - **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - 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_database_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - update_throughput_parameters=update_throughput_parameters, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -3838,12 +3699,12 @@ async def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-to _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_migrate_sql_database_to_autoscale_request( + _request = build_copy_jobs_complete_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -3855,18 +3716,19 @@ async def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-to _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( _models.CloudError, @@ -3874,243 +3736,64 @@ async def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-to ) 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_migrate_sql_database_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_database_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() 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_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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_sql_resources_migrate_sql_database_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_migrate_sql_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_database_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized +class GraphResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`graph_resources` attribute. + """ - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 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. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :return: GraphResourceGetResults. The GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GraphResourceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4124,13 +3807,12 @@ async def get_sql_container_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_container_throughput_request( + _request = build_graph_resources_get_graph_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - container_name=container_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -4165,21 +3847,35 @@ async def get_sql_container_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.GraphResourceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_sql_container_throughput_initial( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _create_update_graph_initial( self, resource_group_name: str, account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + graph_name: str, + create_update_graph_parameters: Union[ + _models.GraphResourceCreateUpdateParameters, _types.GraphResourceCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -4199,16 +3895,15 @@ async def _update_sql_container_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_graph_parameters, (IOBase, bytes)): + _content = create_update_graph_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_update_sql_container_throughput_request( + _request = build_graph_resources_create_update_graph_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - container_name=container_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -4257,165 +3952,162 @@ async def _update_sql_container_throughput_initial( return deserialized # type: ignore @overload - async def begin_update_sql_container_throughput( + async def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + graph_name: str, + create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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 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 + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_sql_container_throughput( + async def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + graph_name: str, + create_update_graph_parameters: _types.GraphResourceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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 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.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_sql_container_throughput( + async def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: IO[bytes], + graph_name: str, + create_update_graph_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.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 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] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_sql_container_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - container_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + graph_name: str, + create_update_graph_parameters: Union[ + _models.GraphResourceCreateUpdateParameters, _types.GraphResourceCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> 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 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 - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 + ~azure.mgmt.cosmosdb.types.GraphResourceCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_sql_container_throughput_initial( + raw_result = await self._create_update_graph_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, + graph_name=graph_name, + create_update_graph_parameters=create_update_graph_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -4427,7 +4119,7 @@ async def begin_update_sql_container_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.GraphResourceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -4445,18 +4137,31 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.GraphResourceGetResults]( 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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, @@ -4471,11 +4176,10 @@ async def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-t cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_migrate_sql_container_to_autoscale_request( + _request = build_graph_resources_delete_graph_resource_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - container_name=container_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -4494,14 +4198,14 @@ 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 [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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -4521,39 +4225,47 @@ 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( - 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. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_graph_resource_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - container_name=container_name, + graph_name=graph_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -4562,12 +4274,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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -4582,19 +4291,42 @@ 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 + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_graphs( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 GraphResourceGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GraphResourceGetResults]] = kwargs.pop("cls", None) - 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, @@ -4603,142 +4335,104 @@ async def _migrate_sql_container_to_manual_throughput_initial( # pylint: disabl } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_sql_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(next_link=None): + if not 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 - ) + _request = build_graph_resources_list_graphs_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return _request - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GraphResourceGetResults], + deserialized.get("value", []), ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + async def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @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. + return pipeline_response - :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return AsyncItemPaged(get_next, extract_data) - 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, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized +class SqlResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`sql_resources` attribute. + """ - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + async def get_sql_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SqlDatabaseGetResults: + """Gets the SQL database 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. @@ -4747,11 +4441,8 @@ async def get_client_encryption_key( :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. The ClientEncryptionKeyGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults + :return: SqlDatabaseGetResults. The SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -4765,13 +4456,12 @@ async def get_client_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_client_encryption_key_request( + _request = build_sql_resources_get_sql_database_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=self._config.api_version, headers=_headers, @@ -4806,23 +4496,20 @@ async def get_client_encryption_key( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) + deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) 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 _create_update_sql_database_initial( 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, - _types.ClientEncryptionKeyCreateUpdateParameters, - IO[bytes], + create_update_sql_database_parameters: Union[ + _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -4842,16 +4529,15 @@ async def _create_update_client_encryption_key_initial( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(create_update_sql_database_parameters, (IOBase, bytes)): + _content = create_update_sql_database_parameters else: - _content = json.dumps(create_update_client_encryption_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_client_encryption_key_request( + _request = build_sql_resources_create_update_sql_database_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, content_type=content_type, api_version=self._config.api_version, @@ -4900,19 +4586,17 @@ 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_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, + create_update_sql_database_parameters: _models.SqlDatabaseCreateUpdateParameters, *, 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.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4921,36 +4605,31 @@ 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 create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters :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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The + SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _types.ClientEncryptionKeyCreateUpdateParameters, + create_update_sql_database_parameters: _types.SqlDatabaseCreateUpdateParameters, *, 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.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4959,36 +4638,31 @@ 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.types.ClientEncryptionKeyCreateUpdateParameters + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters :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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The + SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], + create_update_sql_database_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.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -4997,37 +4671,30 @@ 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 create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The + SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + async def begin_create_update_sql_database( 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, - _types.ClientEncryptionKeyCreateUpdateParameters, - IO[bytes], + create_update_sql_database_parameters: Union[ + _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, 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.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5036,35 +4703,30 @@ 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 - ~azure.mgmt.cosmosdb.types.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Is either a SqlDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlDatabaseGetResults. The + SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlDatabaseGetResults] = 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._create_update_sql_database_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, + create_update_sql_database_parameters=create_update_sql_database_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -5076,7 +4738,7 @@ async def begin_create_update_client_encryption_key( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) + deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5094,21 +4756,85 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlDatabaseGetResults].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.SqlDatabaseGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def list_client_encryption_keys( + async def _delete_sql_database_initial( self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ClientEncryptionKeyGetResults"]: - """Lists the ClientEncryptionKeys under an existing Azure Cosmos DB SQL database. + ) -> 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_sql_resources_delete_sql_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_sql_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5117,31 +4843,90 @@ 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 ClientEncryptionKeyGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ClientEncryptionKeyGetResults]] = 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._delete_sql_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - def prepare_request(next_link=None): - if not next_link: + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _request = build_sql_resources_list_client_encryption_keys_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_databases( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SqlDatabaseGetResults"]: + """Lists the SQL databases under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 SqlDatabaseGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SqlDatabaseGetResults]] = 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_sql_resources_list_sql_databases_request( + resource_group_name=resource_group_name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -5182,7 +4967,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ClientEncryptionKeyGetResults], + List[_models.SqlDatabaseGetResults], deserialized.get("value", []), ) if cls: @@ -5210,11 +4995,222 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _sql_database_partition_merge_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_sql_database_partition_merge_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :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: _types.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.types.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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @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. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.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. @@ -5223,10 +5219,86 @@ 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. The SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account + with the provided name. + + :param resource_group_name: 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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -5240,13 +5312,12 @@ async def get_sql_container( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_container_request( + _request = build_sql_resources_get_sql_database_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=self._config.api_version, headers=_headers, @@ -5281,21 +5352,20 @@ async def get_sql_container( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_sql_container_initial( + async def _update_sql_database_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[ - _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -5315,16 +5385,15 @@ async def _create_update_sql_container_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): - _content = create_update_sql_container_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_sql_container_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_container_request( + _request = build_sql_resources_update_sql_database_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, content_type=content_type, api_version=self._config.api_version, @@ -5373,18 +5442,17 @@ async def _create_update_sql_container_initial( return deserialized # type: ignore @overload - async def begin_create_update_sql_container( + async def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5393,34 +5461,32 @@ 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 update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. 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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_container( + async def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: _types.SqlContainerCreateUpdateParameters, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5429,34 +5495,32 @@ 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.types.SqlContainerCreateUpdateParameters + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_container( + async def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: IO[bytes], + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5465,33 +5529,31 @@ 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 update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. 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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_container( + async def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[ - _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5500,33 +5562,32 @@ 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 - ~azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", 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._create_update_sql_container_initial( + raw_result = await self._update_sql_database_throughput_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, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -5538,7 +5599,7 @@ async def begin_create_update_sql_container( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -5556,18 +5617,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlContainerGetResults].from_continuation_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.SqlContainerGetResults]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( 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 + 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 = { 401: ClientAuthenticationError, @@ -5582,11 +5643,10 @@ async def _delete_sql_container_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_container_request( + _request = build_sql_resources_migrate_sql_database_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=self._config.api_version, headers=_headers, @@ -5605,14 +5665,14 @@ async def _delete_sql_container_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -5623,6 +5683,7 @@ async def _delete_sql_container_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -5632,10 +5693,10 @@ async def _delete_sql_container_initial( 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. + async def begin_migrate_sql_database_to_autoscale( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -5644,25 +5705,24 @@ 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 None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_sql_container_initial( + raw_result = await self._migrate_sql_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -5671,9 +5731,12 @@ async def begin_delete_sql_container( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -5688,37 +5751,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace - def list_sql_containers( + 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 - ) -> AsyncItemPaged["_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. - :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 SqlContainerGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlContainerGetResults]] = kwargs.pop("cls", None) - + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -5727,88 +5772,152 @@ def list_sql_containers( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_sql_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_sql_resources_migrate_sql_database_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlContainerGetResults], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_sql_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _sql_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -5827,16 +5936,15 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na content_type = content_type or "application/json" _content = None - if isinstance(location, (IOBase, bytes)): - _content = location + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_retrieve_continuous_backup_information_request( + _request = build_sql_resources_sql_database_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, content_type=content_type, api_version=self._config.api_version, @@ -5871,6 +5979,9 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -5882,18 +5993,17 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na return deserialized # type: ignore @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: _models.ContinuousBackupRestoreLocation, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -5902,32 +6012,31 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- :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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: _types.ContinuousBackupRestoreLocation, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -5936,32 +6045,31 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- :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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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.types.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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: IO[bytes], + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -5970,30 +6078,46 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- :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 location: The name of the continuous backup restore location. Required. - :type location: IO[bytes] + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -6002,32 +6126,31 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- :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 location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + raw_result = await 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, - location=location, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6039,7 +6162,7 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6057,113 +6180,38 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.BackupInformation].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.BackupInformation]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace_async - async def get_sql_stored_procedure( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - stored_procedure_name: str, - **kwargs: Any - ) -> _models.SqlStoredProcedureGetResults: - """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :return: SqlStoredProcedureGetResults. The SqlStoredProcedureGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) - - _request = build_sql_resources_get_sql_stored_procedure_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - stored_procedure_name=stored_procedure_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _sql_database_redistribute_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: Union[ - _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -6183,17 +6231,15 @@ async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-t content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_stored_procedure_parameters, (IOBase, bytes)): - _content = create_update_sql_stored_procedure_parameters + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _content = json.dumps(create_update_sql_stored_procedure_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_stored_procedure_request( + _request = build_sql_resources_sql_database_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -6221,7 +6267,7 @@ async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-t pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6242,19 +6288,17 @@ async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-t return deserialized # type: ignore @overload - async def begin_create_update_sql_stored_procedure( + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: _models.SqlStoredProcedureCreateUpdateParameters, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -6263,38 +6307,32 @@ async def begin_create_update_sql_stored_procedure( :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 stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters + :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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_stored_procedure( + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: _types.SqlStoredProcedureCreateUpdateParameters, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -6303,38 +6341,32 @@ async def begin_create_update_sql_stored_procedure( :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 stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_stored_procedure( + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -6343,37 +6375,46 @@ async def begin_create_update_sql_stored_procedure( :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 stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: IO[bytes] + :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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_stored_procedure( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: Union[ - _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -6382,38 +6423,32 @@ async def begin_create_update_sql_stored_procedure( :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 stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Is either a SqlStoredProcedureCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlStoredProcedureGetResults] = 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_sql_stored_procedure_initial( + raw_result = await self._sql_database_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - stored_procedure_name=stored_procedure_name, - create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, + redistribute_throughput_parameters=redistribute_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -6425,7 +6460,7 @@ async def begin_create_update_sql_stored_procedure( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -6443,23 +6478,105 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlStoredProcedureGetResults].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.SqlStoredProcedureGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_stored_procedure_initial( + @distributed_trace_async + async def get_sql_container_throughput( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> _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. The ThroughputSettingsGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + + _request = build_sql_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + + 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, - stored_procedure_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -6470,19 +6587,28 @@ async def _delete_sql_stored_procedure_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_stored_procedure_request( + content_type = content_type or "application/json" + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_update_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -6499,7 +6625,7 @@ async def _delete_sql_stored_procedure_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): @@ -6517,6 +6643,7 @@ async def _delete_sql_stored_procedure_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -6525,17 +6652,129 @@ async def _delete_sql_stored_procedure_initial( 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :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: _types.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.types.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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete_sql_stored_procedure( + async def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -6546,26 +6785,34 @@ async def begin_delete_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + 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._delete_sql_stored_procedure_initial( + 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, - stored_procedure_name=stored_procedure_name, + update_throughput_parameters=update_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -6574,9 +6821,12 @@ async def begin_delete_sql_stored_procedure( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -6591,39 +6841,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace - def list_sql_stored_procedures( + 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 - ) -> AsyncItemPaged["_models.SqlStoredProcedureGetResults"]: - """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlStoredProcedureGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlStoredProcedureGetResults]] = kwargs.pop("cls", None) - + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -6632,93 +6862,65 @@ def list_sql_stored_procedures( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_sql_resources_list_sql_stored_procedures_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_sql_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlStoredProcedureGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace_async - async def get_sql_user_defined_function( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - user_defined_function_name: str, - **kwargs: Any - ) -> _models.SqlUserDefinedFunctionGetResults: - """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + 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. @@ -6729,13 +6931,66 @@ async def get_sql_user_defined_function( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :return: SqlUserDefinedFunctionGetResults. The SqlUserDefinedFunctionGetResults is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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, @@ -6747,14 +7002,13 @@ async def get_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_user_defined_function_request( + _request = build_sql_resources_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, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -6766,47 +7020,135 @@ async def get_sql_user_defined_function( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) + 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.iter_bytes() if _decompress else response.iter_raw() 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_sql_user_defined_function_initial( # pylint: disable=name-too-long + @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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: Union[ - _models.SqlUserDefinedFunctionCreateUpdateParameters, - _types.SqlUserDefinedFunctionCreateUpdateParameters, - IO[bytes], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -6826,17 +7168,16 @@ async def _create_update_sql_user_defined_function_initial( # pylint: disable=n content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_user_defined_function_parameters, (IOBase, bytes)): - _content = create_update_sql_user_defined_function_parameters + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(create_update_sql_user_defined_function_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_user_defined_function_request( + _request = build_sql_resources_sql_container_retrieve_throughput_distribution_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -6864,7 +7205,7 @@ async def _create_update_sql_user_defined_function_initial( # pylint: disable=n pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -6875,7 +7216,6 @@ async def _create_update_sql_user_defined_function_initial( # pylint: disable=n "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -6885,19 +7225,18 @@ async def _create_update_sql_user_defined_function_initial( # pylint: disable=n return deserialized # type: ignore @overload - async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: _models.SqlUserDefinedFunctionCreateUpdateParameters, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -6908,36 +7247,32 @@ async def begin_create_update_sql_user_defined_function( # pylint: disable=name :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters + :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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: _types.SqlUserDefinedFunctionCreateUpdateParameters, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -6948,36 +7283,32 @@ async def begin_create_update_sql_user_defined_function( # pylint: disable=name :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters + :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.types.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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: IO[bytes], + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -6988,37 +7319,48 @@ async def begin_create_update_sql_user_defined_function( # pylint: disable=name :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: IO[bytes] + :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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: Union[ - _models.SqlUserDefinedFunctionCreateUpdateParameters, - _types.SqlUserDefinedFunctionCreateUpdateParameters, - IO[bytes], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -7029,36 +7371,32 @@ async def begin_create_update_sql_user_defined_function( # pylint: disable=name :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Is either a SqlUserDefinedFunctionCreateUpdateParameters type - or a IO[bytes] type. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = 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_sql_user_defined_function_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, - user_defined_function_name=user_defined_function_name, - create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -7070,7 +7408,7 @@ async def begin_create_update_sql_user_defined_function( # pylint: disable=name def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7088,23 +7426,41 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults].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.SqlUserDefinedFunctionGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async 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, - user_defined_function_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -7115,19 +7471,28 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_user_defined_function_request( + content_type = content_type or "application/json" + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_sql_container_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -7144,14 +7509,14 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -7170,17 +7535,145 @@ async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too return deserialized # type: ignore + @overload + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_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 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 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + :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 redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_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 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 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete_sql_user_defined_function( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - user_defined_function_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -7191,26 +7684,34 @@ async def begin_delete_sql_user_defined_function( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~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 = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_sql_user_defined_function_initial( + raw_result = await self._sql_container_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -7219,9 +7720,12 @@ async def begin_delete_sql_user_defined_function( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -7236,134 +7740,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_sql_user_defined_functions( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SqlUserDefinedFunctionGetResults"]: - """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlUserDefinedFunctionGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlUserDefinedFunctionGetResults]] = 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_sql_resources_list_sql_user_defined_functions_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlUserDefinedFunctionGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async - async def get_sql_trigger( + async def get_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - trigger_name: str, + client_encryption_key_name: str, **kwargs: Any - ) -> _models.SqlTriggerGetResults: - """Gets the SQL trigger under an existing Azure Cosmos DB database account. + ) -> _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. @@ -7372,12 +7768,11 @@ async def get_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :return: SqlTriggerGetResults. The SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :return: ClientEncryptionKeyGetResults. The ClientEncryptionKeyGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -7391,14 +7786,13 @@ async def get_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_trigger_request( + _request = build_sql_resources_get_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -7433,22 +7827,23 @@ async def get_sql_trigger( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) + deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_sql_trigger_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, - trigger_name: str, - create_update_sql_trigger_parameters: Union[ - _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, + _types.ClientEncryptionKeyCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -7468,17 +7863,16 @@ async def _create_update_sql_trigger_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_trigger_parameters, (IOBase, bytes)): - _content = create_update_sql_trigger_parameters + if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): + _content = create_update_client_encryption_key_parameters else: - _content = json.dumps(create_update_sql_trigger_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_client_encryption_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_trigger_request( + _request = build_sql_resources_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -7527,19 +7921,19 @@ async def _create_update_sql_trigger_initial( return deserialized # type: ignore @overload - async def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: _models.SqlTriggerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -7548,37 +7942,36 @@ async def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters + :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 SqlTriggerGetResults. The - SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of AsyncLROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: _types.SqlTriggerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _types.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -7587,37 +7980,36 @@ async def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters + :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.types.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 SqlTriggerGetResults. The - SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of AsyncLROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_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.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -7626,36 +8018,37 @@ async def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_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 SqlTriggerGetResults. The - SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of AsyncLROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: Union[ - _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, + _types.ClientEncryptionKeyCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -7664,36 +8057,35 @@ async def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Is either a SqlTriggerCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlTriggerGetResults. The - SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :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 + ~azure.mgmt.cosmosdb.types.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlTriggerGetResults] = 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_trigger_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, - trigger_name=trigger_name, - create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, + client_encryption_key_name=client_encryption_key_name, + create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -7705,7 +8097,7 @@ async def begin_create_update_sql_trigger( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) + deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -7723,187 +8115,39 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlTriggerGetResults].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.SqlTriggerGetResults]( + return AsyncLROPoller[_models.ClientEncryptionKeyGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_trigger_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - trigger_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 = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_sql_resources_delete_sql_trigger_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete_sql_trigger( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - trigger_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL trigger. - - :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_trigger_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_triggers( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SqlTriggerGetResults"]: - """Lists the SQL trigger under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlTriggerGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlTriggerGetResults]] = kwargs.pop("cls", None) - + @distributed_trace + def list_client_encryption_keys( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 ClientEncryptionKeyGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClientEncryptionKeyGetResults]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -7915,11 +8159,10 @@ def list_sql_triggers( def prepare_request(next_link=None): if not next_link: - _request = build_sql_resources_list_sql_triggers_request( + _request = build_sql_resources_list_client_encryption_keys_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=self._config.api_version, headers=_headers, @@ -7960,7 +8203,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlTriggerGetResults], + List[_models.ClientEncryptionKeyGetResults], deserialized.get("value", []), ) if cls: @@ -7989,21 +8232,22 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_sql_role_definition( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.SqlRoleDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + async def get_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> _models.SqlContainerGetResults: + """Gets the SQL container under an existing Azure Cosmos DB database account. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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: SqlRoleDefinitionGetResults. The SqlRoleDefinitionGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults + :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. The SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -8017,12 +8261,13 @@ async def get_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_get_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=self._config.api_version, headers=_headers, @@ -8049,7 +8294,7 @@ async def get_sql_role_definition( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8057,20 +8302,21 @@ async def get_sql_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long + async def _create_update_sql_container_initial( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: Union[ - _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] + database_name: str, + container_name: str, + create_update_sql_container_parameters: Union[ + _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -8090,15 +8336,16 @@ async def _create_update_sql_role_definition_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_role_definition_parameters, (IOBase, bytes)): - _content = create_update_sql_role_definition_parameters + if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): + _content = create_update_sql_container_parameters else: - _content = json.dumps(create_update_sql_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_container_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_create_update_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, content_type=content_type, api_version=self._config.api_version, @@ -8126,13 +8373,16 @@ async def _create_update_sql_role_definition_initial( # pylint: disable=name-to pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -8144,152 +8394,160 @@ async def _create_update_sql_role_definition_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - async def begin_create_update_sql_role_definition( + async def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, + database_name: str, + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters + :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 :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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of AsyncLROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_role_definition( + async def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: _types.SqlRoleDefinitionCreateUpdateParameters, + database_name: str, + container_name: str, + create_update_sql_container_parameters: _types.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters + :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.types.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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of AsyncLROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_role_definition( + async def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: IO[bytes], + database_name: str, + container_name: str, + create_update_sql_container_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: IO[bytes] + :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] :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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of AsyncLROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_role_definition( + async def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: Union[ - _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] + database_name: str, + container_name: str, + create_update_sql_container_parameters: Union[ + _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> AsyncLROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a SqlRoleDefinitionCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :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 + ~azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlRoleDefinitionGetResults] = 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._create_update_sql_role_definition_initial( - role_definition_id=role_definition_id, + raw_result = await self._create_update_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_sql_role_definition_parameters=create_update_sql_role_definition_parameters, + database_name=database_name, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -8301,7 +8559,7 @@ async def begin_create_update_sql_role_definition( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8319,18 +8577,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlRoleDefinitionGetResults].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.SqlRoleDefinitionGetResults]( + return AsyncLROPoller[_models.SqlContainerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_role_definition_initial( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -8345,10 +8603,11 @@ async def _delete_sql_role_definition_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_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=self._config.api_version, headers=_headers, @@ -8367,22 +8626,24 @@ async def _delete_sql_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -8392,18 +8653,20 @@ async def _delete_sql_role_definition_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_sql_role_definition( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 Role Definition. + """Deletes an existing Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -8416,10 +8679,11 @@ async def begin_delete_sql_role_definition( 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_role_definition_initial( - role_definition_id=role_definition_id, + 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, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8454,25 +8718,27 @@ 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 @distributed_trace - def list_sql_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SqlRoleDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + def list_sql_containers( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :return: An iterator like instance of SqlRoleDefinitionGetResults + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An iterator like instance of SqlContainerGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlContainerGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8485,9 +8751,10 @@ def list_sql_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_sql_resources_list_sql_role_definitions_request( + _request = build_sql_resources_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=self._config.api_version, headers=_headers, @@ -8528,7 +8795,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlRoleDefinitionGetResults], + List[_models.SqlContainerGetResults], deserialized.get("value", []), ) if cls: @@ -8547,7 +8814,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -8556,24 +8823,31 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_sql_role_assignment( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.SqlRoleAssignmentGetResults: - """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. - - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str - :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: SqlRoleAssignmentGetResults. The SqlRoleAssignmentGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -8582,17 +8856,28 @@ async def get_sql_role_assignment( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_role_assignment_request( - role_assignment_id=role_assignment_id, + content_type = content_type or "application/json" + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8602,19 +8887,18 @@ async def get_sql_role_assignment( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( _models.CloudError, @@ -8622,242 +8906,187 @@ async def get_sql_role_assignment( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) + 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.iter_bytes() if _decompress else response.iter_raw() 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_sql_role_assignment_initial( # pylint: disable=name-too-long + @overload + async def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: Union[ - _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] - ], + database_name: str, + container_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(create_update_sql_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_sql_role_assignment_parameters - else: - _content = json.dumps(create_update_sql_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_sql_resources_create_update_sql_role_assignment_request( - role_assignment_id=role_assignment_id, - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_update_sql_role_assignment( - self, - role_assignment_id: str, - resource_group_name: str, - account_name: str, - create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. - - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters + :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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_role_assignment( + async def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: _types.SqlRoleAssignmentCreateUpdateParameters, + database_name: str, + container_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters + :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.types.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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_sql_role_assignment( + async def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: IO[bytes], + database_name: str, + container_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: IO[bytes] + :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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_sql_role_assignment( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: Union[ - _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] - ], + database_name: str, + container_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a SqlRoleAssignmentCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlRoleAssignmentGetResults] = 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_sql_role_assignment_initial( - role_assignment_id=role_assignment_id, + raw_result = await self._list_sql_container_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_sql_role_assignment_parameters=create_update_sql_role_assignment_parameters, + database_name=database_name, + container_name=container_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -8869,7 +9098,7 @@ async def begin_create_update_sql_role_assignment( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -8887,18 +9116,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.SqlRoleAssignmentGetResults].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.SqlRoleAssignmentGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_sql_role_assignment_initial( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any + async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -8908,17 +9143,28 @@ async def _delete_sql_role_assignment_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_role_assignment_request( - role_assignment_id=role_assignment_id, + content_type = content_type or "application/json" + _content = None + if isinstance(location, (IOBase, bytes)): + _content = location + else: + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_retrieve_continuous_backup_information_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -8935,7 +9181,7 @@ async def _delete_sql_role_assignment_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): @@ -8959,35 +9205,154 @@ async def _delete_sql_role_assignment_initial( return deserialized # type: ignore + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: _models.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: _types.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: 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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete_sql_role_assignment( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL Role Assignment. + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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 location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = 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_role_assignment_initial( - role_assignment_id=role_assignment_id, + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, + container_name=container_name, + location=location, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -8996,9 +9361,12 @@ async def begin_delete_sql_role_assignment( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -9013,141 +9381,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_token( + return AsyncLROPoller[_models.BackupInformation].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_sql_role_assignments( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.SqlRoleAssignmentGetResults"]: - """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 SqlRoleAssignmentGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlRoleAssignmentGetResults]] = 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_sql_resources_list_sql_role_assignments_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlRoleAssignmentGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class MongoDBResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`mongo_db_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return AsyncLROPoller[_models.BackupInformation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async - async def get_mongo_db_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database - account with the provided name. + async def get_sql_stored_procedure( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any + ) -> _models.SqlStoredProcedureGetResults: + """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9156,9 +9410,13 @@ async def get_mongo_db_database_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :return: SqlStoredProcedureGetResults. The SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9172,12 +9430,14 @@ async def get_mongo_db_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_database_throughput_request( + _request = build_sql_resources_get_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9212,20 +9472,22 @@ async def get_mongo_db_database_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long + async def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: Union[ + _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -9245,15 +9507,17 @@ async def _update_mongo_db_database_throughput_initial( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_stored_procedure_parameters, (IOBase, bytes)): + _content = create_update_sql_stored_procedure_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_stored_procedure_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_update_mongo_db_database_throughput_request( + _request = build_sql_resources_create_update_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9281,7 +9545,7 @@ async def _update_mongo_db_database_throughput_initial( # pylint: disable=name- pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -9302,17 +9566,19 @@ async def _update_mongo_db_database_throughput_initial( # pylint: disable=name- return deserialized # type: ignore @overload - async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: _models.SqlStoredProcedureCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9321,32 +9587,38 @@ async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: _types.SqlStoredProcedureCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9355,32 +9627,38 @@ async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9389,31 +9667,37 @@ async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: Union[ + _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9422,32 +9706,38 @@ async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Is either a SqlStoredProcedureCreateUpdateParameters type or a IO[bytes] type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlStoredProcedureGetResults] = 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_mongo_db_database_throughput_initial( + raw_result = await self._create_update_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - update_throughput_parameters=update_throughput_parameters, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -9459,7 +9749,7 @@ async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -9477,18 +9767,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlStoredProcedureGetResults].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.SqlStoredProcedureGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + async def _delete_sql_stored_procedure_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -9503,10 +9799,12 @@ async def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=na cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_migrate_mongo_db_database_to_autoscale_request( + _request = build_sql_resources_delete_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9525,14 +9823,14 @@ async def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=na 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -9543,7 +9841,6 @@ async def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=na "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -9553,10 +9850,16 @@ async def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=na return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + async def begin_delete_sql_stored_procedure( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9565,24 +9868,28 @@ async def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name- :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_database_to_autoscale_initial( + raw_result = await self._delete_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -9591,12 +9898,9 @@ async def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name- await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -9611,86 +9915,19 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + @distributed_trace + def list_sql_stored_procedures( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SqlStoredProcedureGetResults"]: + """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9699,68 +9936,113 @@ async def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disab :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: An iterator like instance of SqlStoredProcedureGetResults :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_database_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[List[_models.SqlStoredProcedureGetResults]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + def prepare_request(next_link=None): + if not next_link: + + _request = build_sql_resources_list_sql_stored_procedures_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SqlStoredProcedureGetResults], + deserialized.get("value", []), ) - 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, + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 ) - return AsyncLROPoller[_models.ThroughputSettingsGetResults]( - 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) + error = _failsafe_deserialize( + _models.CloudError, + 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_mongo_db_collection_throughput( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database - account with the provided name. + async def get_sql_user_defined_function( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any + ) -> _models.SqlUserDefinedFunctionGetResults: + """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9769,11 +10051,13 @@ async def get_mongo_db_collection_throughput( :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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :return: SqlUserDefinedFunctionGetResults. The SqlUserDefinedFunctionGetResults is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9787,13 +10071,14 @@ async def get_mongo_db_collection_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_collection_throughput_request( + _request = build_sql_resources_get_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9828,21 +10113,24 @@ async def get_mongo_db_collection_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long + async def _create_update_sql_user_defined_function_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: Union[ + _models.SqlUserDefinedFunctionCreateUpdateParameters, + _types.SqlUserDefinedFunctionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -9862,16 +10150,17 @@ async def _update_mongo_db_collection_throughput_initial( # pylint: disable=nam content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_user_defined_function_parameters, (IOBase, bytes)): + _content = create_update_sql_user_defined_function_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_user_defined_function_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_update_mongo_db_collection_throughput_request( + _request = build_sql_resources_create_update_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -9920,18 +10209,19 @@ async def _update_mongo_db_collection_throughput_initial( # pylint: disable=nam return deserialized # type: ignore @overload - async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: _models.SqlUserDefinedFunctionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9940,35 +10230,38 @@ async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-t :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: _types.SqlUserDefinedFunctionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -9977,35 +10270,38 @@ async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-t :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10014,34 +10310,39 @@ async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-t :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + async def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: Union[ + _models.SqlUserDefinedFunctionCreateUpdateParameters, + _types.SqlUserDefinedFunctionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10050,35 +10351,38 @@ async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-t :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Is either a SqlUserDefinedFunctionCreateUpdateParameters type + or a IO[bytes] type. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = 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_mongo_db_collection_throughput_initial( + raw_result = await self._create_update_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - update_throughput_parameters=update_throughput_parameters, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -10090,7 +10394,7 @@ async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-t def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10108,18 +10412,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlUserDefinedFunctionGetResults].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.SqlUserDefinedFunctionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + async def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10134,11 +10444,12 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable= cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_migrate_mongo_db_collection_to_autoscale_request( + _request = build_sql_resources_delete_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10157,14 +10468,14 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable= 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10175,7 +10486,6 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable= "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -10185,10 +10495,16 @@ async def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable= return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + async def begin_delete_sql_user_defined_function( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10197,27 +10513,28 @@ async def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=nam :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_collection_to_autoscale_initial( + raw_result = await self._delete_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10226,12 +10543,9 @@ async def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=nam await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -10246,87 +10560,19 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_mongo_db_resources_migrate_mongo_db_collection_to_manual_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + @distributed_trace + def list_sql_user_defined_functions( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SqlUserDefinedFunctionGetResults"]: + """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10335,71 +10581,113 @@ async def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: dis :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: An iterator like instance of SqlUserDefinedFunctionGetResults :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_collection_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[List[_models.SqlUserDefinedFunctionGetResults]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + def prepare_request(next_link=None): + if not next_link: + + _request = build_sql_resources_list_sql_user_defined_functions_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SqlUserDefinedFunctionGetResults], + deserialized.get("value", []), ) - 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, + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 ) - return AsyncLROPoller[_models.ThroughputSettingsGetResults]( - 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) + error = _failsafe_deserialize( + _models.ErrorResponse, + 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_mongo_db_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.MongoDBDatabaseGetResults: - """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided - name. + async def get_sql_trigger( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any + ) -> _models.SqlTriggerGetResults: + """Gets the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10408,9 +10696,12 @@ async def get_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: MongoDBDatabaseGetResults. The MongoDBDatabaseGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :return: SqlTriggerGetResults. The SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10424,12 +10715,14 @@ async def get_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_database_request( + _request = build_sql_resources_get_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10464,20 +10757,22 @@ async def get_mongo_db_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_mongo_db_database_initial( + async def _create_update_sql_trigger_initial( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: Union[ - _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: Union[ + _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -10497,15 +10792,17 @@ async def _create_update_mongo_db_database_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_db_database_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_database_parameters + if isinstance(create_update_sql_trigger_parameters, (IOBase, bytes)): + _content = create_update_sql_trigger_parameters else: - _content = json.dumps(create_update_mongo_db_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_trigger_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_db_database_request( + _request = build_sql_resources_create_update_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -10554,17 +10851,19 @@ async def _create_update_mongo_db_database_initial( return deserialized # type: ignore @overload - async def begin_create_update_mongo_db_database( + async def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters, + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: _models.SqlTriggerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10573,32 +10872,37 @@ async def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters :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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of AsyncLROPoller that returns SqlTriggerGetResults. The + SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_db_database( + async def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: _types.MongoDBDatabaseCreateUpdateParameters, + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: _types.SqlTriggerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10607,32 +10911,37 @@ async def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters :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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of AsyncLROPoller that returns SqlTriggerGetResults. The + SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_db_database( + async def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: IO[bytes], + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10641,31 +10950,36 @@ async def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of AsyncLROPoller that returns SqlTriggerGetResults. The + SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_mongo_db_database( + async def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: Union[ - _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: Union[ + _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> AsyncLROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10674,32 +10988,36 @@ async def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Is either a SqlTriggerCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlTriggerGetResults. The + SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlTriggerGetResults] = 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_database_initial( + raw_result = await self._create_update_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, + container_name=container_name, + trigger_name=trigger_name, + create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -10711,7 +11029,7 @@ async def begin_create_update_mongo_db_database( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10729,18 +11047,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MongoDBDatabaseGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlTriggerGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.MongoDBDatabaseGetResults]( + return AsyncLROPoller[_models.SqlTriggerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_mongo_db_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + async def _delete_sql_trigger_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10755,10 +11079,12 @@ async def _delete_mongo_db_database_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_db_database_request( + _request = build_sql_resources_delete_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10804,10 +11130,16 @@ async def _delete_mongo_db_database_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_mongo_db_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + async def begin_delete_sql_trigger( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB database. + """Deletes an existing Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -10816,6 +11148,10 @@ async def begin_delete_mongo_db_database( :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 trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -10828,10 +11164,12 @@ async def begin_delete_mongo_db_database( 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_database_initial( + raw_result = await self._delete_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10866,25 +11204,29 @@ 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 @distributed_trace - def list_mongo_db_databases( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MongoDBDatabaseGetResults"]: - """Lists the MongoDB databases under an existing Azure Cosmos DB database account. + def list_sql_triggers( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SqlTriggerGetResults"]: + """Lists the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoDBDatabaseGetResults + :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 iterator like instance of SqlTriggerGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlTriggerGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10897,9 +11239,11 @@ def list_mongo_db_databases( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_db_databases_request( + _request = build_sql_resources_list_sql_triggers_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=self._config.api_version, headers=_headers, @@ -10940,7 +11284,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoDBDatabaseGetResults], + List[_models.SqlTriggerGetResults], deserialized.get("value", []), ) if cls: @@ -10969,23 +11313,21 @@ async def get_next(next_link=None): 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. + async def get_sql_role_definition( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.SqlRoleDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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. The MongoDBCollectionGetResults is compatible with + :return: SqlRoleDefinitionGetResults. The SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10999,13 +11341,12 @@ async def get_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_collection_request( + _request = build_sql_resources_get_sql_role_definition_request( + role_definition_id=role_definition_id, 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=self._config.api_version, headers=_headers, @@ -11032,7 +11373,7 @@ async def get_mongo_db_collection( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -11040,21 +11381,20 @@ async def get_mongo_db_collection( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) 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 + async def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[ - _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] + create_update_sql_role_definition_parameters: Union[ + _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -11074,16 +11414,15 @@ async def _create_update_mongo_db_collection_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_collection_parameters + if isinstance(create_update_sql_role_definition_parameters, (IOBase, bytes)): + _content = create_update_sql_role_definition_parameters else: - _content = json.dumps(create_update_mongo_db_collection_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_db_collection_request( + _request = build_sql_resources_create_update_sql_role_definition_request( + role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -11111,16 +11450,13 @@ async def _create_update_mongo_db_collection_initial( # pylint: disable=name-to pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -11132,165 +11468,152 @@ 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_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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 + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters :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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_db_collection( + async def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _types.MongoDBCollectionCreateUpdateParameters, + create_update_sql_role_definition_parameters: _types.SqlRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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.types.MongoDBCollectionCreateUpdateParameters + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters :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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_db_collection( + async def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: IO[bytes], + create_update_sql_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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] + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_mongo_db_collection( + async def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[ - _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] + create_update_sql_role_definition_parameters: Union[ + _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> AsyncLROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoDBCollectionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a SqlRoleDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = 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._create_update_sql_role_definition_initial( + role_definition_id=role_definition_id, 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, + create_update_sql_role_definition_parameters=create_update_sql_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11302,7 +11625,7 @@ async def begin_create_update_mongo_db_collection( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11320,18 +11643,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlRoleDefinitionGetResults].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.SqlRoleDefinitionGetResults]( 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 _delete_sql_role_definition_initial( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11346,11 +11669,10 @@ async def _delete_mongo_db_collection_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_db_collection_request( + _request = build_sql_resources_delete_sql_role_definition_request( + role_definition_id=role_definition_id, 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=self._config.api_version, headers=_headers, @@ -11369,24 +11691,22 @@ 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, 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -11396,20 +11716,18 @@ async def _delete_mongo_db_collection_initial( return deserialized # type: ignore @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 + async def begin_delete_sql_role_definition( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB Collection. + """Deletes an existing Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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 None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -11422,11 +11740,10 @@ async def begin_delete_mongo_db_collection( 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._delete_sql_role_definition_initial( + role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - collection_name=collection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11461,27 +11778,25 @@ 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 @distributed_trace - def list_mongo_db_collections( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MongoDBCollectionGetResults"]: - """Lists the MongoDB collection under an existing Azure Cosmos DB database account. + def list_sql_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SqlRoleDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoDBCollectionGetResults + :return: An iterator like instance of SqlRoleDefinitionGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11494,10 +11809,9 @@ def list_mongo_db_collections( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_db_collections_request( + _request = build_sql_resources_list_sql_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -11538,7 +11852,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoDBCollectionGetResults], + List[_models.SqlRoleDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -11557,7 +11871,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -11566,288 +11880,22 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, 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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(location, (IOBase, bytes)): - _content = location - else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_mongo_db_resources_retrieve_continuous_backup_information_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, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: _models.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: _types.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: 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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - location=location, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.BackupInformation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.BackupInformation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - @distributed_trace_async - async def get_mongo_role_definition( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.MongoRoleDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given - Id. + async def get_sql_role_assignment( + self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.SqlRoleAssignmentGetResults: + """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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: MongoRoleDefinitionGetResults. The MongoRoleDefinitionGetResults is compatible with + :return: SqlRoleAssignmentGetResults. The SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11861,10 +11909,10 @@ async def get_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_get_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -11901,22 +11949,20 @@ async def get_mongo_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long + async def _create_update_sql_role_assignment_initial( # pylint: disable=name-too-long self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: Union[ - _models.MongoRoleDefinitionCreateUpdateParameters, - _types.MongoRoleDefinitionCreateUpdateParameters, - IO[bytes], + create_update_sql_role_assignment_parameters: Union[ + _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -11936,13 +11982,13 @@ async def _create_update_mongo_role_definition_initial( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_role_definition_parameters, (IOBase, bytes)): - _content = create_update_mongo_role_definition_parameters + if isinstance(create_update_sql_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_sql_role_assignment_parameters else: - _content = json.dumps(create_update_mongo_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_create_update_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -11990,154 +12036,152 @@ async def _create_update_mongo_role_definition_initial( # pylint: disable=name- return deserialized # type: ignore @overload - async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + async def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters, + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters :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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + async def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: _types.MongoRoleDefinitionCreateUpdateParameters, + create_update_sql_role_assignment_parameters: _types.SqlRoleAssignmentCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters :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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + async def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: IO[bytes], + create_update_sql_role_assignment_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: IO[bytes] + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + async def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: Union[ - _models.MongoRoleDefinitionCreateUpdateParameters, - _types.MongoRoleDefinitionCreateUpdateParameters, - IO[bytes], + create_update_sql_role_assignment_parameters: Union[ + _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> AsyncLROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a SqlRoleAssignmentCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = 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_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = await self._create_update_sql_role_assignment_initial( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, + create_update_sql_role_assignment_parameters=create_update_sql_role_assignment_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12149,7 +12193,7 @@ async def begin_create_update_mongo_role_definition( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12167,18 +12211,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MongoRoleDefinitionGetResults].from_continuation_token( + return AsyncLROPoller[_models.SqlRoleAssignmentGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.MongoRoleDefinitionGetResults]( + return AsyncLROPoller[_models.SqlRoleAssignmentGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_mongo_role_definition_initial( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -12193,8 +12237,8 @@ async def _delete_mongo_role_definition_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_delete_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -12240,13 +12284,13 @@ async def _delete_mongo_role_definition_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_mongo_role_definition( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + async def begin_delete_sql_role_assignment( + self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo Role Definition. + """Deletes an existing Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -12264,8 +12308,8 @@ async def begin_delete_mongo_role_definition( 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_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = await self._delete_sql_role_assignment_initial( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, cls=lambda x, y, z: x, @@ -12302,25 +12346,25 @@ 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 @distributed_trace - def list_mongo_role_definitions( + def list_sql_role_assignments( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MongoRoleDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. + ) -> AsyncItemPaged["_models.SqlRoleAssignmentGetResults"]: + """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoRoleDefinitionGetResults + :return: An iterator like instance of SqlRoleAssignmentGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlRoleAssignmentGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -12333,7 +12377,7 @@ def list_mongo_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_role_definitions_request( + _request = build_sql_resources_list_sql_role_assignments_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -12376,7 +12420,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoRoleDefinitionGetResults], + List[_models.SqlRoleAssignmentGetResults], deserialized.get("value", []), ) if cls: @@ -12404,23 +12448,41 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace_async - async def get_mongo_user_definition( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.MongoUserDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given - Id. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str +class MongoDBResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`mongo_db_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_mongo_db_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database + account with the provided name. + + :param resource_group_name: 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: MongoUserDefinitionGetResults. The MongoUserDefinitionGetResults is compatible with + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -12434,12 +12496,12 @@ async def get_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_get_mongo_db_database_throughput_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12466,7 +12528,7 @@ async def get_mongo_user_definition( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -12474,22 +12536,20 @@ async def get_mongo_user_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long + async def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: Union[ - _models.MongoUserDefinitionCreateUpdateParameters, - _types.MongoUserDefinitionCreateUpdateParameters, - IO[bytes], + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -12509,15 +12569,15 @@ async def _create_update_mongo_user_definition_initial( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_user_definition_parameters, (IOBase, bytes)): - _content = create_update_mongo_user_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_mongo_user_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_update_mongo_db_database_throughput_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -12552,6 +12612,9 @@ async def _create_update_mongo_user_definition_initial( # pylint: disable=name- 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -12563,154 +12626,152 @@ async def _create_update_mongo_user_definition_initial( # pylint: disable=name- return deserialized # type: ignore @overload - async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters, + database_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. 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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: _types.MongoUserDefinitionCreateUpdateParameters, + database_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: IO[bytes], + database_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: IO[bytes] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. 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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + async def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: Union[ - _models.MongoUserDefinitionCreateUpdateParameters, - _types.MongoUserDefinitionCreateUpdateParameters, - IO[bytes], + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", 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._create_update_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, + raw_result = await self._update_mongo_db_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12722,7 +12783,7 @@ async def begin_create_update_mongo_user_definition( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12740,18 +12801,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.MongoUserDefinitionGetResults].from_continuation_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.MongoUserDefinitionGetResults]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_mongo_user_definition_initial( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -12766,10 +12827,10 @@ async def _delete_mongo_user_definition_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_migrate_mongo_db_database_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -12788,7 +12849,7 @@ async def _delete_mongo_user_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): @@ -12802,6 +12863,9 @@ async def _delete_mongo_user_definition_initial( 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -12813,34 +12877,36 @@ async def _delete_mongo_user_definition_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_mongo_user_definition( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo User Definition. + async def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, + raw_result = await self._migrate_mongo_db_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -12849,9 +12915,12 @@ async def begin_delete_mongo_user_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -12866,154 +12935,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_mongo_user_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MongoUserDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB Mongo User Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 MongoUserDefinitionGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.MongoUserDefinitionGetResults]] = 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_mongo_db_resources_list_mongo_user_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MongoUserDefinitionGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class TableResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`table_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get_table_throughput( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with - the provided name. + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13025,12 +12959,12 @@ async def get_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_throughput_request( + _request = build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13042,43 +12976,131 @@ async def get_table_throughput( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - async def _update_table_throughput_initial( + @distributed_trace_async + async def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -13098,15 +13120,15 @@ async def _update_table_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_update_table_throughput_request( + _request = build_mongo_db_resources_mongo_db_database_retrieve_throughput_distribution_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13134,7 +13156,7 @@ async def _update_table_throughput_initial( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -13155,152 +13177,164 @@ async def _update_table_throughput_initial( return deserialized # type: ignore @overload - async def begin_update_table_throughput( + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_table_throughput( + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_table_throughput( + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_table_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = 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._update_table_throughput_initial( + raw_result = await self._mongo_db_database_retrieve_throughput_distribution_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13312,7 +13346,7 @@ async def begin_update_table_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13330,18 +13364,40 @@ def get_long_running_output(pipeline_response): 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 ) - async def _migrate_table_to_autoscale_initial( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.RedistributeThroughputParameters, IO[bytes] + ], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13351,17 +13407,27 @@ async def _migrate_table_to_autoscale_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_migrate_table_to_autoscale_request( + content_type = content_type or "application/json" + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_mongo_db_database_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13405,171 +13471,169 @@ async def _migrate_table_to_autoscale_initial( return deserialized # type: ignore - @distributed_trace_async - async def begin_migrate_table_to_autoscale( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + @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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :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 {} - _params = kwargs.pop("params", {}) or {} - - 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_table_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_table_resources_migrate_table_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @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: _types.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + :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.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, response_headers) # 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: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. - return deserialized # type: ignore + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_migrate_table_to_manual_throughput( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :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 = kwargs.pop("params", {}) or {} - 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_table_to_manual_throughput_initial( + raw_result = await self._mongo_db_database_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13580,7 +13644,7 @@ async def begin_migrate_table_to_manual_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13598,31 +13662,35 @@ def get_long_running_output(pipeline_response): 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_async - async def get_table( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> _models.TableGetResults: - """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + async def get_mongo_db_collection_throughput( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :return: TableGetResults. The TableGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults + :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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13636,12 +13704,13 @@ async def get_table( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_request( + _request = build_mongo_db_resources_get_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13676,20 +13745,21 @@ async def get_table( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TableGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_table_initial( + async def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: Union[ - _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -13709,15 +13779,16 @@ async def _create_update_table_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_table_parameters, (IOBase, bytes)): - _content = create_update_table_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_create_update_table_request( + _request = build_mongo_db_resources_update_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13766,144 +13837,165 @@ async def _create_update_table_initial( return deserialized # type: ignore @overload - async def begin_create_update_table( + async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: _models.TableCreateUpdateParameters, + database_name: str, + collection_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. 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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table( + async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: _types.TableCreateUpdateParameters, + database_name: str, + collection_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table( + async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: IO[bytes], + database_name: str, + collection_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: IO[bytes] + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. 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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_table( + async def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: Union[ - _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. Is - either a TableCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters - or ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", 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._create_update_table_initial( + raw_result = await self._update_mongo_db_collection_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - create_update_table_parameters=create_update_table_parameters, + database_name=database_name, + collection_name=collection_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13915,7 +14007,7 @@ async def begin_create_update_table( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13933,18 +14025,42 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.TableGetResults].from_continuation_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.TableGetResults]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_table_initial( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.RetrieveThroughputParameters, IO[bytes] + ], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -13954,17 +14070,28 @@ async def _delete_table_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_delete_table_request( + content_type = content_type or "application/json" + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_mongo_db_container_retrieve_throughput_distribution_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -13981,14 +14108,14 @@ async def _delete_table_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -13999,6 +14126,7 @@ async def _delete_table_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -14007,35 +14135,180 @@ async def _delete_table_initial( 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :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: _types.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.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_delete_table( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Table. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~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 = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_table_initial( + raw_result = await self._mongo_db_container_retrieve_throughput_distribution_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, + retrieve_throughput_parameters=retrieve_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14044,9 +14317,12 @@ async def begin_delete_table( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -14061,122 +14337,41 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_tables( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.TableGetResults"]: - """Lists the Tables under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 TableGetResults - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TableGetResults]] = 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_table_resources_list_tables_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TableGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -14195,15 +14390,16 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na content_type = content_type or "application/json" _content = None - if isinstance(location, (IOBase, bytes)): - _content = location + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_retrieve_continuous_backup_information_request( + _request = build_mongo_db_resources_mongo_db_container_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14238,6 +14434,9 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -14249,139 +14448,181 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na return deserialized # type: ignore @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: _models.ContinuousBackupRestoreLocation, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: _types.ContinuousBackupRestoreLocation, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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.types.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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: IO[bytes], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: IO[bytes] + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + raw_result = await self._mongo_db_container_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - location=location, + database_name=database_name, + collection_name=collection_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14393,7 +14634,7 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14411,35 +14652,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.BackupInformation].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.BackupInformation]( + return AsyncLROPoller[_models.PhysicalPartitionThroughputInfoResult]( 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. The TableRoleDefinitionResource is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14451,12 +14676,13 @@ async def get_table_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_role_definition_request( + _request = build_mongo_db_resources_migrate_mongo_db_collection_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -14468,45 +14694,114 @@ async def get_table_role_definition( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() 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_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, _types.TableRoleDefinitionResource, IO[bytes] - ], - **kwargs: Any + @distributed_trace_async + async def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_collection_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, @@ -14516,27 +14811,18 @@ async def _create_update_table_role_definition_initial( # pylint: disable=name- } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): - _content = create_update_table_role_definition_parameters - else: - _content = json.dumps(create_update_table_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_table_resources_create_update_table_role_definition_request( + _request = build_mongo_db_resources_migrate_mongo_db_collection_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -14560,7 +14846,7 @@ async def _create_update_table_role_definition_initial( # pylint: disable=name- pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -14571,6 +14857,7 @@ async def _create_update_table_role_definition_initial( # pylint: disable=name- "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -14579,153 +14866,384 @@ async def _create_update_table_role_definition_initial( # pylint: disable=name- 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. + @distributed_trace_async + async def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 + :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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_collection_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace_async + async def get_mongo_db_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.MongoDBDatabaseGetResults: + """Gets the MongoDB databases 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :return: MongoDBDatabaseGetResults. The MongoDBDatabaseGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + + _request = build_mongo_db_resources_get_mongo_db_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_mongo_db_database_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_mongo_db_database_parameters: Union[ + _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_mongo_db_database_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_database_parameters + else: + _content = json.dumps(create_update_mongo_db_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_create_update_mongo_db_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_mongo_db_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters :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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: _types.TableRoleDefinitionResource, + database_name: str, + create_update_mongo_db_database_parameters: _types.MongoDBDatabaseCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.types.TableRoleDefinitionResource + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters :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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: IO[bytes], + database_name: str, + create_update_mongo_db_database_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_table_role_definition( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: Union[ - _models.TableRoleDefinitionResource, _types.TableRoleDefinitionResource, IO[bytes] + database_name: str, + create_update_mongo_db_database_parameters: Union[ + _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> AsyncLROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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. + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_table_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.TableRoleDefinitionResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoDBDatabaseGetResults] = 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( + raw_result = await self._create_update_mongo_db_database_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, + database_name=database_name, + create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14737,7 +15255,7 @@ async def begin_create_update_table_role_definition( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14755,18 +15273,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.TableRoleDefinitionResource].from_continuation_token( + return AsyncLROPoller[_models.MongoDBDatabaseGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.TableRoleDefinitionResource]( + return AsyncLROPoller[_models.MongoDBDatabaseGetResults]( 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 + 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 = { 401: ClientAuthenticationError, @@ -14781,10 +15299,10 @@ async def _delete_table_role_definition_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_delete_table_role_definition_request( + _request = build_mongo_db_resources_delete_mongo_db_database_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -14803,7 +15321,7 @@ async def _delete_table_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -14830,18 +15348,18 @@ async def _delete_table_role_definition_initial( 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 + async def begin_delete_mongo_db_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Table Role Definition. + """Deletes an existing 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -14854,10 +15372,10 @@ async def begin_delete_table_role_definition( 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( + raw_result = await self._delete_mongo_db_database_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14892,25 +15410,25 @@ 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 @distributed_trace - def list_table_role_definitions( + def list_mongo_db_databases( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.TableRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Table Role Definitions. + ) -> AsyncItemPaged["_models.MongoDBDatabaseGetResults"]: + """Lists the MongoDB databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 TableRoleDefinitionResource + :return: An iterator like instance of MongoDBDatabaseGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TableRoleDefinitionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -14923,7 +15441,7 @@ def list_table_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_table_resources_list_table_role_definitions_request( + _request = build_mongo_db_resources_list_mongo_db_databases_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -14966,7 +15484,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.TableRoleDefinitionResource], + List[_models.MongoDBDatabaseGetResults], deserialized.get("value", []), ) if cls: @@ -14994,91 +15512,27 @@ async def get_next(next_link=None): 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. The TableRoleAssignmentResource is compatible with - MutableMapping - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) - - _request = build_table_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) - - 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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _mongo_db_database_partition_merge_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, _types.TableRoleAssignmentResource, IO[bytes] - ], + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -15097,15 +15551,15 @@ async def _create_update_table_role_assignment_initial( # pylint: disable=name- content_type = content_type or "application/json" _content = None - if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_table_role_assignment_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _content = json.dumps(create_update_table_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_create_update_table_role_assignment_request( + _request = build_mongo_db_resources_mongo_db_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -15133,7 +15587,7 @@ async def _create_update_table_role_assignment_initial( # pylint: disable=name- pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -15154,152 +15608,158 @@ async def _create_update_table_role_assignment_initial( # pylint: disable=name- return deserialized # type: ignore @overload - async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, + database_name: str, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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 + :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 TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: _types.TableRoleAssignmentResource, + database_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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.types.TableRoleAssignmentResource + :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.types.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 TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: IO[bytes], + database_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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] + :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 TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: Union[ - _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] - ], + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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 - ~azure.mgmt.cosmosdb.types.TableRoleAssignmentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableRoleAssignmentResource] = 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_table_role_assignment_initial( + raw_result = await self._mongo_db_database_partition_merge_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, + database_name=database_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15311,7 +15771,7 @@ async def begin_create_update_table_role_assignment( # pylint: disable=name-too def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15329,280 +15789,34 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.TableRoleAssignmentResource].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.TableRoleAssignmentResource]( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( 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 = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_table_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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.iter_bytes() if _decompress else response.iter_raw() - - 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 None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) -> AsyncItemPaged["_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 TableRoleAssignmentResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TableRoleAssignmentResource]] = 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_table_resources_list_table_role_assignments_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TableRoleAssignmentResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - -class CassandraResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`cassandra_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get_cassandra_keyspace_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database - account with the provided name. + 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :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. The MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15616,12 +15830,13 @@ async def get_cassandra_keyspace_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_keyspace_throughput_request( + _request = build_mongo_db_resources_get_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -15656,20 +15871,21 @@ async def get_cassandra_keyspace_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long + async def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[ + _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -15689,15 +15905,16 @@ async def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_collection_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_db_collection_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_update_cassandra_keyspace_throughput_request( + _request = build_mongo_db_resources_create_update_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -15746,152 +15963,165 @@ async def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name return deserialized # type: ignore @overload - async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _types.MongoDBCollectionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + async def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[ + _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + :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 update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoDBCollectionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_cassandra_keyspace_throughput_initial( + raw_result = await self._create_update_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15903,7 +16133,7 @@ async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-to def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15921,18 +16151,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.MongoDBCollectionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + 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, @@ -15947,10 +16177,11 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=n cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_migrate_cassandra_keyspace_to_autoscale_request( + _request = build_mongo_db_resources_delete_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -15969,14 +16200,14 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=n 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -15987,7 +16218,6 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=n "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -15997,36 +16227,37 @@ async def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=n return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_cassandra_keyspace_to_autoscale_initial( + raw_result = await self._delete_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16035,12 +16266,9 @@ async def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -16055,171 +16283,37 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace_async - async def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + @distributed_trace + def list_mongo_db_collections( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An iterator like instance of MongoDBCollectionGetResults :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_keyspace_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) - - @distributed_trace_async - async def get_cassandra_table_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database - account with the provided name. + cls: ClsType[List[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) - :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -16228,66 +16322,104 @@ async def get_cassandra_table_throughput( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + _request = build_mongo_db_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_cassandra_resources_get_cassandra_table_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MongoDBCollectionGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, + 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 ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - async def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -16306,16 +16438,16 @@ async def _update_cassandra_table_throughput_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_update_cassandra_table_throughput_request( + _request = build_mongo_db_resources_list_mongo_db_collection_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16343,7 +16475,7 @@ async def _update_cassandra_table_throughput_initial( # pylint: disable=name-to pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -16364,165 +16496,172 @@ async def _update_cassandra_table_throughput_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - async def begin_update_cassandra_table_throughput( + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_cassandra_table_throughput( + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_cassandra_table_throughput( + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + collection_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_cassandra_table_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :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. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = 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._update_cassandra_table_throughput_initial( + raw_result = await self._list_mongo_db_collection_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + collection_name=collection_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -16534,7 +16673,7 @@ async def begin_update_cassandra_table_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16552,18 +16691,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].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.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16573,18 +16718,28 @@ async def _migrate_cassandra_table_to_autoscale_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 = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_migrate_cassandra_table_to_autoscale_request( + content_type = content_type or "application/json" + _content = None + if isinstance(location, (IOBase, bytes)): + _content = location + else: + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_retrieve_continuous_backup_information_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -16615,9 +16770,6 @@ async def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -16628,178 +16780,154 @@ async def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name return deserialized # type: ignore - @distributed_trace_async - async def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - 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_table_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: _types.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + :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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - return deserialized # type: ignore + :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 location: The name of the continuous backup restore location. Required. + :type location: 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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = 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_table_to_manual_throughput_initial( + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, + location=location, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16810,7 +16938,7 @@ async def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16828,33 +16956,33 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.BackupInformation].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.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @distributed_trace_async - async def get_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.CassandraKeyspaceGetResults: - """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the - provided name. + async def get_mongo_role_definition( + self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.MongoRoleDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given + Id. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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: CassandraKeyspaceGetResults. The CassandraKeyspaceGetResults is compatible with + :return: MongoRoleDefinitionGetResults. The MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16868,12 +16996,12 @@ async def get_cassandra_keyspace( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_keyspace_request( + _request = build_mongo_db_resources_get_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16900,7 +17028,7 @@ async def get_cassandra_keyspace( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -16908,20 +17036,22 @@ async def get_cassandra_keyspace( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) + deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long + async def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[ - _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] + create_update_mongo_role_definition_parameters: Union[ + _models.MongoRoleDefinitionCreateUpdateParameters, + _types.MongoRoleDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -16941,15 +17071,15 @@ async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_keyspace_parameters, (IOBase, bytes)): - _content = create_update_cassandra_keyspace_parameters + if isinstance(create_update_mongo_role_definition_parameters, (IOBase, bytes)): + _content = create_update_mongo_role_definition_parameters else: - _content = json.dumps(create_update_cassandra_keyspace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_keyspace_request( + _request = build_mongo_db_resources_create_update_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16977,16 +17107,13 @@ async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -16998,152 +17125,154 @@ async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too return deserialized # type: ignore @overload - async def begin_create_update_cassandra_keyspace( + async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, + create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters :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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_keyspace( + async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: _types.CassandraKeyspaceCreateUpdateParameters, + create_update_mongo_role_definition_parameters: _types.MongoRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters :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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_keyspace( + async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: IO[bytes], + create_update_mongo_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: IO[bytes] + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_cassandra_keyspace( + async def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[ - _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] + create_update_mongo_role_definition_parameters: Union[ + _models.MongoRoleDefinitionCreateUpdateParameters, + _types.MongoRoleDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> AsyncLROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = 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_keyspace_initial( + raw_result = await self._create_update_mongo_role_definition_initial( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, + create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17155,7 +17284,7 @@ async def begin_create_update_cassandra_keyspace( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) + deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17173,18 +17302,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CassandraKeyspaceGetResults].from_continuation_token( + return AsyncLROPoller[_models.MongoRoleDefinitionGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CassandraKeyspaceGetResults]( + return AsyncLROPoller[_models.MongoRoleDefinitionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_cassandra_keyspace_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -17199,10 +17328,10 @@ async def _delete_cassandra_keyspace_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_keyspace_request( + _request = build_mongo_db_resources_delete_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17221,24 +17350,22 @@ async def _delete_cassandra_keyspace_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -17248,18 +17375,18 @@ async def _delete_cassandra_keyspace_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + async def begin_delete_mongo_role_definition( + self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra keyspace. + """Deletes an existing Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17272,10 +17399,10 @@ async def begin_delete_cassandra_keyspace( 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_keyspace_initial( + raw_result = await self._delete_mongo_role_definition_initial( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17310,25 +17437,25 @@ 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 @distributed_trace - def list_cassandra_keyspaces( + def list_mongo_role_definitions( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CassandraKeyspaceGetResults"]: - """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + ) -> AsyncItemPaged["_models.MongoRoleDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraKeyspaceGetResults + :return: An iterator like instance of MongoRoleDefinitionGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17341,7 +17468,7 @@ def list_cassandra_keyspaces( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_keyspaces_request( + _request = build_mongo_db_resources_list_mongo_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -17384,7 +17511,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraKeyspaceGetResults], + List[_models.MongoRoleDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -17403,7 +17530,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -17413,23 +17540,22 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> _models.CassandraTableGetResults: - """Gets the Cassandra table under an existing Azure Cosmos DB database account. + async def get_mongo_user_definition( + self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.MongoUserDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given + Id. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: CassandraTableGetResults. The CassandraTableGetResults is compatible with + :return: MongoUserDefinitionGetResults. The MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17443,13 +17569,12 @@ async def get_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_table_request( + _request = build_mongo_db_resources_get_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17476,7 +17601,7 @@ async def get_cassandra_table( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -17484,21 +17609,22 @@ async def get_cassandra_table( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) + deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_cassandra_table_initial( + async def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[ - _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] + create_update_mongo_user_definition_parameters: Union[ + _models.MongoUserDefinitionCreateUpdateParameters, + _types.MongoUserDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -17518,16 +17644,15 @@ async def _create_update_cassandra_table_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_table_parameters, (IOBase, bytes)): - _content = create_update_cassandra_table_parameters + if isinstance(create_update_mongo_user_definition_parameters, (IOBase, bytes)): + _content = create_update_mongo_user_definition_parameters else: - _content = json.dumps(create_update_cassandra_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_user_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_table_request( + _request = build_mongo_db_resources_create_update_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17555,16 +17680,13 @@ async def _create_update_cassandra_table_initial( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -17576,165 +17698,154 @@ async def _create_update_cassandra_table_initial( return deserialized # type: ignore @overload - async def begin_create_update_cassandra_table( + async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, + create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters :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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_table( + async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: _types.CassandraTableCreateUpdateParameters, + create_update_mongo_user_definition_parameters: _types.MongoUserDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters :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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_table( + async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: IO[bytes], + create_update_mongo_user_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: IO[bytes] + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_cassandra_table( + async def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[ - _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] + create_update_mongo_user_definition_parameters: Union[ + _models.MongoUserDefinitionCreateUpdateParameters, + _types.MongoUserDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> AsyncLROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoUserDefinitionGetResults] = 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_table_initial( + raw_result = await self._create_update_mongo_user_definition_initial( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, + create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17746,7 +17857,7 @@ async def begin_create_update_cassandra_table( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) + deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17764,18 +17875,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CassandraTableGetResults].from_continuation_token( + return AsyncLROPoller[_models.MongoUserDefinitionGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CassandraTableGetResults]( + return AsyncLROPoller[_models.MongoUserDefinitionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_cassandra_table_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -17790,11 +17901,10 @@ async def _delete_cassandra_table_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_table_request( + _request = build_mongo_db_resources_delete_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17813,24 +17923,22 @@ async def _delete_cassandra_table_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -17840,20 +17948,18 @@ async def _delete_cassandra_table_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + async def begin_delete_mongo_user_definition( + self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra table. + """Deletes an existing Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17866,11 +17972,10 @@ async def begin_delete_cassandra_table( 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_table_initial( + raw_result = await self._delete_mongo_user_definition_initial( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17905,27 +18010,25 @@ 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 @distributed_trace - def list_cassandra_tables( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CassandraTableGetResults"]: - """Lists the Cassandra table under an existing Azure Cosmos DB database account. + def list_mongo_user_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MongoUserDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB Mongo User Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraTableGetResults + :return: An iterator like instance of MongoUserDefinitionGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoUserDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17938,10 +18041,9 @@ def list_cassandra_tables( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_tables_request( + _request = build_mongo_db_resources_list_mongo_user_definitions_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17982,7 +18084,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraTableGetResults], + List[_models.MongoUserDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -18001,7 +18103,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -18010,23 +18112,41 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class TableResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`table_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace_async - async def get_cassandra_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> _models.CassandraRoleDefinitionResource: - """Retrieves the properties of an existing Azure Cosmos DB Cassandra Role Definition with the - given Id. + async def get_table_throughput( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with + the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: CassandraRoleDefinitionResource. The CassandraRoleDefinitionResource is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18040,12 +18160,12 @@ async def get_cassandra_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_role_definition_request( + _request = build_table_resources_get_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -18080,20 +18200,20 @@ async def get_cassandra_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_cassandra_role_definition_initial( # pylint: disable=name-too-long + async def _update_table_throughput_initial( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: Union[ - _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -18113,15 +18233,15 @@ async def _create_update_cassandra_role_definition_initial( # pylint: disable=n content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_role_definition_parameters, (IOBase, bytes)): - _content = create_update_cassandra_role_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_cassandra_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_role_definition_request( + _request = build_table_resources_update_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -18170,152 +18290,152 @@ async def _create_update_cassandra_role_definition_initial( # pylint: disable=n return deserialized # type: ignore @overload - async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + async def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: _models.CassandraRoleDefinitionResource, + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. 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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + async def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: _types.CassandraRoleDefinitionResource, + table_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + async def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: IO[bytes], + table_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. 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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + async def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: Union[ - _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a CassandraRoleDefinitionResource type or a IO[bytes] type. + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraRoleDefinitionResource] = kwargs.pop("cls", 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._create_update_cassandra_role_definition_initial( + raw_result = await self._update_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, - create_update_cassandra_role_definition_parameters=create_update_cassandra_role_definition_parameters, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18327,7 +18447,7 @@ async def begin_create_update_cassandra_role_definition( # pylint: disable=name def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18345,18 +18465,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CassandraRoleDefinitionResource].from_continuation_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.CassandraRoleDefinitionResource]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -18371,10 +18491,10 @@ async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_role_definition_request( + _request = build_table_resources_migrate_table_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -18393,14 +18513,14 @@ async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too response = pipeline_response.http_response - if response.status_code not in [200, 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -18411,6 +18531,7 @@ async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -18420,34 +18541,36 @@ async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too return deserialized # type: ignore @distributed_trace_async - async def begin_delete_cassandra_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra Role Definition. + async def begin_migrate_table_to_autoscale( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_cassandra_role_definition_initial( + raw_result = await self._migrate_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18456,9 +18579,12 @@ async def begin_delete_cassandra_role_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -18473,35 +18599,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_cassandra_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CassandraRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Cassandra 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 CassandraRoleDefinitionResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CassandraRoleDefinitionResource]] = kwargs.pop("cls", None) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -18510,97 +18620,144 @@ def list_cassandra_role_definitions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_cassandra_resources_list_cassandra_role_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_table_resources_migrate_table_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.CassandraRoleDefinitionResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace_async - async def get_cassandra_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any - ) -> _models.CassandraRoleAssignmentResource: - """Retrieves the properties of an existing Azure Cosmos DB Cassandra Role Assignment with the - given Id. + async def begin_migrate_table_to_manual_throughput( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: CassandraRoleAssignmentResource. The CassandraRoleAssignmentResource is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_table_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace_async + async def get_table( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> _models.TableGetResults: + """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: TableGetResults. The TableGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18614,12 +18771,12 @@ async def get_cassandra_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_role_assignment_request( + _request = build_table_resources_get_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -18654,20 +18811,20 @@ async def get_cassandra_role_assignment( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.TableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-too-long + async def _create_update_table_initial( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: Union[ - _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + table_name: str, + create_update_table_parameters: Union[ + _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -18687,15 +18844,15 @@ async def _create_update_cassandra_role_assignment_initial( # pylint: disable=n content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_cassandra_role_assignment_parameters + if isinstance(create_update_table_parameters, (IOBase, bytes)): + _content = create_update_table_parameters else: - _content = json.dumps(create_update_cassandra_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_role_assignment_request( + _request = build_table_resources_create_update_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -18744,152 +18901,144 @@ async def _create_update_cassandra_role_assignment_initial( # pylint: disable=n return deserialized # type: ignore @overload - async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: _models.CassandraRoleAssignmentResource, + table_name: str, + create_update_table_parameters: _models.TableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> AsyncLROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters :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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of AsyncLROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: _types.CassandraRoleAssignmentResource, + table_name: str, + create_update_table_parameters: _types.TableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> AsyncLROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters :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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of AsyncLROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: IO[bytes], + table_name: str, + create_update_table_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> AsyncLROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of AsyncLROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: Union[ - _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + table_name: str, + create_update_table_parameters: Union[ + _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> AsyncLROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a CassandraRoleAssignmentResource type or a IO[bytes] type. - Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource or - ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. Is + either a TableCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters + or ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TableGetResults] = 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_role_assignment_initial( + raw_result = await self._create_update_table_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, - create_update_cassandra_role_assignment_parameters=create_update_cassandra_role_assignment_parameters, + table_name=table_name, + create_update_table_parameters=create_update_table_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18901,7 +19050,7 @@ async def begin_create_update_cassandra_role_assignment( # pylint: disable=name def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.TableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18919,18 +19068,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CassandraRoleAssignmentResource].from_continuation_token( + return AsyncLROPoller[_models.TableGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CassandraRoleAssignmentResource]( + return AsyncLROPoller[_models.TableGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + async def _delete_table_initial( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18945,10 +19094,10 @@ async def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_role_assignment_request( + _request = build_table_resources_delete_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -18967,7 +19116,7 @@ async def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -18994,18 +19143,18 @@ async def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too return deserialized # type: ignore @distributed_trace_async - async def begin_delete_cassandra_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + async def begin_delete_table( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra Role Assignment. + """Deletes an existing Azure Cosmos DB Table. :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 table_name: Cosmos DB table name. Required. + :type table_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -19018,10 +19167,10 @@ async def begin_delete_cassandra_role_assignment( 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_role_assignment_initial( + raw_result = await self._delete_table_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -19056,25 +19205,24 @@ 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 @distributed_trace - def list_cassandra_role_assignments( + def list_tables( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CassandraRoleAssignmentResource"]: - """Retrieves the list of all Azure Cosmos DB Cassandra Role Assignments. + ) -> AsyncItemPaged["_models.TableGetResults"]: + """Lists the Tables under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraRoleAssignmentResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An iterator like instance of TableGetResults + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraRoleAssignmentResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TableGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19087,7 +19235,7 @@ def list_cassandra_role_assignments( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_role_assignments_request( + _request = build_table_resources_list_tables_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -19130,7 +19278,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraRoleAssignmentResource], + List[_models.TableGetResults], deserialized.get("value", []), ) if cls: @@ -19158,109 +19306,12 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class GremlinResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`gremlin_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get_gremlin_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: 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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - - _request = build_gremlin_resources_get_gremlin_database_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long + async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + table_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -19279,15 +19330,15 @@ async def _update_gremlin_database_throughput_initial( # pylint: disable=name-t content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(location, (IOBase, bytes)): + _content = location else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_update_gremlin_database_throughput_request( + _request = build_table_resources_retrieve_continuous_backup_information_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19315,16 +19366,13 @@ async def _update_gremlin_database_throughput_initial( # pylint: disable=name-t pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -19336,152 +19384,139 @@ async def _update_gremlin_database_throughput_initial( # pylint: disable=name-t return deserialized # type: ignore @overload - async def begin_update_gremlin_database_throughput( + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + table_name: str, + location: _models.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_gremlin_database_throughput( + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + table_name: str, + location: _types.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_gremlin_database_throughput( + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: IO[bytes], + table_name: str, + location: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_gremlin_database_throughput( + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + table_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupInformation] = 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_gremlin_database_throughput_initial( + raw_result = await self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - update_throughput_parameters=update_throughput_parameters, + table_name=table_name, + location=location, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19493,7 +19528,7 @@ async def begin_update_gremlin_database_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19511,19 +19546,35 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return AsyncLROPoller[_models.BackupInformation].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.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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]: + @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. The TableRoleDefinitionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19535,14 +19586,92 @@ async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=nam _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + + _request = build_table_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) + + 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, _types.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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_database_to_autoscale_request( + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): + _content = create_update_table_role_definition_parameters + else: + _content = json.dumps(create_update_table_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_table_resources_create_update_table_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -19566,7 +19695,7 @@ async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=nam pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -19577,7 +19706,6 @@ async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=nam "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -19586,37 +19714,154 @@ async def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=nam 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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :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: _types.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.types.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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. + 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, _types.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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.TableRoleDefinitionResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + 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._migrate_gremlin_database_to_autoscale_initial( + raw_result = await self._create_update_table_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, + create_update_table_role_definition_parameters=create_update_table_role_definition_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -19627,7 +19872,7 @@ async def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-t def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19645,18 +19890,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.TableRoleDefinitionResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + 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, @@ -19671,10 +19916,10 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: dis cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_database_to_manual_throughput_request( + _request = build_table_resources_delete_table_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -19693,14 +19938,14 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: dis response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -19711,7 +19956,6 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: dis "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -19721,36 +19965,34 @@ async def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: dis return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_gremlin_database_to_manual_throughput_initial( + raw_result = await self._delete_table_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -19759,12 +20001,9 @@ async def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disabl await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -19779,35 +20018,134 @@ 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 + + @distributed_trace + def list_table_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 TableRoleDefinitionResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TableRoleDefinitionResource]] = 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_table_resources_list_table_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TableRoleDefinitionResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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_gremlin_graph_throughput( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the - provided name. + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: TableRoleAssignmentResource. The TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19821,13 +20159,12 @@ async def get_gremlin_graph_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_graph_throughput_request( + _request = build_table_resources_get_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -19862,21 +20199,20 @@ async def get_gremlin_graph_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _update_gremlin_graph_throughput_initial( + async def _create_update_table_role_assignment_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[ + _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -19896,16 +20232,15 @@ async def _update_gremlin_graph_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_table_role_assignment_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_table_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_update_gremlin_graph_throughput_request( + _request = build_table_resources_create_update_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19954,165 +20289,152 @@ async def _update_gremlin_graph_throughput_initial( return deserialized # type: ignore @overload - async def begin_update_gremlin_graph_throughput( + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_gremlin_graph_throughput( + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _types.TableRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update_gremlin_graph_throughput( + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: IO[bytes], + role_assignment_id: str, + create_update_table_role_assignment_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update_gremlin_graph_throughput( + async def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[ + _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + :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 update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.TableRoleAssignmentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_gremlin_graph_throughput_initial( + raw_result = await self._create_update_table_role_assignment_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - update_throughput_parameters=update_throughput_parameters, + role_assignment_id=role_assignment_id, + create_update_table_role_assignment_parameters=create_update_table_role_assignment_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20124,7 +20446,7 @@ async def begin_update_gremlin_graph_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20142,18 +20464,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return AsyncLROPoller[_models.TableRoleAssignmentResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + 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, @@ -20168,11 +20490,10 @@ async def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-t cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_graph_to_autoscale_request( + _request = build_table_resources_delete_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20191,14 +20512,14 @@ async def _migrate_gremlin_graph_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 [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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -20209,7 +20530,6 @@ async def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-t "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -20219,39 +20539,34 @@ async def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-t return deserialized # type: ignore @distributed_trace_async - async def begin_migrate_gremlin_graph_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_gremlin_graph_to_autoscale_initial( + raw_result = await self._delete_table_role_assignment_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20260,12 +20575,9 @@ async def begin_migrate_gremlin_graph_to_autoscale( await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -20280,19 +20592,35 @@ 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 + + @distributed_trace + def list_table_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 TableRoleAssignmentResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TableRoleAssignmentResource]] = kwargs.pop("cls", None) - 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20301,150 +20629,115 @@ async def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disabl } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_gremlin_resources_migrate_gremlin_graph_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(next_link=None): + if not 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 - ) + _request = build_table_resources_list_table_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return _request - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TableRoleAssignmentResource], + deserialized.get("value", []), ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + async def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace_async - async def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + return pipeline_response - :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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return AsyncItemPaged(get_next, extract_data) - 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_gremlin_graph_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized +class CassandraResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`cassandra_resources` attribute. + """ - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def get_gremlin_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.GremlinDatabaseGetResults: - """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided - name. + async def get_cassandra_keyspace_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: GremlinDatabaseGetResults. The GremlinDatabaseGetResults is compatible with + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20458,12 +20751,12 @@ async def get_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_database_request( + _request = build_cassandra_resources_get_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20498,20 +20791,20 @@ async def get_gremlin_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_gremlin_database_initial( + async def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: Union[ - _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + keyspace_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -20531,15 +20824,15 @@ async def _create_update_gremlin_database_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_database_parameters, (IOBase, bytes)): - _content = create_update_gremlin_database_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_database_request( + _request = build_cassandra_resources_update_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -20588,152 +20881,152 @@ async def _create_update_gremlin_database_initial( return deserialized # type: ignore @overload - async def begin_create_update_gremlin_database( + async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters, + keyspace_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. 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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_database( + async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: _types.GremlinDatabaseCreateUpdateParameters, + keyspace_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_database( + async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: IO[bytes], + keyspace_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. 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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_gremlin_database( + async def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: Union[ - _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + keyspace_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", 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._create_update_gremlin_database_initial( + raw_result = await self._update_cassandra_keyspace_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + keyspace_name=keyspace_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20745,7 +21038,7 @@ async def begin_create_update_gremlin_database( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20763,18 +21056,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.GremlinDatabaseGetResults].from_continuation_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.GremlinDatabaseGetResults]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_gremlin_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -20789,10 +21082,10 @@ async def _delete_gremlin_database_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_database_request( + _request = build_cassandra_resources_migrate_cassandra_keyspace_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20811,14 +21104,14 @@ async def _delete_gremlin_database_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -20829,6 +21122,7 @@ async def _delete_gremlin_database_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -20838,34 +21132,36 @@ async def _delete_gremlin_database_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_gremlin_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin database. + async def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_gremlin_database_initial( + raw_result = await self._migrate_cassandra_keyspace_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20874,9 +21170,12 @@ async def begin_delete_gremlin_database( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -20891,35 +21190,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_databases( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GremlinDatabaseGetResults"]: - """Lists the Gremlin databases under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 GremlinDatabaseGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinDatabaseGetResults]] = kwargs.pop("cls", None) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -20928,97 +21211,148 @@ def list_gremlin_databases( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_gremlin_resources_list_gremlin_databases_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinDatabaseGetResults], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_keyspace_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) @distributed_trace_async - async def get_gremlin_graph( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> _models.GremlinGraphGetResults: - """Gets the Gremlin graph under an existing Azure Cosmos DB database account. + async def get_cassandra_table_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: GremlinGraphGetResults. The GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21032,13 +21366,13 @@ async def get_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_graph_request( + _request = build_cassandra_resources_get_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21073,21 +21407,21 @@ async def get_gremlin_graph( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_gremlin_graph_initial( + async def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: Union[ - _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -21107,16 +21441,16 @@ async def _create_update_gremlin_graph_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_graph_parameters, (IOBase, bytes)): - _content = create_update_gremlin_graph_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_graph_request( + _request = build_cassandra_resources_update_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -21165,161 +21499,165 @@ async def _create_update_gremlin_graph_initial( return deserialized # type: ignore @overload - async def begin_create_update_gremlin_graph( + async def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters, + keyspace_name: str, + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. 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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_graph( + async def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: _types.GremlinGraphCreateUpdateParameters, + keyspace_name: str, + table_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_graph( + async def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: IO[bytes], + keyspace_name: str, + table_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. 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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_gremlin_graph( + async def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: Union[ - _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", 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._create_update_gremlin_graph_initial( + raw_result = await self._update_cassandra_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, + keyspace_name=keyspace_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21331,7 +21669,7 @@ async def begin_create_update_gremlin_graph( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21349,18 +21687,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.GremlinGraphGetResults].from_continuation_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.GremlinGraphGetResults]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_gremlin_graph_initial( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -21375,11 +21713,11 @@ async def _delete_gremlin_graph_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_graph_request( + _request = build_cassandra_resources_migrate_cassandra_table_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21398,14 +21736,14 @@ async def _delete_gremlin_graph_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -21416,6 +21754,7 @@ async def _delete_gremlin_graph_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -21425,37 +21764,39 @@ async def _delete_gremlin_graph_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_gremlin_graph( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin graph. + async def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_gremlin_graph_initial( + raw_result = await self._migrate_cassandra_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -21464,9 +21805,12 @@ async def begin_delete_gremlin_graph( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -21481,128 +21825,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_graphs( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GremlinGraphGetResults"]: - """Lists the Gremlin graph under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 GremlinGraphGetResults - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinGraphGetResults]] = 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_gremlin_resources_list_gremlin_graphs_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinGraphGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], - **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -21612,28 +21846,18 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(location, (IOBase, bytes)): - _content = location - else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gremlin_resources_retrieve_continuous_backup_information_request( + _request = build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -21664,6 +21888,9 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -21674,154 +21901,40 @@ async def _retrieve_continuous_backup_information_initial( # pylint: disable=na return deserialized # type: ignore - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: _models.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: _types.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: 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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace_async - async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. + async def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = kwargs.pop("cls", 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._retrieve_continuous_backup_information_initial( + raw_result = await self._migrate_cassandra_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - location=location, - content_type=content_type, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -21832,7 +21945,7 @@ async def begin_retrieve_continuous_backup_information( # pylint: disable=name- def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21850,33 +21963,35 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.BackupInformation].from_continuation_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.BackupInformation]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @distributed_trace_async - async def get_gremlin_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> _models.GremlinRoleDefinitionResource: - """Retrieves the properties of an existing Azure Cosmos DB Gremlin Role Definition with the given - Id. + 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :return: GremlinRoleDefinitionResource. The GremlinRoleDefinitionResource is compatible with + :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. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -21890,12 +22005,13 @@ async def get_gremlin_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_role_definition_request( + _request = build_cassandra_resources_get_cassandra_view_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21930,20 +22046,21 @@ async def get_gremlin_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too-long + async def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: Union[ - _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -21963,15 +22080,16 @@ async def _create_update_gremlin_role_definition_initial( # pylint: disable=nam content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_role_definition_parameters, (IOBase, bytes)): - _content = create_update_gremlin_role_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_role_definition_request( + _request = build_cassandra_resources_update_cassandra_view_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22020,153 +22138,166 @@ async def _create_update_gremlin_role_definition_initial( # pylint: disable=nam return deserialized # type: ignore @overload - async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + async def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: _models.GremlinRoleDefinitionResource, + keyspace_name: str, + view_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + async def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: _types.GremlinRoleDefinitionResource, + keyspace_name: str, + view_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource + :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.types.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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + async def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: IO[bytes], + keyspace_name: str, + view_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: IO[bytes] + :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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + async def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: Union[ - _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a GremlinRoleDefinitionResource type or a IO[bytes] type. - Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping + :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 + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinRoleDefinitionResource] = kwargs.pop("cls", 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._create_update_gremlin_role_definition_initial( + raw_result = await self._update_cassandra_view_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, - create_update_gremlin_role_definition_parameters=create_update_gremlin_role_definition_parameters, - content_type=content_type, + keyspace_name=keyspace_name, + view_name=view_name, + update_throughput_parameters=update_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -22177,7 +22308,7 @@ async def begin_create_update_gremlin_role_definition( # pylint: disable=name-t def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22195,18 +22326,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.GremlinRoleDefinitionResource].from_continuation_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.GremlinRoleDefinitionResource]( + return AsyncLROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_gremlin_role_definition_initial( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + 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, @@ -22221,10 +22352,11 @@ async def _delete_gremlin_role_definition_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_role_definition_request( + _request = build_cassandra_resources_migrate_cassandra_view_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22243,14 +22375,14 @@ async def _delete_gremlin_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -22261,6 +22393,7 @@ async def _delete_gremlin_role_definition_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -22270,34 +22403,39 @@ async def _delete_gremlin_role_definition_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_gremlin_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin Role Definition. + 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", 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._delete_gremlin_role_definition_initial( + raw_result = await self._migrate_cassandra_view_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -22306,9 +22444,12 @@ async def begin_delete_gremlin_role_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -22323,35 +22464,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GremlinRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Gremlin 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 GremlinRoleDefinitionResource - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinRoleDefinitionResource]] = kwargs.pop("cls", None) + 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, @@ -22360,97 +22485,150 @@ def list_gremlin_role_definitions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_gremlin_resources_list_gremlin_role_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinRoleDefinitionResource], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) @distributed_trace_async - async def get_gremlin_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any - ) -> _models.GremlinRoleAssignmentResource: - """Retrieves the properties of an existing Azure Cosmos DB Gremlin Role Assignment with the given - Id. + async def get_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> _models.CassandraKeyspaceGetResults: + """Gets the Cassandra keyspaces 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 role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str - :return: GremlinRoleAssignmentResource. The GremlinRoleAssignmentResource is compatible with + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: CassandraKeyspaceGetResults. The CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -22464,12 +22642,12 @@ async def get_gremlin_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_role_assignment_request( + _request = build_cassandra_resources_get_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22504,20 +22682,20 @@ async def get_gremlin_role_assignment( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too-long + async def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: Union[ - _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + keyspace_name: str, + create_update_cassandra_keyspace_parameters: Union[ + _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -22537,15 +22715,15 @@ async def _create_update_gremlin_role_assignment_initial( # pylint: disable=nam content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_gremlin_role_assignment_parameters + if isinstance(create_update_cassandra_keyspace_parameters, (IOBase, bytes)): + _content = create_update_cassandra_keyspace_parameters else: - _content = json.dumps(create_update_gremlin_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_keyspace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_role_assignment_request( + _request = build_cassandra_resources_create_update_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22594,152 +22772,152 @@ async def _create_update_gremlin_role_assignment_initial( # pylint: disable=nam return deserialized # type: ignore @overload - async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: _models.GremlinRoleAssignmentResource, + keyspace_name: str, + create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters :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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: _types.GremlinRoleAssignmentResource, + keyspace_name: str, + create_update_cassandra_keyspace_parameters: _types.CassandraKeyspaceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters :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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: IO[bytes], + keyspace_name: str, + create_update_cassandra_keyspace_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + async def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: Union[ - _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + keyspace_name: str, + create_update_cassandra_keyspace_parameters: Union[ + _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> AsyncLROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a GremlinRoleAssignmentResource type or a IO[bytes] type. - Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource or - ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes] + type. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraKeyspaceGetResults] = 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_gremlin_role_assignment_initial( + raw_result = await self._create_update_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, - create_update_gremlin_role_assignment_parameters=create_update_gremlin_role_assignment_parameters, + keyspace_name=keyspace_name, + create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22751,7 +22929,7 @@ async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-t def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22769,18 +22947,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.GremlinRoleAssignmentResource].from_continuation_token( + return AsyncLROPoller[_models.CassandraKeyspaceGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.GremlinRoleAssignmentResource]( + return AsyncLROPoller[_models.CassandraKeyspaceGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_gremlin_role_assignment_initial( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + async def _delete_cassandra_keyspace_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22795,10 +22973,10 @@ async def _delete_gremlin_role_assignment_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_role_assignment_request( + _request = build_cassandra_resources_delete_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22817,7 +22995,7 @@ async def _delete_gremlin_role_assignment_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -22844,18 +23022,18 @@ async def _delete_gremlin_role_assignment_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete_gremlin_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + async def begin_delete_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin Role Assignment. + """Deletes an existing Azure Cosmos DB Cassandra keyspace. :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 keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -22868,10 +23046,10 @@ async def begin_delete_gremlin_role_assignment( 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_gremlin_role_assignment_initial( + raw_result = await self._delete_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -22906,25 +23084,25 @@ 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 @distributed_trace - def list_gremlin_role_assignments( + def list_cassandra_keyspaces( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.GremlinRoleAssignmentResource"]: - """Retrieves the list of all Azure Cosmos DB Gremlin Role Assignments. + ) -> AsyncItemPaged["_models.CassandraKeyspaceGetResults"]: + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 GremlinRoleAssignmentResource + :return: An iterator like instance of CassandraKeyspaceGetResults :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GremlinRoleAssignmentResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -22937,7 +23115,7 @@ def list_gremlin_role_assignments( def prepare_request(next_link=None): if not next_link: - _request = build_gremlin_resources_list_gremlin_role_assignments_request( + _request = build_cassandra_resources_list_cassandra_keyspaces_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -22980,7 +23158,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.GremlinRoleAssignmentResource], + List[_models.CassandraKeyspaceGetResults], deserialized.get("value", []), ) if cls: @@ -23008,44 +23186,24 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class NotebookWorkspacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`notebook_workspaces` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any - ) -> _models.NotebookWorkspace: - """Gets the notebook workspace for a Cosmos DB account. + async def get_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> _models.CassandraTableGetResults: + """Gets the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: NotebookWorkspace. The NotebookWorkspace is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: CassandraTableGetResults. The CassandraTableGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23059,12 +23217,13 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_get_request( + _request = build_cassandra_resources_get_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23099,21 +23258,22 @@ async def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + async def _create_update_cassandra_table_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: Union[ - _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] - ], + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: Union[ + _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -23132,15 +23292,16 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(notebook_create_update_parameters, (IOBase, bytes)): - _content = notebook_create_update_parameters + if isinstance(create_update_cassandra_table_parameters, (IOBase, bytes)): + _content = create_update_cassandra_table_parameters else: - _content = json.dumps(notebook_create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_notebook_workspaces_create_or_update_request( + _request = build_cassandra_resources_create_update_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23161,7 +23322,7 @@ async def _create_or_update_initial( response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -23174,7 +23335,12 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -23184,152 +23350,165 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> AsyncLROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters :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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :return: An instance of AsyncLROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: _types.NotebookWorkspaceCreateUpdateParameters, + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: _types.CassandraTableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> AsyncLROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters :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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :return: An instance of AsyncLROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: IO[bytes], + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> AsyncLROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :return: An instance of AsyncLROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: Union[ - _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: Union[ + _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> AsyncLROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> AsyncLROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Is either a NotebookWorkspaceCreateUpdateParameters type or a IO[bytes] type. + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraTableGetResults] = 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( + raw_result = await self._create_update_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, - notebook_create_update_parameters=notebook_create_update_parameters, + keyspace_name=keyspace_name, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23340,13 +23519,10 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -23362,22 +23538,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.NotebookWorkspace].from_continuation_token( + return AsyncLROPoller[_models.CassandraTableGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.NotebookWorkspace]( + return AsyncLROPoller[_models.CassandraTableGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -23392,10 +23564,11 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_delete_request( + _request = build_cassandra_resources_delete_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23428,8 +23601,10 @@ async def _delete_initial( 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -23439,23 +23614,20 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + async def begin_delete_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes the notebook workspace for a Cosmos DB account. + """Deletes an existing Azure Cosmos DB Cassandra table. :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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -23468,10 +23640,11 @@ async def begin_delete( 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( + raw_result = await self._delete_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23506,24 +23679,27 @@ 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 @distributed_trace - def list_by_database_account( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.NotebookWorkspace"]: - """Gets the notebook workspace resources of an existing Cosmos DB account. + def list_cassandra_tables( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CassandraTableGetResults"]: + """Lists the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 NotebookWorkspace - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An iterator like instance of CassandraTableGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.NotebookWorkspace]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23536,9 +23712,10 @@ def list_by_database_account( def prepare_request(next_link=None): if not next_link: - _request = build_notebook_workspaces_list_by_database_account_request( + _request = build_cassandra_resources_list_cassandra_tables_request( resource_group_name=resource_group_name, account_name=account_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23579,7 +23756,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.NotebookWorkspace], + List[_models.CassandraTableGetResults], deserialized.get("value", []), ) if cls: @@ -23608,26 +23785,22 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def list_connection_info( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any - ) -> _models.NotebookWorkspaceConnectionInfoResult: - """Retrieves the connection info for the notebook workspace. + 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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: NotebookWorkspaceConnectionInfoResult. The NotebookWorkspaceConnectionInfoResult is - compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult + :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. The CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23641,12 +23814,13 @@ async def list_connection_info( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_list_connection_info_request( + _request = build_cassandra_resources_get_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23681,18 +23855,22 @@ async def list_connection_info( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.NotebookWorkspaceConnectionInfoResult, response.json()) + deserialized = _deserialize(_models.CassandraViewGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _regenerate_auth_token_initial( + async def _create_update_cassandra_view_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + keyspace_name: str, + view_name: str, + create_update_cassandra_view_parameters: Union[ + _models.CassandraViewCreateUpdateParameters, _types.CassandraViewCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -23703,17 +23881,28 @@ async def _regenerate_auth_token_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_regenerate_auth_token_request( + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_cassandra_view_parameters, (IOBase, bytes)): + _content = create_update_cassandra_view_parameters + else: + _content = json.dumps(create_update_cassandra_view_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_resources_create_update_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -23744,8 +23933,11 @@ async def _regenerate_auth_token_initial( response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -23754,40 +23946,163 @@ async def _regenerate_auth_token_initial( 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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :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: _types.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.types.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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace_async - async def begin_regenerate_auth_token( + async def begin_create_update_cassandra_view( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + keyspace_name: str, + view_name: str, + create_update_cassandra_view_parameters: Union[ + _models.CassandraViewCreateUpdateParameters, _types.CassandraViewCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[None]: - """Regenerates the auth token for the notebook workspace. + ) -> 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 notebook_workspace_name: The name of the notebook workspace resource. "default" + :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 notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraViewCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + 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._regenerate_auth_token_initial( + raw_result = await self._create_update_cassandra_view_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, + create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23796,9 +24111,12 @@ async def begin_regenerate_auth_token( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CassandraViewGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -23813,20 +24131,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return AsyncLROPoller[_models.CassandraViewGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _start_initial( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + 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, @@ -23841,10 +24157,11 @@ async def _start_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_start_request( + _request = build_cassandra_resources_delete_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23863,7 +24180,7 @@ async def _start_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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): @@ -23877,8 +24194,11 @@ async def _start_initial( response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -23888,23 +24208,20 @@ async def _start_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + async def begin_delete_cassandra_view( + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Starts the notebook workspace. + """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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :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 None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -23917,10 +24234,11 @@ async def begin_start( 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._start_initial( + raw_result = await self._delete_cassandra_view_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23954,40 +24272,129 @@ 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 + @distributed_trace + def list_cassandra_views( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CassandraViewGetResults"]: + """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :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 CassandraViewGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ + cls: ClsType[List[_models.CassandraViewGetResults]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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_cassandra_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CassandraViewGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. + async def get_cassandra_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.CassandraRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: CassandraRoleDefinitionResource. The CassandraRoleDefinitionResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24001,12 +24408,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleDefinitionResource] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_get_request( + _request = build_cassandra_resources_get_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24041,19 +24448,21 @@ async def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_or_update_initial( + async def _create_update_cassandra_role_definition_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: Union[ + _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + ], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -24072,15 +24481,15 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(create_update_cassandra_role_definition_parameters, (IOBase, bytes)): + _content = create_update_cassandra_role_definition_parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_private_endpoint_connections_create_or_update_request( + _request = build_cassandra_resources_create_update_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -24115,6 +24524,9 @@ async def _create_or_update_initial( 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -24126,142 +24538,152 @@ async def _create_or_update_initial( return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, + role_definition_id: str, + create_update_cassandra_role_definition_parameters: _models.CassandraRoleDefinitionResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource :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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: _types.PrivateEndpointConnection, + role_definition_id: str, + create_update_cassandra_role_definition_parameters: _types.CassandraRoleDefinitionResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource :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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_create_or_update( + async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: IO[bytes] + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping + :return: An instance of AsyncLROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_create_or_update( + async def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: Union[ + _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + ], **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> AsyncLROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection or - ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a CassandraRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource or + ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleDefinitionResource] = 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( + raw_result = await self._create_update_cassandra_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, + role_definition_id=role_definition_id, + create_update_cassandra_role_definition_parameters=create_update_cassandra_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24273,7 +24695,7 @@ async def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24291,18 +24713,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + return AsyncLROPoller[_models.CassandraRoleDefinitionResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( + return AsyncLROPoller[_models.CassandraRoleDefinitionResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24317,10 +24739,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_delete_request( + _request = build_cassandra_resources_delete_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24339,7 +24761,7 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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): @@ -24353,8 +24775,10 @@ async def _delete_initial( 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -24364,18 +24788,18 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + async def begin_delete_cassandra_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. + """Deletes an existing Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_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 None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24388,10 +24812,10 @@ async def begin_delete( 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( + raw_result = await self._delete_cassandra_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -24426,25 +24850,25 @@ 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 @distributed_trace - def list_by_database_account( + def list_cassandra_role_definitions( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """List all private endpoint connections on a Cosmos DB account. + ) -> AsyncItemPaged["_models.CassandraRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Cassandra 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 PrivateEndpointConnection + :return: An iterator like instance of CassandraRoleDefinitionResource :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraRoleDefinitionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24457,7 +24881,7 @@ def list_by_database_account( def prepare_request(next_link=None): if not next_link: - _request = build_private_endpoint_connections_list_by_database_account_request( + _request = build_cassandra_resources_list_cassandra_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -24500,7 +24924,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PrivateEndpointConnection], + List[_models.CassandraRoleDefinitionResource], deserialized.get("value", []), ) if cls: @@ -24528,39 +24952,23 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, account_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Cosmos DB account. + async def get_cassandra_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.CassandraRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Cassandra 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 group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: CassandraRoleAssignmentResource. The CassandraRoleAssignmentResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24574,12 +24982,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) - _request = build_private_link_resources_get_request( + _request = build_cassandra_resources_get_cassandra_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - group_name=group_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24614,34 +25022,284 @@ async def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) 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 - ) -> AsyncItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Cosmos DB account. + async def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: Union[ + _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_cassandra_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_cassandra_role_assignment_parameters + else: + _content = json.dumps(create_update_cassandra_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_resources_create_update_cassandra_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: _models.CassandraRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 - :return: An iterator like instance of PrivateLinkResource + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResource] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: _types.CassandraRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource + :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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: Union[ + _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a CassandraRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraRoleAssignmentResource] = 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_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_cassandra_role_assignment_parameters=create_update_cassandra_role_assignment_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CassandraRoleAssignmentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CassandraRoleAssignmentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + async def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24650,124 +25308,141 @@ def list_by_database_account( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_private_link_resources_list_by_database_account_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_resources_delete_cassandra_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PrivateLinkResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore + @distributed_trace_async + async def begin_delete_cassandra_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Cassandra Role Assignment. -class DatabaseOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`database` attribute. - """ + 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_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + 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 __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_metrics( - self, resource_group_name: str, account_name: str, database_rid: str, *, filter: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and - database. + def list_cassandra_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CassandraRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Cassandra 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 - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :return: An iterator like instance of CassandraRoleAssignmentResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraRoleAssignmentResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24780,12 +25455,10 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_database_list_metrics_request( + _request = build_cassandra_resources_list_cassandra_role_assignments_request( resource_group_name=resource_group_name, account_name=account_name, - database_rid=database_rid, subscription_id=self._config.subscription_id, - filter=filter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -24825,7 +25498,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Metric], + List[_models.CassandraRoleAssignmentResource], deserialized.get("value", []), ) if cls: @@ -24853,38 +25526,43 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - @distributed_trace - def list_usages( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - *, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Usage"]: - """Retrieves the usages (most recent data) for the given database. + +class GremlinResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`gremlin_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_gremlin_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: 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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24893,104 +25571,66 @@ def list_usages( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_database_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_get_gremlin_database_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Usage], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace - def list_metric_definitions( - self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MetricDefinition"]: - """Retrieves metric definitions for the given database. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - :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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :return: An iterator like instance of MetricDefinition - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - cls: ClsType[List[_models.MetricDefinition]] = kwargs.pop("cls", None) + return deserialized # type: ignore + async def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -24999,256 +25639,260 @@ def list_metric_definitions( } 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 = kwargs.pop("params", {}) or {} - _request = build_database_list_metric_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_gremlin_resources_update_gremlin_database_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MetricDefinition], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class CollectionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`collection` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list_metrics( + @overload + async def begin_update_gremlin_database_throughput( self, resource_group_name: str, account_name: str, - database_rid: str, - collection_rid: str, + database_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, - filter: str, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and - collection. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Metric]] = 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_collection_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Metric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 + @overload + async def begin_update_gremlin_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin database. - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ - return pipeline_response + @overload + async def begin_update_gremlin_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_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 Gremlin database. - return AsyncItemPaged(get_next, extract_data) + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def list_usages( + @distributed_trace_async + async def begin_update_gremlin_database_throughput( self, resource_group_name: str, account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: Optional[str] = None, + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> AsyncItemPaged["_models.Usage"]: - """Retrieves the usages (most recent storage data) for the given collection. + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) - - error_map: MutableMapping = { + 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_gremlin_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -25256,107 +25900,132 @@ def list_usages( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_collection_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_gremlin_resources_migrate_gremlin_database_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Usage], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + response = pipeline_response.http_response - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return AsyncItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def list_metric_definitions( - self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any - ) -> AsyncItemPaged["_models.MetricDefinition"]: - """Retrieves metric definitions for the given collection. + @distributed_trace_async + async def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :return: An iterator like instance of MetricDefinition - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MetricDefinition]] = kwargs.pop("cls", 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._migrate_gremlin_database_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25365,139 +26034,150 @@ def list_metric_definitions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_collection_list_metric_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_migrate_gremlin_database_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MetricDefinition], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class CollectionRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`collection_region` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list_metrics( - self, - resource_group_name: str, - account_name: str, - region: str, - database_rid: str, - collection_rid: str, - *, - filter: str, - **kwargs: Any - ) -> AsyncItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account, collection - and region. + @distributed_trace_async + async def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = kwargs.pop("cls", 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._migrate_gremlin_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace_async + async def get_gremlin_graph_throughput( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the Gremlin graph throughput 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25506,57 +26186,10471 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_collection_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_get_gremlin_graph_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_gremlin_graph_throughput_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_update_gremlin_graph_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_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 Gremlin 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_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 Gremlin 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_graph_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + update_throughput_parameters=update_throughput_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_migrate_gremlin_graph_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_gremlin_graph_to_autoscale( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_graph_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_migrate_gremlin_graph_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of AsyncLROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_graph_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace_async + async def get_gremlin_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.GremlinDatabaseGetResults: + """Gets the Gremlin databases 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :return: GremlinDatabaseGetResults. The GremlinDatabaseGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_get_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_gremlin_database_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: Union[ + _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_gremlin_database_parameters, (IOBase, bytes)): + _content = create_update_gremlin_database_parameters + else: + _content = json.dumps(create_update_gremlin_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_create_update_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters + :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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: _types.GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters + :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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: Union[ + _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinDatabaseGetResults] = 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_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GremlinDatabaseGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GremlinDatabaseGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_gremlin_database_initial( + self, resource_group_name: str, account_name: str, database_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_delete_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_gremlin_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin 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 instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_databases( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GremlinDatabaseGetResults"]: + """Lists the Gremlin databases under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 GremlinDatabaseGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinDatabaseGetResults]] = 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_gremlin_resources_list_gremlin_databases_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinDatabaseGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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_gremlin_graph( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> _models.GremlinGraphGetResults: + """Gets the Gremlin graph under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: GremlinGraphGetResults. The GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_get_gremlin_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_gremlin_graph_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: Union[ + _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_gremlin_graph_parameters, (IOBase, bytes)): + _content = create_update_gremlin_graph_parameters + else: + _content = json.dumps(create_update_gremlin_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_create_update_gremlin_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_gremlin_graph( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters + :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 GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_graph( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: _types.GremlinGraphCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters + :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 GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_graph( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_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 GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_gremlin_graph( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: Union[ + _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinGraphGetResults] = 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_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GremlinGraphGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GremlinGraphGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + 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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_delete_gremlin_graph_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_gremlin_graph( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_graph_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_graphs( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GremlinGraphGetResults"]: + """Lists the Gremlin graph under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 GremlinGraphGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinGraphGetResults]] = 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_gremlin_resources_list_gremlin_graphs_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinGraphGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(location, (IOBase, bytes)): + _content = location + else: + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_retrieve_continuous_backup_information_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + location: _models.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + location: _types.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: 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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of AsyncLROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + location=location, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupInformation, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.BackupInformation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.BackupInformation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_gremlin_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.GremlinRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Gremlin 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: GremlinRoleDefinitionResource. The GremlinRoleDefinitionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GremlinRoleDefinitionResource] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_get_gremlin_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: Union[ + _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_gremlin_role_definition_parameters, (IOBase, bytes)): + _content = create_update_gremlin_role_definition_parameters + else: + _content = json.dumps(create_update_gremlin_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_create_update_gremlin_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: _models.GremlinRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: _types.GremlinRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: Union[ + _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a GremlinRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource or + ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinRoleDefinitionResource] = 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_gremlin_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + create_update_gremlin_role_definition_parameters=create_update_gremlin_role_definition_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GremlinRoleDefinitionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GremlinRoleDefinitionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_gremlin_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_delete_gremlin_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_gremlin_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_role_definition_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_definition_id=role_definition_id, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GremlinRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Gremlin 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 GremlinRoleDefinitionResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinRoleDefinitionResource]] = 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_gremlin_resources_list_gremlin_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinRoleDefinitionResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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_gremlin_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.GremlinRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Gremlin 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: GremlinRoleAssignmentResource. The GremlinRoleAssignmentResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_get_gremlin_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: Union[ + _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_gremlin_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_gremlin_role_assignment_parameters + else: + _content = json.dumps(create_update_gremlin_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_create_update_gremlin_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: _models.GremlinRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :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 GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: _types.GremlinRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource + :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 GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_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 GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: Union[ + _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a GremlinRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinRoleAssignmentResource] = 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_gremlin_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_gremlin_role_assignment_parameters=create_update_gremlin_role_assignment_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GremlinRoleAssignmentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GremlinRoleAssignmentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_gremlin_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_delete_gremlin_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_gremlin_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_gremlin_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GremlinRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Gremlin 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 GremlinRoleAssignmentResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinRoleAssignmentResource]] = 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_gremlin_resources_list_gremlin_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinRoleAssignmentResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DataTransferJobsOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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. The DataTransferJobGetResults is compatible with + MutableMapping + :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: _types.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.types.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. The DataTransferJobGetResults is compatible with + MutableMapping + :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. The DataTransferJobGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: Union[_models.CreateJobRequest, _types.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 + ~azure.mgmt.cosmosdb.types.CreateJobRequest or IO[bytes] + :return: DataTransferJobGetResults. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _content = json.dumps(job_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_transfer_jobs_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 DataTransferJobGetResults + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DataTransferJobGetResults]] = 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_data_transfer_jobs_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DataTransferJobGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_pause_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_resume_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_complete_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class GarnetClustersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`garnet_clusters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.GarnetClusterResource: + """Get the properties of a Garnet cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :return: GarnetClusterResource. The GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GarnetClusterResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GarnetClusterResource] = kwargs.pop("cls", None) + + _request = build_garnet_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _create_update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResource, _types.GarnetClusterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_garnet_clusters_create_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResource + :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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.cosmosdb.types.GarnetClusterResource + :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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. 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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResource, _types.GarnetClusterResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Is either a GarnetClusterResource type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResource or + ~azure.mgmt.cosmosdb.types.GarnetClusterResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GarnetClusterResource] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GarnetClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GarnetClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResourcePatch, _types.GarnetClusterResourcePatch, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_garnet_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, + cluster_name: str, + body: _models.GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch + :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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Required. + :type body: ~azure.mgmt.cosmosdb.types.GarnetClusterResourcePatch + :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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. 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 GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResourcePatch, _types.GarnetClusterResourcePatch, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Is either a GarnetClusterResourcePatch type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch or + ~azure.mgmt.cosmosdb.types.GarnetClusterResourcePatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns GarnetClusterResource. The + GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GarnetClusterResource] = 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, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GarnetClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GarnetClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name"] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _delete_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_garnet_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name"] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a Garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cluster_name=cluster_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.GarnetClusterResource"]: + """List all Garnet clusters in this 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 GarnetClusterResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GarnetClusterResource]] = 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_garnet_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GarnetClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.GarnetClusterResource"]: + """List all Garnet clusters in this subscription. + + :return: An iterator like instance of GarnetClusterResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GarnetClusterResource]] = 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_garnet_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GarnetClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=docstring-missing-param,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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class NotebookWorkspacesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`notebook_workspaces` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> _models.NotebookWorkspace: + """Gets the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: NotebookWorkspace. The NotebookWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: Union[ + _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(notebook_create_update_parameters, (IOBase, bytes)): + _content = notebook_create_update_parameters + else: + _content = json.dumps(notebook_create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_notebook_workspaces_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters + :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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: _types.NotebookWorkspaceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters + :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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: Union[ + _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Is either a NotebookWorkspaceCreateUpdateParameters type or a IO[bytes] type. + Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = 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, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + notebook_create_update_parameters=notebook_create_update_parameters, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.NotebookWorkspace].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NotebookWorkspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the notebook workspace for a 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 + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NotebookWorkspace"]: + """Gets the notebook workspace resources of an existing Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 NotebookWorkspace + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NotebookWorkspace]] = 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_notebook_workspaces_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NotebookWorkspace], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def list_connection_info( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> _models.NotebookWorkspaceConnectionInfoResult: + """Retrieves the connection info for the notebook workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: NotebookWorkspaceConnectionInfoResult. The NotebookWorkspaceConnectionInfoResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_list_connection_info_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NotebookWorkspaceConnectionInfoResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _regenerate_auth_token_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_regenerate_auth_token_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_regenerate_auth_token( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Regenerates the auth token for the notebook workspace. + + :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 notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._regenerate_auth_token_initial( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _start_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts the notebook workspace. + + :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 notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class PrivateEndpointConnectionsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :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 private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection or + ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, account_name: str, private_endpoint_connection_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection with a given 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections on a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = 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_private_endpoint_connections_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link resources that need to be created for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + 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 + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = 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_private_link_resources_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class SoftDeletedDatabaseAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`soft_deleted_database_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def get( + self, resource_group_name: str, location: str, account_name: str, **kwargs: Any + ) -> _models.SoftDeletedDatabaseAccountGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB database account by location and + accountName. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: SoftDeletedDatabaseAccountGetResult. The SoftDeletedDatabaseAccountGetResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "location", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + async def list_by_location(self, location: str, **kwargs: Any) -> _models.SoftDeletedDatabaseAccountsListResult: + """Lists all the soft-deleted Azure Cosmos DB database accounts available under the subscription + and in a region. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param location: The name of the Azure region. Required. + :type location: str + :return: SoftDeletedDatabaseAccountsListResult. The SoftDeletedDatabaseAccountsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountsListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["subscription_id", "resource_group_name", "location", "api_version", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def list_by_resource_group_and_location( + self, resource_group_name: str, location: str, **kwargs: Any + ) -> _models.SoftDeletedDatabaseAccountsListResult: + """Lists all the soft-deleted Azure Cosmos DB database accounts available under the given resource + group and in a region. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: SoftDeletedDatabaseAccountsListResult. The SoftDeletedDatabaseAccountsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountsListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_list_by_resource_group_and_location_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes (purges) a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class SoftDeletedSqlDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`soft_deleted_sql_databases` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def get( + self, resource_group_name: str, location: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlDatabaseGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB SQL database. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :return: SoftDeletedSqlDatabaseGetResult. The SoftDeletedSqlDatabaseGetResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlDatabaseGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlDatabaseGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def list( + self, resource_group_name: str, location: str, account_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlDatabasesListResult: + """Lists all the soft-deleted Azure Cosmos DB SQL databases under a soft-deleted database account. + This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: SoftDeletedSqlDatabasesListResult. The SoftDeletedSqlDatabasesListResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabasesListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlDatabasesListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_list_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlDatabasesListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class SoftDeletedSqlContainersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`soft_deleted_sql_containers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> _models.SoftDeletedSqlContainerGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB SQL container. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/softDeletedSqlContainers/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :return: SoftDeletedSqlContainerGetResult. The SoftDeletedSqlContainerGetResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlContainerGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlContainerGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def list( + self, resource_group_name: str, location: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlContainersListResult: + """Lists all the soft-deleted Azure Cosmos DB SQL containers under a soft-deleted SQL database. + This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/softDeletedSqlContainers/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :return: SoftDeletedSqlContainersListResult. The SoftDeletedSqlContainersListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainersListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlContainersListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_list_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlContainersListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restores a soft-deleted Azure Cosmos DB SQL container to active state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class ChaosFaultOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The ChaosFaultResource is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + + _request = build_chaos_fault_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChaosFaultResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _enable_disable_initial( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(chaos_fault_request, (IOBase, bytes)): + _content = chaos_fault_request + else: + _content = json.dumps(chaos_fault_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_chaos_fault_enable_disable_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # 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 ChaosFaultResource. The ChaosFaultResource + is compatible with MutableMapping + :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: _types.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.types.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 ChaosFaultResource. The ChaosFaultResource + is compatible with MutableMapping + :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 ChaosFaultResource. The ChaosFaultResource + is compatible with MutableMapping + :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, _types.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 + ~azure.mgmt.cosmosdb.types.ChaosFaultResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ChaosFaultResource. The ChaosFaultResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ChaosFaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 ChaosFaultResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChaosFaultResource]] = 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_chaos_fault_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChaosFaultResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DatabaseOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`database` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, database_rid: str, *, filter: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and + 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_database_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Usage"]: + """Retrieves the usages (most recent data) for the given database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = 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_database_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_metric_definitions( + self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MetricDefinition"]: + """Retrieves metric definitions for the given 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :return: An iterator like instance of MetricDefinition + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricDefinition]] = 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_database_list_metric_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MetricDefinition], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CollectionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and + 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_collection_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Usage"]: + """Retrieves the usages (most recent storage data) for the given collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = 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_collection_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_metric_definitions( + self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any + ) -> AsyncItemPaged["_models.MetricDefinition"]: + """Retrieves metric definitions for the given 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :return: An iterator like instance of MetricDefinition + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricDefinition]] = 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_collection_list_metric_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MetricDefinition], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CollectionRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account, collection + and region. + + :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 region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_collection_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class DatabaseAccountRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`database_account_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, region: str, *, filter: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and region. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_database_account_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PercentileSourceTargetOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`percentile_source_target` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + source_region: str, + target_region: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given account, source and target + region. This url is only for PBS and Replication Latency data. + + :param resource_group_name: 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 source_region: Source region from which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type source_region: str + :param target_region: Target region to which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type target_region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_source_target_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + source_region=source_region, + target_region=target_region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PercentileMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PercentileTargetOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`percentile_target` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, target_region: str, *, filter: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given account target region. This + url is only for PBS and Replication Latency data. + + :param resource_group_name: 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 target_region: Target region to which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type target_region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_target_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + target_region=target_region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Metric], + List[_models.PercentileMetric], deserialized.get("value", []), ) if cls: @@ -25585,14 +36679,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class DatabaseAccountRegionOperations: +class PercentileOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`database_account_region` attribute. + :attr:`percentile` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -25604,9 +36698,144 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_metrics( - self, resource_group_name: str, account_name: str, region: str, *, filter: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and region. + self, resource_group_name: str, account_name: str, *, filter: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given database account. This url + is only for PBS and Replication Latency data. + + :param resource_group_name: 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 + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PercentileMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CollectionPartitionRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_partition_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given collection and region, split + by partition. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -25615,18 +36844,282 @@ def list_metrics( :type account_name: str :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_collection_partition_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CollectionPartitionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`collection_partition` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given collection, split by + partition. + + :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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str :keyword filter: An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. Required. :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_collection_partition_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.PartitionUsage"]: + """Retrieves the usages (most recent storage data) for the given collection, split by partition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of PartitionUsage + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PartitionUsage]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25639,10 +37132,11 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_database_account_region_list_metrics_request( + _request = build_collection_partition_list_usages_request( resource_group_name=resource_group_name, account_name=account_name, - region=region, + database_rid=database_rid, + collection_rid=collection_rid, subscription_id=self._config.subscription_id, filter=filter, api_version=self._config.api_version, @@ -25684,7 +37178,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.Metric], + List[_models.PartitionUsage], deserialized.get("value", []), ) if cls: @@ -25713,14 +37207,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class PercentileSourceTargetOperations: +class PartitionKeyRangeIdOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`percentile_source_target` attribute. + :attr:`partition_key_range_id` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -25735,38 +37229,38 @@ def list_metrics( self, resource_group_name: str, account_name: str, - source_region: str, - target_region: str, + database_rid: str, + collection_rid: str, + partition_key_range_id: str, *, filter: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given account, source and target - region. This url is only for PBS and Replication Latency data. + ) -> AsyncItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given partition key range id. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param source_region: Source region from which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type source_region: str - :param target_region: Target region to which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type target_region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get data. Required. + :type partition_key_range_id: str :keyword filter: An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. Required. :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PercentileMetric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25779,11 +37273,12 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_percentile_source_target_list_metrics_request( + _request = build_partition_key_range_id_list_metrics_request( resource_group_name=resource_group_name, account_name=account_name, - source_region=source_region, - target_region=target_region, + database_rid=database_rid, + collection_rid=collection_rid, + partition_key_range_id=partition_key_range_id, subscription_id=self._config.subscription_id, filter=filter, api_version=self._config.api_version, @@ -25825,7 +37320,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PercentileMetric], + List[_models.PartitionMetric], deserialized.get("value", []), ) if cls: @@ -25854,14 +37349,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class PercentileTargetOperations: +class PartitionKeyRangeIdRegionOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`percentile_target` attribute. + :attr:`partition_key_range_id_region` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -25873,31 +37368,45 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list_metrics( - self, resource_group_name: str, account_name: str, target_region: str, *, filter: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given account target region. This - url is only for PBS and Replication Latency data. + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + partition_key_range_id: str, + *, + filter: str, + **kwargs: Any + ) -> AsyncItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given partition key range id and + region. :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 target_region: Target region to which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type target_region: str + :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get data. Required. + :type partition_key_range_id: str :keyword filter: An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. Required. :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PercentileMetric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25910,10 +37419,13 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_percentile_target_list_metrics_request( + _request = build_partition_key_range_id_region_list_metrics_request( resource_group_name=resource_group_name, account_name=account_name, - target_region=target_region, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + partition_key_range_id=partition_key_range_id, subscription_id=self._config.subscription_id, filter=filter, api_version=self._config.api_version, @@ -25955,7 +37467,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PercentileMetric], + List[_models.PartitionMetric], deserialized.get("value", []), ) if cls: @@ -25984,14 +37496,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class PercentileOperations: +class LocationsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`percentile` attribute. + :attr:`locations` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -26001,30 +37513,85 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_metrics( - self, resource_group_name: str, account_name: str, *, filter: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given database account. This url - is only for PBS and Replication Latency data. + @distributed_trace_async + async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: + """Get the properties of an existing Cosmos DB location. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :type location: str + :return: LocationGetResult. The LocationGetResult is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult :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 = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PercentileMetric]] = kwargs.pop("cls", None) + cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) + + _request = build_locations_get_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LocationGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.LocationGetResult"]: + """List Cosmos DB locations and their properties. + + :return: An iterator like instance of LocationGetResult + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocationGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26037,11 +37604,8 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_percentile_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, + _request = build_locations_list_request( subscription_id=self._config.subscription_id, - filter=filter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26081,7 +37645,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PercentileMetric], + List[_models.LocationGetResult], deserialized.get("value", []), ) if cls: @@ -26100,7 +37664,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -26110,14 +37674,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class CollectionPartitionRegionOperations: +class CassandraClustersOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`collection_partition_region` attribute. + :attr:`cassandra_clusters` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -26127,45 +37691,325 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_metrics( + @distributed_trace_async + async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: + """Get the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: ClusterResource. The ClusterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_create_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + Required. + :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + 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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. Is + either a ClusterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or + ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( self, resource_group_name: str, - account_name: str, - region: str, - database_rid: str, - collection_rid: str, - *, - filter: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], **kwargs: Any - ) -> AsyncItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given collection and region, split - by partition. - - :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 region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) - + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26174,138 +38018,227 @@ def list_metrics( } 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 = kwargs.pop("params", {}) or {} - _request = build_collection_partition_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_cassandra_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class CollectionPartitionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`collection_partition` attribute. - """ + :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: Parameters to provide for specifying the managed Cassandra cluster. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. - @distributed_trace - def list_metrics( + :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: Parameters to provide for specifying the managed Cassandra cluster. Required. + :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( self, resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, + cluster_name: str, + body: IO[bytes], *, - filter: str, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given collection, split by - partition. + ) -> AsyncLROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. 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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. Is either a + ClusterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or + ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = 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, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26314,117 +38247,130 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_collection_partition_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a managed Cassandra cluster. + + :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 instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cluster_name=cluster_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_usages( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.PartitionUsage"]: - """Retrieves the usages (most recent storage data) for the given collection, split by partition. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ClusterResource"]: + """List all managed Cassandra clusters in this resource group. :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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of PartitionUsage - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage] + :return: An iterator like instance of ClusterResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionUsage]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ClusterResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26437,13 +38383,9 @@ def list_usages( def prepare_request(next_link=None): if not next_link: - _request = build_collection_partition_list_usages_request( + _request = build_cassandra_clusters_list_by_resource_group_request( resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, subscription_id=self._config.subscription_id, - filter=filter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26483,7 +38425,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PartitionUsage], + List[_models.ClusterResource], deserialized.get("value", []), ) if cls: @@ -26502,7 +38444,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -26511,61 +38453,18 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class PartitionKeyRangeIdOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`partition_key_range_id` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_metrics( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, - partition_key_range_id: str, - *, - filter: str, - **kwargs: Any - ) -> AsyncItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given partition key range id. + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ClusterResource"]: + """List all managed Cassandra clusters in this subscription. - :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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :param partition_key_range_id: Partition Key Range Id for which to get data. Required. - :type partition_key_range_id: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :return: An iterator like instance of ClusterResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ClusterResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26578,14 +38477,8 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_partition_key_range_id_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - partition_key_range_id=partition_key_range_id, + _request = build_cassandra_clusters_list_by_subscription_request( subscription_id=self._config.subscription_id, - filter=filter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26625,7 +38518,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PartitionMetric], + List[_models.ClusterResource], deserialized.get("value", []), ) if cls: @@ -26644,7 +38537,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -26653,65 +38546,537 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + async def _invoke_command_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandPostBody, _types.CommandPostBody, 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 = kwargs.pop("params", {}) or {} -class PartitionKeyRangeIdRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`partition_key_range_id_region` attribute. - """ + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_invoke_command_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: _models.CommandPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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.CommandPostBody + :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 CommandOutput. The CommandOutput is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: _types.CommandPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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.types.CommandPostBody + :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 CommandOutput. The CommandOutput is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 CommandOutput. The CommandOutput is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 CommandPostBody type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or + ~azure.mgmt.cosmosdb.types.CommandPostBody or IO[bytes] + :return: An instance of AsyncLROPoller that returns CommandOutput. The CommandOutput is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CommandOutput, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CommandOutput].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CommandOutput]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def _invoke_command_async_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_invoke_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 CommandPublicResource. The + CommandPublicResource is compatible with MutableMapping + :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: _types.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.types.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 CommandPublicResource. The + CommandPublicResource is compatible with MutableMapping + :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 CommandPublicResource. The + CommandPublicResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + async def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, _types.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 + ~azure.mgmt.cosmosdb.types.CommandAsyncPostBody or IO[bytes] + :return: An instance of AsyncLROPoller that returns CommandPublicResource. The + CommandPublicResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommandPublicResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_metrics( - self, - resource_group_name: str, - account_name: str, - region: str, - database_rid: str, - collection_rid: str, - partition_key_range_id: str, - *, - filter: str, - **kwargs: Any - ) -> AsyncItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given partition key range id and - region. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_command( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :param partition_key_range_id: Partition Key Range Id for which to get data. Required. - :type partition_key_range_id: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of CommandPublicResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CommandPublicResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26724,15 +39089,10 @@ def list_metrics( def prepare_request(next_link=None): if not next_link: - _request = build_partition_key_range_id_region_list_metrics_request( + _request = build_cassandra_clusters_list_command_request( resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - partition_key_range_id=partition_key_range_id, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, - filter=filter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -26772,7 +39132,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PartitionMetric], + List[_models.CommandPublicResource], deserialized.get("value", []), ) if cls: @@ -26791,7 +39151,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -26800,33 +39160,35 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class LocationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`locations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: - """Get the properties of an existing Cosmos DB location. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "command_id", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :return: LocationGetResult. The LocationGetResult is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult + :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. The CommandPublicResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CommandPublicResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26840,10 +39202,12 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) - _request = build_locations_get_request( - location=location, + _request = build_cassandra_clusters_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=self._config.api_version, headers=_headers, @@ -26878,7 +39242,7 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.LocationGetResult, response.json()) + deserialized = _deserialize(_models.CommandPublicResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -26886,17 +39250,31 @@ async def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.LocationGetResult"]: - """List Cosmos DB locations and their properties. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_backups( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.BackupResource"]: + """List the backups of this cluster that are available to restore. - :return: An iterator like instance of LocationGetResult - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult] + :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 BackupResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.LocationGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.BackupResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26909,7 +39287,9 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.LocationGetResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_locations_list_request( + _request = build_cassandra_clusters_list_backups_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26950,7 +39330,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.LocationGetResult], + List[_models.BackupResource], deserialized.get("value", []), ) if cls: @@ -26978,35 +39358,35 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class CassandraClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`cassandra_clusters` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: - """Get the properties of a managed Cassandra cluster. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "backup_id", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 - :return: ClusterResource. The ClusterResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource + :param backup_id: Id of a restorable backup of a Cassandra cluster. Required. + :type backup_id: str + :return: BackupResource. The BackupResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.BackupResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27020,11 +39400,12 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupResource] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_get_request( + _request = build_cassandra_clusters_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=self._config.api_version, headers=_headers, @@ -27059,19 +39440,15 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ClusterResource, response.json()) + deserialized = _deserialize(_models.BackupResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _create_update_initial( - self, - resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], - **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -27081,26 +39458,17 @@ async def _create_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_cassandra_clusters_create_update_request( + _request = build_cassandra_clusters_deallocate_request( resource_group_name=resource_group_name, cluster_name=cluster_name, subscription_id=self._config.subscription_id, - content_type=content_type, + x_ms_force_deallocate=x_ms_force_deallocate, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -27117,7 +39485,7 @@ async def _create_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27130,9 +39498,8 @@ async def _create_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -27141,178 +39508,361 @@ async def _create_update_initial( return deserialized # type: ignore - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - body: _models.ClusterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + @distributed_trace_async + async def begin_deallocate( + 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 + anything on an already deallocated cluster. Use Start to restart the cluster. :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: The properties specifying the desired state of the managed Cassandra cluster. - Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource - :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :keyword 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. + :paramtype x_ms_force_deallocate: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - body: _types.ClusterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + 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._deallocate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + x_ms_force_deallocate=x_ms_force_deallocate, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _start_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_start_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host + virtual machine of this cluster with reserved data disk. This won't do anything on an already + running cluster. Use Deallocate to deallocate the cluster. :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: The properties specifying the desired state of the managed Cassandra cluster. - Required. - :type body: ~azure.mgmt.cosmosdb.types.ClusterResource - :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + 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._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 status( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> _models.CassandraClusterPublicStatus: + """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param cluster_name: Managed Cassandra cluster name. Required. :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. - 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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: CassandraClusterPublicStatus. The CassandraClusterPublicStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_status_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CassandraClusterPublicStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CassandraDataCentersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`cassandra_data_centers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + async def get( + self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any + ) -> _models.DataCenterResource: + """Get the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param cluster_name: Managed Cassandra cluster name. Required. :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. Is - either a ClusterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or - ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :return: DataCenterResource. The DataCenterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClusterResource] = 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_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - body=body, - 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) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ClusterResource, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + _request = build_cassandra_data_centers_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ClusterResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ClusterResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + deserialized = _deserialize(_models.DataCenterResource, response.json()) - async def _update_initial( + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_update_initial( self, resource_group_name: str, cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -27336,9 +39886,10 @@ async def _update_initial( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_clusters_update_request( + _request = build_cassandra_data_centers_create_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, + data_center_name=data_center_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27359,7 +39910,7 @@ async def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 201]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27372,7 +39923,7 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: + if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -27384,125 +39935,142 @@ async def _update_initial( return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_update( self, resource_group_name: str, cluster_name: str, - body: _models.ClusterResource, + data_center_name: str, + body: _models.DataCenterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. :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: Parameters to provide for specifying the managed Cassandra cluster. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_update( self, resource_group_name: str, cluster_name: str, - body: _types.ClusterResource, + data_center_name: str, + body: _types.DataCenterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. :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: Parameters to provide for specifying the managed Cassandra cluster. Required. - :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def begin_create_update( self, resource_group_name: str, cluster_name: str, + data_center_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. :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: Parameters to provide for specifying the managed Cassandra cluster. Required. + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. 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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def begin_create_update( self, resource_group_name: str, cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. :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: Parameters to provide for specifying the managed Cassandra cluster. Is either a - ClusterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or - ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Is either a + DataCenterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or + ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.DataCenterResource] = 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( + raw_result = await self._create_update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, + data_center_name=data_center_name, body=body, content_type=content_type, cls=lambda x, y, z: x, @@ -27515,7 +40083,7 @@ async def begin_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ClusterResource, response.json()) + deserialized = _deserialize(_models.DataCenterResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27533,329 +40101,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ClusterResource].from_continuation_token( + return AsyncLROPoller[_models.DataCenterResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.ClusterResource]( + return AsyncLROPoller[_models.DataCenterResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_clusters_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - 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, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a managed Cassandra cluster. - - :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 instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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, - cluster_name=cluster_name, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ClusterResource"]: - """List all managed Cassandra clusters in this 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 ClusterResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ClusterResource]] = 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_cassandra_clusters_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ClusterResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.ClusterResource"]: - """List all managed Cassandra clusters in this subscription. - - :return: An iterator like instance of ClusterResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ClusterResource]] = 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_cassandra_clusters_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ClusterResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _invoke_command_initial( + async def _update_initial( self, resource_group_name: str, cluster_name: str, - body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -27879,9 +40140,10 @@ async def _invoke_command_initial( else: _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_clusters_invoke_command_request( + _request = build_cassandra_data_centers_update_request( resource_group_name=resource_group_name, cluster_name=cluster_name, + data_center_name=data_center_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27902,7 +40164,7 @@ async def _invoke_command_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202]: try: await response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -27915,8 +40177,9 @@ async def _invoke_command_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -27926,125 +40189,138 @@ async def _invoke_command_initial( return deserialized # type: ignore @overload - async def begin_invoke_command( + async def begin_update( self, resource_group_name: str, cluster_name: str, - body: _models.CommandPostBody, + data_center_name: str, + body: _models.DataCenterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.CommandPostBody + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource :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 CommandOutput. The CommandOutput is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_invoke_command( + async def begin_update( self, resource_group_name: str, cluster_name: str, - body: _types.CommandPostBody, + data_center_name: str, + body: _types.DataCenterResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.types.CommandPostBody + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource :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 CommandOutput. The CommandOutput is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_invoke_command( + async def begin_update( self, resource_group_name: str, cluster_name: str, + data_center_name: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. 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. + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. 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 CommandOutput. The CommandOutput is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_invoke_command( + async def begin_update( self, resource_group_name: str, cluster_name: str, - body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> AsyncLROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CommandPostBody type or a - IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or - ~azure.mgmt.cosmosdb.types.CommandPostBody or IO[bytes] - :return: An instance of AsyncLROPoller that returns CommandOutput. The CommandOutput is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Is either + a DataCenterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or + ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) + cls: ClsType[_models.DataCenterResource] = 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_initial( + raw_result = await self._update_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, + data_center_name=data_center_name, body=body, content_type=content_type, cls=lambda x, y, z: x, @@ -28056,14 +40332,10 @@ async def begin_invoke_command( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.CommandOutput, response.json()) + deserialized = _deserialize(_models.DataCenterResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -28079,18 +40351,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.CommandOutput].from_continuation_token( + return AsyncLROPoller[_models.DataCenterResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller[_models.CommandOutput]( + return AsyncLROPoller[_models.DataCenterResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _deallocate_initial( - self, resource_group_name: str, cluster_name: str, *, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -28105,11 +40377,11 @@ async def _deallocate_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_deallocate_request( + _request = build_cassandra_data_centers_delete_request( resource_group_name=resource_group_name, cluster_name=cluster_name, + data_center_name=data_center_name, subscription_id=self._config.subscription_id, - x_ms_force_deallocate=x_ms_force_deallocate, api_version=self._config.api_version, headers=_headers, params=_params, @@ -28127,7 +40399,7 @@ async def _deallocate_initial( response = pipeline_response.http_response - if response.status_code not in [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): @@ -28140,8 +40412,9 @@ async def _deallocate_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -28151,22 +40424,18 @@ async def _deallocate_initial( return deserialized # type: ignore @distributed_trace_async - async def begin_deallocate( - self, resource_group_name: str, cluster_name: str, *, x_ms_force_deallocate: Optional[str] = None, **kwargs: Any + async def begin_delete( + self, resource_group_name: str, cluster_name: str, data_center_name: str, **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 - anything on an already deallocated cluster. Use Start to restart the cluster. + """Delete a managed Cassandra data center. :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 - :keyword 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. - :paramtype x_ms_force_deallocate: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str :return: An instance of AsyncLROPoller that returns None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -28179,10 +40448,10 @@ async def begin_deallocate( 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._deallocate_initial( + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cluster_name=cluster_name, - x_ms_force_deallocate=x_ms_force_deallocate, + data_center_name=data_center_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -28216,7 +40485,143 @@ 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]: + @distributed_trace + def list( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.DataCenterResource"]: + """List all data centers in a particular managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of DataCenterResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DataCenterResource]] = 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_cassandra_data_centers_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DataCenterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RestorableDatabaseAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_database_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get_by_location( + self, location: str, instance_id: str, **kwargs: Any + ) -> _models.RestorableDatabaseAccountGetResult: + """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: RestorableDatabaseAccountGetResult. The RestorableDatabaseAccountGetResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28228,11 +40633,11 @@ async def _start_initial(self, resource_group_name: str, cluster_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_start_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, + _request = build_restorable_database_accounts_get_by_location_request( + location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28244,18 +40649,19 @@ async def _start_initial(self, resource_group_name: str, cluster_name: str, **kw _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( _models.CloudError, @@ -28263,92 +40669,133 @@ async def _start_initial(self, resource_group_name: str, cluster_name: str, **kw ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RestorableDatabaseAccountGetResult, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace_async - async def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host - virtual machine of this cluster with reserved data disk. This won't do anything on an already - running cluster. Use Deallocate to deallocate the cluster. + @distributed_trace + def list_by_location( + self, location: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableDatabaseAccountGetResult"]: + """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and + in a region. This call requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] + :type location: str + :return: An iterator like instance of RestorableDatabaseAccountGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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._start_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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 + cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + def prepare_request(next_link=None): + if not next_link: + + _request = build_restorable_database_accounts_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableDatabaseAccountGetResult], + deserialized.get("value", []), ) - 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, + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - @distributed_trace_async - async def status( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> _models.CassandraClusterPublicStatus: - """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :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: CassandraClusterPublicStatus. The CassandraClusterPublicStatus is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorableDatabaseAccountGetResult"]: + """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. + This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + + :return: An iterator like instance of RestorableDatabaseAccountGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28357,64 +40804,87 @@ async def status( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) + _request = build_restorable_database_accounts_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_cassandra_clusters_status_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableDatabaseAccountGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if response.status_code not in [200]: - if _stream: - 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 = _failsafe_deserialize( - _models.CloudError, - response, + 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 ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.CassandraClusterPublicStatus, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) -class CassandraDataCentersOperations: +class RestorableSqlDatabasesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`cassandra_data_centers` attribute. + :attr:`restorable_sql_databases` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -28424,89 +40894,30 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> _models.DataCenterResource: - """Get the properties of a managed Cassandra data center. + @distributed_trace + def list( + self, location: str, instance_id: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableSqlDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the + restorable account. This helps in scenario where database was accidentally deleted to get the + deletion time. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :return: DataCenterResource. The DataCenterResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: An iterator like instance of RestorableSqlDatabaseGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] :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 = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) - - _request = build_cassandra_data_centers_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.DataCenterResource, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore + cls: ClsType[List[_models.RestorableSqlDatabaseGetResult]] = kwargs.pop("cls", None) - async def _create_update_initial( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28515,497 +40926,274 @@ async def _create_update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + _request = build_restorable_sql_databases_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - content_type = content_type or "application/json" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_cassandra_data_centers_create_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlDatabaseGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - response = pipeline_response.http_response + async def get_next(next_link=None): + _request = prepare_request(next_link) - 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 = _failsafe_deserialize( - _models.CloudError, - response, + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response = pipeline_response.http_response - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return pipeline_response - return deserialized # type: ignore + return AsyncItemPaged(get_next, extract_data) - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _models.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource - :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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ +class RestorableSqlContainersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _types.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_sql_containers` attribute. + """ - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource - :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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @overload - async def begin_create_update( + @distributed_trace + def list( self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: IO[bytes], + location: str, + instance_id: str, *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. - - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. 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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + restorable_sql_database_rid: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + ) -> AsyncItemPaged["_models.RestorableSqlContainerGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a + specific database. This helps in scenario where container was accidentally deleted. This API + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Is either a - DataCenterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or - ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restorable_sql_database_rid: The resource ID of the SQL database. Default value is + None. + :paramtype restorable_sql_database_rid: str + :keyword start_time: Restorable Sql containers event feed start time. Default value is None. + :paramtype start_time: str + :keyword end_time: Restorable Sql containers event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableSqlContainerGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataCenterResource] = 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_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - body=body, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DataCenterResource, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DataCenterResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DataCenterResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, 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 {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_cassandra_data_centers_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + + cls: ClsType[List[_models.RestorableSqlContainerGetResult]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + error_map.update(kwargs.pop("error_map", {}) or {}) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + def prepare_request(next_link=None): + if not next_link: - response = pipeline_response.http_response + _request = build_restorable_sql_containers_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + restorable_sql_database_rid=restorable_sql_database_rid, + start_time=start_time, + end_time=end_time, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + return _request - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlContainerGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + async def get_next(next_link=None): + _request = prepare_request(next_link) - return deserialized # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _models.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource - :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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + return pipeline_response - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _types.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. + return AsyncItemPaged(get_next, extract_data) - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource - :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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. +class RestorableSqlResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. 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 DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_sql_resources` attribute. + """ - @distributed_trace_async - async def begin_update( + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + location: str, + instance_id: str, + *, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. + ) -> AsyncItemPaged["_models.RestorableSqlResourcesGetResult"]: + """Return a list of database and container combo that exist on the account at the given timestamp + and location. This helps in scenarios to validate what resources exist at given timestamp and + location. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Is either - a DataCenterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or - ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns DataCenterResource. The DataCenterResource - is compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableSqlResourcesGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataCenterResource] = 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, - cluster_name=cluster_name, - data_center_name=data_center_name, - body=body, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DataCenterResource, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DataCenterResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DataCenterResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) + cls: ClsType[List[_models.RestorableSqlResourcesGetResult]] = kwargs.pop("cls", None) - async def _delete_initial( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -29014,138 +41202,123 @@ async def _delete_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_cassandra_data_centers_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_restorable_sql_resources_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + return _request - 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 = _failsafe_deserialize( - _models.CloudError, - response, + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlResourcesGetResult], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + async def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a managed Cassandra data center. + return pipeline_response - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :return: An instance of AsyncLROPoller that returns None - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return AsyncItemPaged(get_next, extract_data) - 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, - cluster_name=cluster_name, - data_center_name=data_center_name, - 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 +class RestorableMongodbDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_databases` attribute. + """ - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.DataCenterResource"]: - """List all data centers in a particular managed Cassandra cluster. + self, location: str, instance_id: str, **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableMongodbDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under + the restorable account. This helps in scenario where database was accidentally deleted to get + the deletion time. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :return: An iterator like instance of DataCenterResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource] + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: An iterator like instance of RestorableMongodbDatabaseGetResult + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataCenterResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableMongodbDatabaseGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29158,9 +41331,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_data_centers_list_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, + _request = build_restorable_mongodb_databases_list_request( + location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29201,7 +41374,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.DataCenterResource], + List[_models.RestorableMongodbDatabaseGetResult], deserialized.get("value", []), ) if cls: @@ -29230,14 +41403,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableDatabaseAccountsOperations: +class RestorableMongodbCollectionsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_database_accounts` attribute. + :attr:`restorable_mongodb_collections` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29247,100 +41420,43 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace_async - async def get_by_location( - self, location: str, instance_id: str, **kwargs: Any - ) -> _models.RestorableDatabaseAccountGetResult: - """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + @distributed_trace + def list( + self, + location: str, + instance_id: str, + *, + restorable_mongodb_database_rid: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableMongodbCollectionGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under + a specific database. This helps in scenario where container was accidentally deleted. This + API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: RestorableDatabaseAccountGetResult. The RestorableDatabaseAccountGetResult is - compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) - - _request = build_restorable_database_accounts_get_by_location_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RestorableDatabaseAccountGetResult, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_location( - self, location: str, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableDatabaseAccountGetResult"]: - """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and - in a region. This call requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - Required. - :type location: str - :return: An iterator like instance of RestorableDatabaseAccountGetResult + :keyword restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default + value is None. + :paramtype restorable_mongodb_database_rid: str + :keyword start_time: Restorable MongoDB collections event feed start time. Default value is + None. + :paramtype start_time: str + :keyword end_time: Restorable MongoDB collections event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableMongodbCollectionGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableMongodbCollectionGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29353,9 +41469,13 @@ def list_by_location( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_database_accounts_list_by_location_request( + _request = build_restorable_mongodb_collections_list_request( location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, + restorable_mongodb_database_rid=restorable_mongodb_database_rid, + start_time=start_time, + end_time=end_time, api_version=self._config.api_version, headers=_headers, params=_params, @@ -29395,7 +41515,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableDatabaseAccountGetResult], + List[_models.RestorableMongodbCollectionGetResult], deserialized.get("value", []), ) if cls: @@ -29423,20 +41543,59 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + +class RestorableMongodbResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorableDatabaseAccountGetResult"]: - """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. - This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + def list( + self, + location: str, + instance_id: str, + *, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableMongodbResourcesGetResult"]: + """Return a list of database and collection combo that exist on the account at the given timestamp + and location. This helps in scenarios to validate what resources exist at given timestamp and + location. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :return: An iterator like instance of RestorableDatabaseAccountGetResult + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableMongodbResourcesGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableMongodbResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29449,8 +41608,12 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RestorableDatabaseAccou def prepare_request(next_link=None): if not next_link: - _request = build_restorable_database_accounts_list_request( + _request = build_restorable_mongodb_resources_list_request( + location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -29490,7 +41653,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableDatabaseAccountGetResult], + List[_models.RestorableMongodbResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -29519,14 +41682,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableSqlDatabasesOperations: +class RestorableGremlinDatabasesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_sql_databases` attribute. + :attr:`restorable_gremlin_databases` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29539,10 +41702,10 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( self, location: str, instance_id: str, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableSqlDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the - restorable account. This helps in scenario where database was accidentally deleted to get the - deletion time. This API requires + ) -> AsyncItemPaged["_models.RestorableGremlinDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under + the restorable account. This helps in scenario where database was accidentally deleted to get + the deletion time. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -29550,15 +41713,15 @@ def list( :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: An iterator like instance of RestorableSqlDatabaseGetResult + :return: An iterator like instance of RestorableGremlinDatabaseGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlDatabaseGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinDatabaseGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29571,7 +41734,7 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_databases_list_request( + _request = build_restorable_gremlin_databases_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, @@ -29614,7 +41777,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlDatabaseGetResult], + List[_models.RestorableGremlinDatabaseGetResult], deserialized.get("value", []), ) if cls: @@ -29643,14 +41806,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableSqlContainersOperations: +class RestorableGremlinGraphsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_sql_containers` attribute. + :attr:`restorable_gremlin_graphs` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29666,13 +41829,13 @@ def list( location: str, instance_id: str, *, - restorable_sql_database_rid: Optional[str] = None, + restorable_gremlin_database_rid: Optional[str] = None, start_time: Optional[str] = None, end_time: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableSqlContainerGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a - specific database. This helps in scenario where container was accidentally deleted. This API + ) -> AsyncItemPaged["_models.RestorableGremlinGraphGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a + specific database. This helps in scenario where container was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -29680,22 +41843,22 @@ def list( :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :keyword restorable_sql_database_rid: The resource ID of the SQL database. Default value is - None. - :paramtype restorable_sql_database_rid: str - :keyword start_time: Restorable Sql containers event feed start time. Default value is None. + :keyword restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default + value is None. + :paramtype restorable_gremlin_database_rid: str + :keyword start_time: Restorable Gremlin graphs event feed start time. Default value is None. :paramtype start_time: str - :keyword end_time: Restorable Sql containers event feed end time. Default value is None. + :keyword end_time: Restorable Gremlin graphs event feed end time. Default value is None. :paramtype end_time: str - :return: An iterator like instance of RestorableSqlContainerGetResult + :return: An iterator like instance of RestorableGremlinGraphGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlContainerGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinGraphGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29708,11 +41871,11 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_containers_list_request( + _request = build_restorable_gremlin_graphs_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, - restorable_sql_database_rid=restorable_sql_database_rid, + restorable_gremlin_database_rid=restorable_gremlin_database_rid, start_time=start_time, end_time=end_time, api_version=self._config.api_version, @@ -29754,7 +41917,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlContainerGetResult], + List[_models.RestorableGremlinGraphGetResult], deserialized.get("value", []), ) if cls: @@ -29783,14 +41946,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableSqlResourcesOperations: +class RestorableGremlinResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_sql_resources` attribute. + :attr:`restorable_gremlin_resources` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29809,10 +41972,10 @@ def list( restore_location: Optional[str] = None, restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableSqlResourcesGetResult"]: - """Return a list of database and container combo that exist on the account at the given timestamp - and location. This helps in scenarios to validate what resources exist at given timestamp and - location. This API requires + ) -> AsyncItemPaged["_models.RestorableGremlinResourcesGetResult"]: + """Return a list of gremlin database and graphs combo that exist on the account at the given + timestamp and location. This helps in scenarios to validate what resources exist at given + timestamp and location. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -29826,15 +41989,15 @@ def list( :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default value is None. :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableSqlResourcesGetResult + :return: An iterator like instance of RestorableGremlinResourcesGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29847,7 +42010,7 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_resources_list_request( + _request = build_restorable_gremlin_resources_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, @@ -29892,7 +42055,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlResourcesGetResult], + List[_models.RestorableGremlinResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -29921,14 +42084,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableMongodbDatabasesOperations: +class RestorableTablesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_databases` attribute. + :attr:`restorable_tables` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -29940,11 +42103,16 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( - self, location: str, instance_id: str, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableMongodbDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires + self, + location: str, + instance_id: str, + *, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.RestorableTableGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in + scenario where table was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -29952,15 +42120,19 @@ def list( :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: An iterator like instance of RestorableMongodbDatabaseGetResult + :keyword start_time: Restorable Tables event feed start time. Default value is None. + :paramtype start_time: str + :keyword end_time: Restorable Tables event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableTableGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbDatabaseGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableTableGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29973,10 +42145,12 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_mongodb_databases_list_request( + _request = build_restorable_tables_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, + start_time=start_time, + end_time=end_time, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30016,7 +42190,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableMongodbDatabaseGetResult], + List[_models.RestorableTableGetResult], deserialized.get("value", []), ) if cls: @@ -30045,14 +42219,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableMongodbCollectionsOperations: +class RestorableTableResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_collections` attribute. + :attr:`restorable_table_resources` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30068,37 +42242,34 @@ def list( location: str, instance_id: str, *, - restorable_mongodb_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableMongodbCollectionGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under - a specific database. This helps in scenario where container was accidentally deleted. This - API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> AsyncItemPaged["_models.RestorableTableResourcesGetResult"]: + """Return a list of tables that exist on the account at the given timestamp and location. This + helps in scenarios to validate what resources exist at given timestamp and location. This API + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :keyword restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default + :keyword restore_location: The location where the restorable resources are located. Default value is None. - :paramtype restorable_mongodb_database_rid: str - :keyword start_time: Restorable MongoDB collections event feed start time. Default value is - None. - :paramtype start_time: str - :keyword end_time: Restorable MongoDB collections event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableMongodbCollectionGetResult + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableTableResourcesGetResult :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbCollectionGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableTableResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30111,13 +42282,12 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_mongodb_collections_list_request( + _request = build_restorable_table_resources_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, - restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30157,7 +42327,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableMongodbCollectionGetResult], + List[_models.RestorableTableResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -30186,14 +42356,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableMongodbResourcesOperations: +class ServiceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_resources` attribute. + :attr:`service` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30203,41 +42373,483 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + ) -> _models.ServiceResource: + """Gets the status of service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + _request = build_service_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( self, - location: str, - instance_id: str, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: Union[ + _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_parameters, (IOBase, bytes)): + _content = create_update_parameters + else: + _content = json.dumps(create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_service_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableMongodbResourcesGetResult"]: - """Return a list of database and collection combo that exist on the account at the given timestamp - and location. This helps in scenarios to validate what resources exist at given timestamp and - location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> AsyncLROPoller[_models.ServiceResource]: + """Creates a service. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableMongodbResourcesGetResult - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesGetResult] + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: _types.ServiceResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: Union[ + _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Is either a + ServiceResourceCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters or IO[bytes] + :return: An instance of AsyncLROPoller that returns ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + account_name=account_name, + service_name=service_name, + create_update_parameters=create_update_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ServiceResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, account_name: str, service_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_service_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + 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.iter_bytes() if _decompress else response.iter_raw() + + 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, account_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes service with the given serviceName. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + account_name=account_name, + service_name=service_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ServiceResource"]: + """Gets the status of service. + + :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 ServiceResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ServiceResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ServiceResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30250,12 +42862,10 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_mongodb_resources_list_request( - location=location, - instance_id=instance_id, + _request = build_service_list_request( + resource_group_name=resource_group_name, + account_name=account_name, subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30295,7 +42905,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableMongodbResourcesGetResult], + List[_models.ServiceResource], deserialized.get("value", []), ) if cls: @@ -30324,14 +42934,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class RestorableGremlinDatabasesOperations: +class ThroughputPoolOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_databases` attribute. + :attr:`throughput_pool` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30341,30 +42951,85 @@ def __init__(self, *args, **kwargs) -> None: self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, location: str, instance_id: str, **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableGremlinDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + @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 location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :return: An iterator like instance of RestorableGremlinDatabaseGetResult - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult] + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: ThroughputPoolResource. The ThroughputPoolResource is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableGremlinDatabaseGetResult]] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) + + _request = build_throughput_pool_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) + 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, _types.ThroughputPoolResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30373,135 +43038,239 @@ def list( } 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 = kwargs.pop("params", {}) or {} - _request = build_restorable_gremlin_databases_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_throughput_pool_create_or_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinDatabaseGetResult], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class RestorableGremlinGraphsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @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. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_graphs` attribute. - """ + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: _types.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. - @distributed_trace - def list( + :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.types.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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( self, - location: str, - instance_id: str, + resource_group_name: str, + throughput_pool_name: str, + body: IO[bytes], *, - restorable_gremlin_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableGremlinGraphGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a - specific database. This helps in scenario where container was accidentally deleted. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default - value is None. - :paramtype restorable_gremlin_database_rid: str - :keyword start_time: Restorable Gremlin graphs event feed start time. Default value is None. - :paramtype start_time: str - :keyword end_time: Restorable Gremlin graphs event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableGremlinGraphGetResult - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult] + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, _types.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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableGremlinGraphGetResult]] = kwargs.pop("cls", None) + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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, _types.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -30510,137 +43279,237 @@ def list( } 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 = kwargs.pop("params", {}) or {} - _request = build_restorable_gremlin_graphs_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _content = None - return _request + _request = build_throughput_pool_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinGraphGetResult], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class RestorableGremlinResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @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. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_resources` attribute. - """ + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[_types.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.types.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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - @distributed_trace - def list( + @overload + async def begin_update( self, - location: str, - instance_id: str, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[IO[bytes]] = None, *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableGremlinResourcesGetResult"]: - """Return a list of gremlin database and graphs combo that exist on the account at the given - timestamp and location. This helps in scenarios to validate what resources exist at given - timestamp and location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> AsyncLROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableGremlinResourcesGetResult - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult] + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, _types.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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolUpdate or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableGremlinResourcesGetResult]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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, @@ -30649,91 +43518,126 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_restorable_gremlin_resources_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_throughput_pool_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - async def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinResourcesGetResult], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - async def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return AsyncItemPaged(get_next, extract_data) + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 -class RestorableTablesOperations: +class ThroughputPoolsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_tables` attribute. + :attr:`throughput_pools` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -30744,37 +43648,23 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - location: str, - instance_id: str, - *, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableTableGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in - scenario where table was accidentally deleted. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ThroughputPoolResource"]: + """List all the ThroughputPools in a given resource group. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword start_time: Restorable Tables event feed start time. Default value is None. - :paramtype start_time: str - :keyword end_time: Restorable Tables event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableTableGetResult + :type resource_group_name: str + :return: An iterator like instance of ThroughputPoolResource :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableTableGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ThroughputPoolResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30787,12 +43677,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_tables_list_request( - location=location, - instance_id=instance_id, + _request = build_throughput_pools_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - start_time=start_time, - end_time=end_time, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30832,7 +43719,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableTableGetResult], + List[_models.ThroughputPoolResource], deserialized.get("value", []), ) if cls: @@ -30851,7 +43738,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -30860,58 +43747,19 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - -class RestorableTableResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`restorable_table_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list( - self, - location: str, - instance_id: str, - *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.RestorableTableResourcesGetResult"]: - """Return a list of tables that exist on the account at the given timestamp and location. This - helps in scenarios to validate what resources exist at given timestamp and location. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ThroughputPoolResource"]: + """Lists all the Azure Cosmos DB Throughput Pools available under the subscription. - :param location: Cosmos DB region, with spaces between words and each word capitalized. - Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableTableResourcesGetResult + :return: An iterator like instance of ThroughputPoolResource :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableTableResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ThroughputPoolResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30924,12 +43772,8 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_table_resources_list_request( - location=location, - instance_id=instance_id, + _request = build_throughput_pools_list_request( subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -30969,7 +43813,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableTableResourcesGetResult], + List[_models.ThroughputPoolResource], deserialized.get("value", []), ) if cls: @@ -30988,7 +43832,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -30998,14 +43842,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class ServiceOperations: +class ThroughputPoolAccountOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s - :attr:`service` attribute. + :attr:`throughput_pool_account` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -31017,19 +43861,21 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async async def get( - self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any - ) -> _models.ServiceResource: - """Gets the status of service. + 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :return: ServiceResource. The ServiceResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource + :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. The ThroughputPoolAccountResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -31043,12 +43889,12 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) - _request = build_service_get_request( + _request = build_throughput_pool_account_get_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31075,7 +43921,7 @@ async def get( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -31083,7 +43929,7 @@ async def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ServiceResource, response.json()) + deserialized = _deserialize(_models.ThroughputPoolAccountResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -31093,11 +43939,9 @@ async def get( async def _create_initial( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: Union[ - _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] - ], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, _types.ThroughputPoolAccountResource, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { @@ -31116,15 +43960,15 @@ async def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_parameters, (IOBase, bytes)): - _content = create_update_parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_service_create_request( + _request = build_throughput_pool_account_create_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -31145,21 +43989,23 @@ async def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -31173,31 +44019,33 @@ async def _create_initial( async def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: _models.ServiceResourceCreateUpdateParameters, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _models.ThroughputPoolAccountResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of AsyncLROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -31205,31 +44053,33 @@ async def begin_create( async def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: _types.ServiceResourceCreateUpdateParameters, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _types.ThroughputPoolAccountResource, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters + :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.types.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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of AsyncLROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -31237,30 +44087,33 @@ async def begin_create( async def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: IO[bytes], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: IO[bytes] + :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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of AsyncLROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -31268,46 +44121,46 @@ async def begin_create( async def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: Union[ - _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] - ], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, _types.ThroughputPoolAccountResource, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Is either a - ServiceResourceCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolAccountResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", 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, - account_name=account_name, - service_name=service_name, - create_update_parameters=create_update_parameters, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31319,7 +44172,7 @@ async def begin_create( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ServiceResource, response.json()) + deserialized = _deserialize(_models.ThroughputPoolAccountResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31337,18 +44190,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller[_models.ServiceResource].from_continuation_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.ServiceResource]( + 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, account_name: str, service_name: str, **kwargs: Any + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31363,10 +44216,10 @@ async def _delete_initial( cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - _request = build_service_delete_request( + _request = build_throughput_pool_account_delete_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31385,14 +44238,14 @@ async def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -31413,17 +44266,18 @@ async def _delete_initial( @distributed_trace_async async def begin_delete( - self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes service with the given serviceName. + """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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_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 None :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -31438,8 +44292,8 @@ async def begin_delete( if cont_token is None: raw_result = await self._delete_initial( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -31473,25 +44327,44 @@ 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 + +class ThroughputPoolAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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 - ) -> AsyncItemPaged["_models.ServiceResource"]: - """Gets the status of service. + self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> AsyncItemPaged["_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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :return: An iterator like instance of ServiceResource - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ServiceResource] + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: An iterator like instance of ThroughputPoolAccountResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ServiceResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ThroughputPoolAccountResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31504,9 +44377,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_service_list_request( + _request = build_throughput_pool_accounts_list_request( resource_group_name=resource_group_name, - account_name=account_name, + throughput_pool_name=throughput_pool_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31547,7 +44420,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ServiceResource], + List[_models.ThroughputPoolAccountResource], deserialized.get("value", []), ) if cls: @@ -31566,7 +44439,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -31576,7 +44449,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class MongoMIResourcesOperations: +class MongoMIResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -32742,7 +45615,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class FleetOperations: +class FleetOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -33483,7 +46356,514 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class FleetspaceOperations: +class FleetAnalyticsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.aio.CosmosDBManagementClient`'s + :attr:`fleet_analytics` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, fleet_name: str, fleet_analytics_name: str, **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Retrieves the properties of an existing Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FleetAnalyticsResource] = kwargs.pop("cls", None) + + _request = build_fleet_analytics_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FleetAnalyticsResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: _models.FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Required. + :type body: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: _types.FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Required. + :type body: ~azure.mgmt.cosmosdb.types.FleetAnalyticsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. 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: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: Union[_models.FleetAnalyticsResource, _types.FleetAnalyticsResource, IO[bytes]], + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Is either a + FleetAnalyticsResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource or + ~azure.mgmt.cosmosdb.types.FleetAnalyticsResource or IO[bytes] + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetAnalyticsResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fleet_analytics_create_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FleetAnalyticsResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, fleet_name: str, fleet_analytics_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fleet_analytics_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, fleet_name: str, fleet_analytics_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an existing Azure Cosmos DB FleetAnalytics. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.FleetAnalyticsResource"]: + """Lists all the FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :return: An iterator like instance of FleetAnalyticsResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cosmosdb.models.FleetAnalyticsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FleetAnalyticsResource]] = 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_fleet_analytics_list_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FleetAnalyticsResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FleetspaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -34315,7 +47695,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) -class FleetspaceAccountOperations: +class FleetspaceAccountOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level 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 495080bcd3f3..b74361062efd 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -16,6 +17,9 @@ from ._models import ( # type: ignore ARMProxyResource, ARMResourceProperties, + AccessRule, + AccessRuleProperties, + AccessRulePropertiesSubscriptionsItem, AccountKeyMetadata, AnalyticalStorageConfiguration, ApiProperties, @@ -23,12 +27,22 @@ AutoUpgradePolicyResource, AutoscaleSettings, AutoscaleSettingsResource, + AzureBlobContainer, + AzureBlobDataTransferDataSourceSink, + AzureBlobSourceSinkDetails, BackupInformation, BackupPolicy, BackupPolicyMigrationState, + BackupResource, BackupSchedule, + BaseCopyJobProperties, + BaseCopyJobTask, + BaseCosmosDataTransferDataSourceSink, + BlobToCassandraRUCopyJobProperties, + BlobToCassandraRUCopyJobTask, Capability, Capacity, + CapacityModeChangeTransitionState, CassandraClusterDataCenterNodeItem, CassandraClusterPublicStatus, CassandraClusterPublicStatusDataCentersItem, @@ -41,6 +55,10 @@ CassandraKeyspaceGetResults, CassandraKeyspaceResource, CassandraPartitionKey, + CassandraRUToBlobCopyJobProperties, + CassandraRUToBlobCopyJobTask, + CassandraRUToCassandraRUCopyJobProperties, + CassandraRUToCassandraRUCopyJobTask, CassandraRoleAssignmentResource, CassandraRoleAssignmentResourceProperties, CassandraRoleDefinitionResource, @@ -53,7 +71,16 @@ CassandraTableGetPropertiesResource, CassandraTableGetResults, CassandraTableResource, + CassandraViewCreateUpdateParameters, + CassandraViewCreateUpdateProperties, + CassandraViewGetProperties, + CassandraViewGetPropertiesOptions, + CassandraViewGetPropertiesResource, + CassandraViewGetResults, + CassandraViewResource, Certificate, + ChaosFaultProperties, + ChaosFaultResource, ClientEncryptionIncludedPath, ClientEncryptionKeyCreateUpdateParameters, ClientEncryptionKeyCreateUpdateProperties, @@ -67,8 +94,10 @@ ClusterResource, ClusterResourceProperties, Column, + CommandAsyncPostBody, CommandOutput, CommandPostBody, + CommandPublicResource, CompositePath, ComputedProperty, ConflictResolutionPolicy, @@ -79,10 +108,28 @@ ContinuousBackupRestoreLocation, ContinuousModeBackupPolicy, ContinuousModeProperties, + CopyJobGetResults, + CopyJobProperties, CorsPolicy, + CosmosCassandraDataTransferDataSourceSink, + CosmosDBCassandraTable, + CosmosDBMongoCollection, + CosmosDBMongoVCoreCollection, + CosmosDBNoSqlContainer, + CosmosDBSourceSinkDetails, + CosmosMongoDataTransferDataSourceSink, + CosmosMongoVCoreDataTransferDataSourceSink, + CosmosSqlDataTransferDataSourceSink, + CreateJobRequest, CreateUpdateOptions, DataCenterResource, DataCenterResourceProperties, + DataMaskingPolicy, + DataMaskingPolicyExcludedPathsItem, + DataMaskingPolicyIncludedPathsItem, + DataTransferDataSourceSink, + DataTransferJobGetResults, + DataTransferJobProperties, DataTransferRegionalServiceResource, DataTransferServiceResourceCreateUpdateProperties, DataTransferServiceResourceProperties, @@ -99,6 +146,7 @@ DatabaseAccountUpdateParameters, DatabaseAccountUpdateProperties, DatabaseRestoreResource, + DiagnosticLogSettings, ErrorAdditionalInfo, ErrorDetail, ErrorResponse, @@ -106,6 +154,8 @@ ExcludedPath, FailoverPolicies, FailoverPolicy, + FleetAnalyticsProperties, + FleetAnalyticsResource, FleetResource, FleetResourceProperties, FleetResourceUpdate, @@ -119,9 +169,21 @@ FullTextIndexPath, FullTextPath, FullTextPolicy, + GarnetClusterResource, + GarnetClusterResourcePatch, + GarnetClusterResourcePatchProperties, + GarnetClusterResourceProperties, + GarnetClusterResourcePropertiesEndPointsItem, GraphAPIComputeRegionalServiceResource, GraphAPIComputeServiceResourceCreateUpdateProperties, GraphAPIComputeServiceResourceProperties, + GraphResource, + GraphResourceCreateUpdateParameters, + GraphResourceCreateUpdateProperties, + GraphResourceGetProperties, + GraphResourceGetPropertiesOptions, + GraphResourceGetPropertiesResource, + GraphResourceGetResults, GremlinDatabaseCreateUpdateParameters, GremlinDatabaseCreateUpdateProperties, GremlinDatabaseGetProperties, @@ -153,9 +215,13 @@ ManagedCassandraReaperStatus, ManagedServiceIdentity, ManagedServiceIdentityUserAssignedIdentity, + MaterializedViewDefinition, + MaterializedViewDetails, MaterializedViewsBuilderRegionalServiceResource, MaterializedViewsBuilderServiceResourceCreateUpdateProperties, MaterializedViewsBuilderServiceResourceProperties, + MaterializedViewsProperties, + MergeParameters, Metric, MetricAvailability, MetricDefinition, @@ -182,12 +248,23 @@ MongoMIRoleAssignmentResourceProperties, MongoMIRoleDefinitionResource, MongoMIRoleDefinitionResourceProperties, + MongoRUToMongoRUCopyJobProperties, + MongoRUToMongoRUCopyJobTask, + MongoRUToMongoVCoreCopyJobProperties, + MongoRUToMongoVCoreCopyJobTask, MongoRoleDefinitionCreateUpdateParameters, MongoRoleDefinitionGetResults, MongoRoleDefinitionResource, MongoUserDefinitionCreateUpdateParameters, MongoUserDefinitionGetResults, MongoUserDefinitionResource, + MongoVCoreSourceSinkDetails, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationProperties, + NetworkSecurityProfile, + NoSqlRUToNoSqlRUCopyJobProperties, + NoSqlRUToNoSqlRUCopyJobTask, NotebookWorkspace, NotebookWorkspaceConnectionInfoResult, NotebookWorkspaceCreateUpdateParameters, @@ -202,6 +279,14 @@ PeriodicModeBackupPolicy, PeriodicModeProperties, Permission, + PhysicalPartitionId, + PhysicalPartitionStorageInfo, + PhysicalPartitionStorageInfoCollection, + PhysicalPartitionThroughputInfoProperties, + PhysicalPartitionThroughputInfoResource, + PhysicalPartitionThroughputInfoResult, + PhysicalPartitionThroughputInfoResultProperties, + PhysicalPartitionThroughputInfoResultPropertiesResource, PrivateEndpointConnection, PrivateEndpointConnectionProperties, PrivateEndpointProperty, @@ -210,10 +295,16 @@ PrivateLinkServiceConnectionStateProperty, Privilege, PrivilegeResource, + ProvisioningIssue, + ProvisioningIssueProperties, ProxyResource, + RedistributeThroughputParameters, + RedistributeThroughputProperties, + RedistributeThroughputPropertiesResource, RegionForOnlineOffline, RegionalServiceResource, Resource, + ResourceAssociation, ResourceRestoreParameters, RestorableDatabaseAccountGetResult, RestorableDatabaseAccountProperties, @@ -247,12 +338,29 @@ RestorableTableResourcesGetResult, RestoreParameters, RestoreParametersBase, + RetrieveThroughputParameters, + RetrieveThroughputProperties, + RetrieveThroughputPropertiesResource, Role, SeedNode, ServiceResource, ServiceResourceCreateUpdateParameters, ServiceResourceCreateUpdateProperties, ServiceResourceProperties, + SoftDeleteConfiguration, + SoftDeletedDatabaseAccountGetResult, + SoftDeletedDatabaseAccountProperties, + SoftDeletedDatabaseAccountResource, + SoftDeletedDatabaseAccountsListResult, + SoftDeletedSqlContainerGetResult, + SoftDeletedSqlContainerProperties, + SoftDeletedSqlContainerResource, + SoftDeletedSqlContainersListResult, + SoftDeletedSqlDatabaseGetResult, + SoftDeletedSqlDatabaseProperties, + SoftDeletedSqlDatabaseResource, + SoftDeletedSqlDatabasesListResult, + SoftDeletionMetadata, SpatialSpec, SqlContainerCreateUpdateParameters, SqlContainerCreateUpdateProperties, @@ -307,7 +415,13 @@ TableRoleAssignmentResourceProperties, TableRoleDefinitionResource, TableRoleDefinitionResourceProperties, + ThroughputBucketResource, ThroughputPolicyResource, + ThroughputPoolAccountProperties, + ThroughputPoolAccountResource, + ThroughputPoolProperties, + ThroughputPoolResource, + ThroughputPoolUpdate, ThroughputSettingsGetProperties, ThroughputSettingsGetPropertiesResource, ThroughputSettingsGetResults, @@ -325,6 +439,8 @@ ) from ._enums import ( # type: ignore + AccessRuleDirection, + AllocationState, AnalyticalStorageSchemaType, ApiType, AuthenticationMethod, @@ -332,24 +448,39 @@ AzureConnectionType, BackupPolicyMigrationStatus, BackupPolicyType, + BackupState, BackupStorageRedundancy, + CapacityMode, + CapacityModeTransitionStatus, + ClusterType, + CommandStatus, CompositePathSortOrder, ConflictResolutionMode, ConnectionState, ConnectorOffer, ContinuousTier, + CopyJobMode, + CopyJobStatus, + CopyJobType, CreateMode, CreatedByType, + DataTransferComponent, + DataTransferJobMode, DataType, DatabaseAccountKind, DedicatedGatewayType, DefaultConsistencyLevel, DefaultPriorityLevel, DistanceFunction, + EnableFullTextQuery, + FleetAnalyticsPropertiesStorageLocationType, FleetspacePropertiesFleetspaceApiKind, FleetspacePropertiesServiceTier, + GarnetAuthenticationType, + GarnetCacheProvisioningState, IndexKind, IndexingMode, + IssueType, KeyKind, Kind, ManagedCassandraProvisioningState, @@ -357,12 +488,14 @@ MinimalTlsVersion, MongoRoleDefinitionType, NetworkAclBypass, + NetworkSecurityPerimeterConfigurationProvisioningState, NodeState, NotebookWorkspaceName, OperationType, PartitionKind, PrimaryAggregationType, PublicNetworkAccess, + ResourceAssociationAccessMode, ResourceIdentityType, RestoreMode, RoleDefinitionType, @@ -371,8 +504,12 @@ ServiceSize, ServiceStatus, ServiceType, + Severity, + SoftDeleteActionKind, SpatialType, Status, + SupportedActions, + ThroughputPolicyType, TriggerOperation, TriggerType, Type, @@ -387,6 +524,9 @@ __all__ = [ "ARMProxyResource", "ARMResourceProperties", + "AccessRule", + "AccessRuleProperties", + "AccessRulePropertiesSubscriptionsItem", "AccountKeyMetadata", "AnalyticalStorageConfiguration", "ApiProperties", @@ -394,12 +534,22 @@ "AutoUpgradePolicyResource", "AutoscaleSettings", "AutoscaleSettingsResource", + "AzureBlobContainer", + "AzureBlobDataTransferDataSourceSink", + "AzureBlobSourceSinkDetails", "BackupInformation", "BackupPolicy", "BackupPolicyMigrationState", + "BackupResource", "BackupSchedule", + "BaseCopyJobProperties", + "BaseCopyJobTask", + "BaseCosmosDataTransferDataSourceSink", + "BlobToCassandraRUCopyJobProperties", + "BlobToCassandraRUCopyJobTask", "Capability", "Capacity", + "CapacityModeChangeTransitionState", "CassandraClusterDataCenterNodeItem", "CassandraClusterPublicStatus", "CassandraClusterPublicStatusDataCentersItem", @@ -412,6 +562,10 @@ "CassandraKeyspaceGetResults", "CassandraKeyspaceResource", "CassandraPartitionKey", + "CassandraRUToBlobCopyJobProperties", + "CassandraRUToBlobCopyJobTask", + "CassandraRUToCassandraRUCopyJobProperties", + "CassandraRUToCassandraRUCopyJobTask", "CassandraRoleAssignmentResource", "CassandraRoleAssignmentResourceProperties", "CassandraRoleDefinitionResource", @@ -424,7 +578,16 @@ "CassandraTableGetPropertiesResource", "CassandraTableGetResults", "CassandraTableResource", + "CassandraViewCreateUpdateParameters", + "CassandraViewCreateUpdateProperties", + "CassandraViewGetProperties", + "CassandraViewGetPropertiesOptions", + "CassandraViewGetPropertiesResource", + "CassandraViewGetResults", + "CassandraViewResource", "Certificate", + "ChaosFaultProperties", + "ChaosFaultResource", "ClientEncryptionIncludedPath", "ClientEncryptionKeyCreateUpdateParameters", "ClientEncryptionKeyCreateUpdateProperties", @@ -438,8 +601,10 @@ "ClusterResource", "ClusterResourceProperties", "Column", + "CommandAsyncPostBody", "CommandOutput", "CommandPostBody", + "CommandPublicResource", "CompositePath", "ComputedProperty", "ConflictResolutionPolicy", @@ -450,10 +615,28 @@ "ContinuousBackupRestoreLocation", "ContinuousModeBackupPolicy", "ContinuousModeProperties", + "CopyJobGetResults", + "CopyJobProperties", "CorsPolicy", + "CosmosCassandraDataTransferDataSourceSink", + "CosmosDBCassandraTable", + "CosmosDBMongoCollection", + "CosmosDBMongoVCoreCollection", + "CosmosDBNoSqlContainer", + "CosmosDBSourceSinkDetails", + "CosmosMongoDataTransferDataSourceSink", + "CosmosMongoVCoreDataTransferDataSourceSink", + "CosmosSqlDataTransferDataSourceSink", + "CreateJobRequest", "CreateUpdateOptions", "DataCenterResource", "DataCenterResourceProperties", + "DataMaskingPolicy", + "DataMaskingPolicyExcludedPathsItem", + "DataMaskingPolicyIncludedPathsItem", + "DataTransferDataSourceSink", + "DataTransferJobGetResults", + "DataTransferJobProperties", "DataTransferRegionalServiceResource", "DataTransferServiceResourceCreateUpdateProperties", "DataTransferServiceResourceProperties", @@ -470,6 +653,7 @@ "DatabaseAccountUpdateParameters", "DatabaseAccountUpdateProperties", "DatabaseRestoreResource", + "DiagnosticLogSettings", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -477,6 +661,8 @@ "ExcludedPath", "FailoverPolicies", "FailoverPolicy", + "FleetAnalyticsProperties", + "FleetAnalyticsResource", "FleetResource", "FleetResourceProperties", "FleetResourceUpdate", @@ -490,9 +676,21 @@ "FullTextIndexPath", "FullTextPath", "FullTextPolicy", + "GarnetClusterResource", + "GarnetClusterResourcePatch", + "GarnetClusterResourcePatchProperties", + "GarnetClusterResourceProperties", + "GarnetClusterResourcePropertiesEndPointsItem", "GraphAPIComputeRegionalServiceResource", "GraphAPIComputeServiceResourceCreateUpdateProperties", "GraphAPIComputeServiceResourceProperties", + "GraphResource", + "GraphResourceCreateUpdateParameters", + "GraphResourceCreateUpdateProperties", + "GraphResourceGetProperties", + "GraphResourceGetPropertiesOptions", + "GraphResourceGetPropertiesResource", + "GraphResourceGetResults", "GremlinDatabaseCreateUpdateParameters", "GremlinDatabaseCreateUpdateProperties", "GremlinDatabaseGetProperties", @@ -524,9 +722,13 @@ "ManagedCassandraReaperStatus", "ManagedServiceIdentity", "ManagedServiceIdentityUserAssignedIdentity", + "MaterializedViewDefinition", + "MaterializedViewDetails", "MaterializedViewsBuilderRegionalServiceResource", "MaterializedViewsBuilderServiceResourceCreateUpdateProperties", "MaterializedViewsBuilderServiceResourceProperties", + "MaterializedViewsProperties", + "MergeParameters", "Metric", "MetricAvailability", "MetricDefinition", @@ -553,12 +755,23 @@ "MongoMIRoleAssignmentResourceProperties", "MongoMIRoleDefinitionResource", "MongoMIRoleDefinitionResourceProperties", + "MongoRUToMongoRUCopyJobProperties", + "MongoRUToMongoRUCopyJobTask", + "MongoRUToMongoVCoreCopyJobProperties", + "MongoRUToMongoVCoreCopyJobTask", "MongoRoleDefinitionCreateUpdateParameters", "MongoRoleDefinitionGetResults", "MongoRoleDefinitionResource", "MongoUserDefinitionCreateUpdateParameters", "MongoUserDefinitionGetResults", "MongoUserDefinitionResource", + "MongoVCoreSourceSinkDetails", + "NetworkSecurityPerimeter", + "NetworkSecurityPerimeterConfiguration", + "NetworkSecurityPerimeterConfigurationProperties", + "NetworkSecurityProfile", + "NoSqlRUToNoSqlRUCopyJobProperties", + "NoSqlRUToNoSqlRUCopyJobTask", "NotebookWorkspace", "NotebookWorkspaceConnectionInfoResult", "NotebookWorkspaceCreateUpdateParameters", @@ -573,6 +786,14 @@ "PeriodicModeBackupPolicy", "PeriodicModeProperties", "Permission", + "PhysicalPartitionId", + "PhysicalPartitionStorageInfo", + "PhysicalPartitionStorageInfoCollection", + "PhysicalPartitionThroughputInfoProperties", + "PhysicalPartitionThroughputInfoResource", + "PhysicalPartitionThroughputInfoResult", + "PhysicalPartitionThroughputInfoResultProperties", + "PhysicalPartitionThroughputInfoResultPropertiesResource", "PrivateEndpointConnection", "PrivateEndpointConnectionProperties", "PrivateEndpointProperty", @@ -581,10 +802,16 @@ "PrivateLinkServiceConnectionStateProperty", "Privilege", "PrivilegeResource", + "ProvisioningIssue", + "ProvisioningIssueProperties", "ProxyResource", + "RedistributeThroughputParameters", + "RedistributeThroughputProperties", + "RedistributeThroughputPropertiesResource", "RegionForOnlineOffline", "RegionalServiceResource", "Resource", + "ResourceAssociation", "ResourceRestoreParameters", "RestorableDatabaseAccountGetResult", "RestorableDatabaseAccountProperties", @@ -618,12 +845,29 @@ "RestorableTableResourcesGetResult", "RestoreParameters", "RestoreParametersBase", + "RetrieveThroughputParameters", + "RetrieveThroughputProperties", + "RetrieveThroughputPropertiesResource", "Role", "SeedNode", "ServiceResource", "ServiceResourceCreateUpdateParameters", "ServiceResourceCreateUpdateProperties", "ServiceResourceProperties", + "SoftDeleteConfiguration", + "SoftDeletedDatabaseAccountGetResult", + "SoftDeletedDatabaseAccountProperties", + "SoftDeletedDatabaseAccountResource", + "SoftDeletedDatabaseAccountsListResult", + "SoftDeletedSqlContainerGetResult", + "SoftDeletedSqlContainerProperties", + "SoftDeletedSqlContainerResource", + "SoftDeletedSqlContainersListResult", + "SoftDeletedSqlDatabaseGetResult", + "SoftDeletedSqlDatabaseProperties", + "SoftDeletedSqlDatabaseResource", + "SoftDeletedSqlDatabasesListResult", + "SoftDeletionMetadata", "SpatialSpec", "SqlContainerCreateUpdateParameters", "SqlContainerCreateUpdateProperties", @@ -678,7 +922,13 @@ "TableRoleAssignmentResourceProperties", "TableRoleDefinitionResource", "TableRoleDefinitionResourceProperties", + "ThroughputBucketResource", "ThroughputPolicyResource", + "ThroughputPoolAccountProperties", + "ThroughputPoolAccountResource", + "ThroughputPoolProperties", + "ThroughputPoolResource", + "ThroughputPoolUpdate", "ThroughputSettingsGetProperties", "ThroughputSettingsGetPropertiesResource", "ThroughputSettingsGetResults", @@ -693,6 +943,8 @@ "VectorEmbeddingPolicy", "VectorIndex", "VirtualNetworkRule", + "AccessRuleDirection", + "AllocationState", "AnalyticalStorageSchemaType", "ApiType", "AuthenticationMethod", @@ -700,24 +952,39 @@ "AzureConnectionType", "BackupPolicyMigrationStatus", "BackupPolicyType", + "BackupState", "BackupStorageRedundancy", + "CapacityMode", + "CapacityModeTransitionStatus", + "ClusterType", + "CommandStatus", "CompositePathSortOrder", "ConflictResolutionMode", "ConnectionState", "ConnectorOffer", "ContinuousTier", + "CopyJobMode", + "CopyJobStatus", + "CopyJobType", "CreateMode", "CreatedByType", + "DataTransferComponent", + "DataTransferJobMode", "DataType", "DatabaseAccountKind", "DedicatedGatewayType", "DefaultConsistencyLevel", "DefaultPriorityLevel", "DistanceFunction", + "EnableFullTextQuery", + "FleetAnalyticsPropertiesStorageLocationType", "FleetspacePropertiesFleetspaceApiKind", "FleetspacePropertiesServiceTier", + "GarnetAuthenticationType", + "GarnetCacheProvisioningState", "IndexKind", "IndexingMode", + "IssueType", "KeyKind", "Kind", "ManagedCassandraProvisioningState", @@ -725,12 +992,14 @@ "MinimalTlsVersion", "MongoRoleDefinitionType", "NetworkAclBypass", + "NetworkSecurityPerimeterConfigurationProvisioningState", "NodeState", "NotebookWorkspaceName", "OperationType", "PartitionKind", "PrimaryAggregationType", "PublicNetworkAccess", + "ResourceAssociationAccessMode", "ResourceIdentityType", "RestoreMode", "RoleDefinitionType", @@ -739,8 +1008,12 @@ "ServiceSize", "ServiceStatus", "ServiceType", + "Severity", + "SoftDeleteActionKind", "SpatialType", "Status", + "SupportedActions", + "ThroughputPolicyType", "TriggerOperation", "TriggerType", "Type", diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_enums.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_enums.py index 0ea43b215a13..b4d005b44c63 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_enums.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_enums.py @@ -10,6 +10,24 @@ 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 AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Allocation state of the cluster and data center resources.""" + + ACTIVE = "Active" + """Active implies the virtual machines of the cluster are allocated.""" + DEALLOCATED = "Deallocated" + """Deallocated implies virtual machines and resources are deallocated.""" + + class AnalyticalStorageSchemaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the types of schema for analytical storage.""" @@ -92,6 +110,19 @@ class BackupPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CONTINUOUS.""" +class BackupState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current state of the backup.""" + + INITIATED = "Initiated" + """INITIATED.""" + IN_PROGRESS = "InProgress" + """IN_PROGRESS.""" + SUCCEEDED = "Succeeded" + """SUCCEEDED.""" + FAILED = "Failed" + """FAILED.""" + + class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to indicate type of backup storage redundancy.""" @@ -103,6 +134,58 @@ class BackupStorageRedundancy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ZONE.""" +class CapacityMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the capacity mode of the account.""" + + NONE = "None" + """NONE.""" + PROVISIONED = "Provisioned" + """PROVISIONED.""" + SERVERLESS = "Serverless" + """SERVERLESS.""" + + +class CapacityModeTransitionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The transition status of capacity mode.""" + + INVALID = "Invalid" + """INVALID.""" + INITIALIZED = "Initialized" + """INITIALIZED.""" + IN_PROGRESS = "InProgress" + """IN_PROGRESS.""" + COMPLETED = "Completed" + """COMPLETED.""" + FAILED = "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" + """PRODUCTION.""" + NON_PRODUCTION = "NonProduction" + """NON_PRODUCTION.""" + + +class CommandStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the command.""" + + DONE = "Done" + """DONE.""" + RUNNING = "Running" + """RUNNING.""" + ENQUEUE = "Enqueue" + """ENQUEUE.""" + PROCESSING = "Processing" + """PROCESSING.""" + FINISHED = "Finished" + """FINISHED.""" + FAILED = "Failed" + """FAILED.""" + + class CompositePathSortOrder(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sort order for composite paths.""" @@ -152,6 +235,53 @@ class ContinuousTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CONTINUOUS7_DAYS.""" CONTINUOUS30_DAYS = "Continuous30Days" """CONTINUOUS30_DAYS.""" + CONTINUOUS35_DAYS = "Continuous35Days" + """Continuous 35 Days backup tier.""" + + +class CopyJobMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mode of job execution.""" + + OFFLINE = "Offline" + """OFFLINE.""" + ONLINE = "Online" + """ONLINE.""" + + +class CopyJobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Job Status.""" + + PENDING = "Pending" + """PENDING.""" + PARTITIONING = "Partitioning" + """PARTITIONING.""" + RUNNING = "Running" + """RUNNING.""" + PAUSED = "Paused" + """PAUSED.""" + COMPLETED = "Completed" + """COMPLETED.""" + FAULTED = "Faulted" + """FAULTED.""" + CANCELLED = "Cancelled" + """CANCELLED.""" + + +class CopyJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Copy Job Type.""" + + CASSANDRA_RU_TO_CASSANDRA_RU = "CassandraRUToCassandraRU" + """CASSANDRA_RU_TO_CASSANDRA_RU.""" + CASSANDRA_RU_TO_AZURE_BLOB_STORAGE = "CassandraRUToAzureBlobStorage" + """CASSANDRA_RU_TO_AZURE_BLOB_STORAGE.""" + AZURE_BLOB_STORAGE_TO_CASSANDRA_RU = "AzureBlobStorageToCassandraRU" + """AZURE_BLOB_STORAGE_TO_CASSANDRA_RU.""" + MONGO_RU_TO_MONGO_RU = "MongoRUToMongoRU" + """MONGO_RU_TO_MONGO_RU.""" + MONGO_RU_TO_MONGO_V_CORE = "MongoRUToMongoVCore" + """MONGO_RU_TO_MONGO_V_CORE.""" + NO_SQL_RU_TO_NO_SQL_RU = "NoSqlRUToNoSqlRU" + """NO_SQL_RU_TO_NO_SQL_RU.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -187,6 +317,32 @@ class DatabaseAccountKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """PARSE.""" +class DataTransferComponent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of DataTransferComponent.""" + + COSMOS_DB_CASSANDRA = "CosmosDBCassandra" + """COSMOS_DB_CASSANDRA.""" + COSMOS_DB_MONGO = "CosmosDBMongo" + """COSMOS_DB_MONGO.""" + COSMOS_DB_MONGO_V_CORE = "CosmosDBMongoVCore" + """COSMOS_DB_MONGO_V_CORE.""" + COSMOS_DB_SQL = "CosmosDBSql" + """COSMOS_DB_SQL.""" + AZURE_BLOB_STORAGE = "AzureBlobStorage" + """AZURE_BLOB_STORAGE.""" + BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK = "BaseCosmosDataTransferDataSourceSink" + """BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK.""" + + +class DataTransferJobMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mode of job execution.""" + + OFFLINE = "Offline" + """OFFLINE.""" + ONLINE = "Online" + """ONLINE.""" + + class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The datatype for which the indexing behavior is applied to.""" @@ -248,6 +404,28 @@ class DistanceFunction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """DOTPRODUCT.""" +class EnableFullTextQuery(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describe the level of detail with which queries are to be logged.""" + + NONE = "None" + """NONE.""" + TRUE = "True" + """TRUE.""" + FALSE = "False" + """FALSE.""" + + +class FleetAnalyticsPropertiesStorageLocationType( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): + """The type of the fleet analytics resource.""" + + STORAGE_ACCOUNT = "StorageAccount" + """STORAGE_ACCOUNT.""" + FABRIC_LAKEHOUSE = "FabricLakehouse" + """FABRIC_LAKEHOUSE.""" + + class FleetspacePropertiesFleetspaceApiKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of API this fleetspace belongs to. Acceptable values: 'NoSQL'.""" @@ -266,6 +444,30 @@ class FleetspacePropertiesServiceTier(str, Enum, metaclass=CaseInsensitiveEnumMe """BUSINESS_CRITICAL.""" +class GarnetAuthenticationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The authentication method used for the Garnet cluster.""" + + ENTRA = "Entra" + """Microsoft Entra authentication.""" + + +class GarnetCacheProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The status of the resource at the time the operation was called.""" + + CREATING = "Creating" + """Creating.""" + UPDATING = "Updating" + """Updating.""" + DELETING = "Deleting" + """Deleting.""" + SUCCEEDED = "Succeeded" + """Succeeded.""" + FAILED = "Failed" + """Failed.""" + CANCELED = "Canceled" + """Canceled.""" + + class IndexingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the indexing mode.""" @@ -288,6 +490,22 @@ class IndexKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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.""" @@ -371,6 +589,29 @@ class NetworkAclBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AZURE_SERVICES.""" +class NetworkSecurityPerimeterConfigurationProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): + """Provisioning state of a network security perimeter configuration that is being created or + updated. + """ + + SUCCEEDED = "Succeeded" + """The configuration was provisioned successfully.""" + CREATING = "Creating" + """The configuration is being created.""" + UPDATING = "Updating" + """The configuration is being updated.""" + DELETING = "Deleting" + """The configuration is being deleted.""" + ACCEPTED = "Accepted" + """The configuration request was accepted and provisioning has not started yet.""" + FAILED = "Failed" + """The configuration failed to provision.""" + CANCELED = "Canceled" + """The configuration provisioning was canceled.""" + + class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The state of the node in Cassandra ring.""" @@ -449,6 +690,17 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SECURED_BY_PERIMETER.""" +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 @@ -552,6 +804,24 @@ class ServiceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """MATERIALIZED_VIEWS_BUILDER.""" +class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Severity of the issue.""" + + WARNING = "Warning" + """The issue is a warning and does not prevent the configuration from being applied.""" + ERROR = "Error" + """The issue is an error and prevents the configuration from being applied.""" + + +class SoftDeleteActionKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of soft delete action to perform.""" + + RESTORE_SOFT_DELETED_RESOURCE = "RestoreSoftDeletedResource" + """Restores the soft-deleted resource to active/online state.""" + PERMANENT_DELETE_RESOURCE = "PermanentDeleteResource" + """Permanently deletes the soft-deleted resource.""" + + class SpatialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the spatial type of index.""" @@ -590,6 +860,26 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CREATING.""" +class SupportedActions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether what action to take for the Chaos Fault.""" + + ENABLE = "Enable" + """ENABLE.""" + DISABLE = "Disable" + """DISABLE.""" + + +class ThroughputPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ThroughputPolicy to apply for throughput redistribution.""" + + NONE = "none" + """NONE.""" + EQUAL = "equal" + """EQUAL.""" + CUSTOM = "custom" + """CUSTOM.""" + + class TriggerOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operation the trigger is associated with.""" diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py index 2000d9974353..604e1088eab8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py @@ -12,12 +12,150 @@ from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload from .._utils.model_base import Model as _Model, rest_discriminator, rest_field -from ._enums import BackupPolicyType, ServiceType +from ._enums import BackupPolicyType, CopyJobType, DataTransferComponent, ServiceType if TYPE_CHECKING: from .. import models as _models +class AccessRule(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Access rule in a network security perimeter configuration profile. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: Properties of the access rule. + :vartype properties: ~azure.mgmt.cosmosdb.models.AccessRuleProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the access rule.""" + properties: Optional["_models.AccessRuleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the access rule.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.AccessRuleProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessRuleProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of Access Rule. + + :ivar direction: Direction of the 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] + """ + + direction: Optional[Union[str, "_models.AccessRuleDirection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Direction of the access rule. Known values are: \"Inbound\" and \"Outbound\".""" + address_prefixes: Optional[list[str]] = rest_field( + name="addressPrefixes", visibility=["read", "create", "update", "delete", "query"] + ) + """Address prefixes in the CIDR format for inbound rules.""" + subscriptions: Optional[list["_models.AccessRulePropertiesSubscriptionsItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Subscriptions for inbound rules.""" + network_security_perimeters: Optional[list["_models.NetworkSecurityPerimeter"]] = rest_field( + name="networkSecurityPerimeters", visibility=["read", "create", "update", "delete", "query"] + ) + """Network security perimeters for inbound rules.""" + fully_qualified_domain_names: Optional[list[str]] = rest_field( + name="fullyQualifiedDomainNames", visibility=["read", "create", "update", "delete", "query"] + ) + """Fully qualified domain names (FQDN) for outbound rules.""" + email_addresses: Optional[list[str]] = rest_field( + name="emailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Email addresses for outbound rules.""" + phone_numbers: Optional[list[str]] = rest_field( + name="phoneNumbers", visibility=["read", "create", "update", "delete", "query"] + ) + """Phone numbers for outbound rules.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessRulePropertiesSubscriptionsItem(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The subscription resource ID for an access rule. + + :ivar id: The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000'). + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000').""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class AccountKeyMetadata(_Model): """The metadata related to an access key for a given database account. @@ -25,6 +163,10 @@ class AccountKeyMetadata(_Model): missing from the object, it means that the last key regeneration was triggered before 2022-06-18. :vartype generation_time: ~datetime.datetime + :ivar approximate_last_usage_time: Approximate time in UTC of the most recent usage of the key + in ISO-8601 format. If the value is missing from the object, it means there is no recorded data + plane usage for this key. + :vartype approximate_last_usage_time: ~datetime.datetime """ generation_time: Optional[datetime.datetime] = rest_field( @@ -32,9 +174,14 @@ class AccountKeyMetadata(_Model): ) """Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18.""" + approximate_last_usage_time: Optional[datetime.datetime] = rest_field( + name="approximateLastUsageTime", visibility=["read"], format="rfc3339" + ) + """Approximate time in UTC of the most recent usage of the key in ISO-8601 format. If the value is + missing from the object, it means there is no recorded data plane usage for this key.""" -class AnalyticalStorageConfiguration(_Model): +class AnalyticalStorageConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Analytical storage specific properties. :ivar schema_type: Describes the types of schema for analytical storage. Known values are: @@ -66,7 +213,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ApiProperties(_Model): +class ApiProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """ApiProperties. :ivar server_version: Describes the version of the MongoDB account. Known values are: "3.2", @@ -118,7 +265,7 @@ class ARMProxyResource(_Model): """The type of Azure resource.""" -class ARMResourceProperties(_Model): +class ARMResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The core properties of ARM resources. :ivar id: The unique resource identifier of the ARM resource. @@ -180,7 +327,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AuthenticationMethodLdapProperties(_Model): +class AuthenticationMethodLdapProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Ldap authentication method properties. This feature is in preview. :ivar server_hostname: Hostname of the LDAP server. @@ -263,7 +410,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AutoscaleSettings(_Model): +class AutoscaleSettings(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """AutoscaleSettings. :ivar max_throughput: Represents maximum throughput, the resource can scale up to. @@ -293,7 +440,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AutoscaleSettingsResource(_Model): +class AutoscaleSettingsResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB provisioned throughput settings object. :ivar max_throughput: Represents maximum throughput container can scale up to. Required. @@ -334,7 +481,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AutoUpgradePolicyResource(_Model): +class AutoUpgradePolicyResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB resource auto-upgrade policy. :ivar throughput_policy: Represents throughput policy which service must adhere to for @@ -365,7 +512,141 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BackupInformation(_Model): +class AzureBlobContainer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Blob container. + + :ivar container_name: Azure Blob container. Required. + :vartype container_name: str + """ + + container_name: str = rest_field(name="containerName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Blob container. Required.""" + + @overload + def __init__( + self, + *, + container_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataTransferDataSourceSink(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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, + CosmosCassandraDataTransferDataSourceSink, CosmosMongoDataTransferDataSourceSink, + CosmosMongoVCoreDataTransferDataSourceSink, CosmosSqlDataTransferDataSourceSink + + :ivar component: Required. Known values are: "CosmosDBCassandra", "CosmosDBMongo", + "CosmosDBMongoVCore", "CosmosDBSql", "AzureBlobStorage", and + "BaseCosmosDataTransferDataSourceSink". + :vartype component: str or ~azure.mgmt.cosmosdb.models.DataTransferComponent + """ + + __mapping__: dict[str, _Model] = {} + component: str = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"CosmosDBCassandra\", \"CosmosDBMongo\", \"CosmosDBMongoVCore\", + \"CosmosDBSql\", \"AzureBlobStorage\", and \"BaseCosmosDataTransferDataSourceSink\".""" + + @overload + def __init__( + self, + *, + component: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureBlobDataTransferDataSourceSink( + DataTransferDataSourceSink, discriminator="AzureBlobStorage" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Blob Storage data source/sink. + + :ivar container_name: Required. + :vartype container_name: str + :ivar endpoint_url: + :vartype endpoint_url: str + :ivar component: Required. AZURE_BLOB_STORAGE. + :vartype component: str or ~azure.mgmt.cosmosdb.models.AZURE_BLOB_STORAGE + """ + + container_name: str = rest_field(name="containerName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + endpoint_url: Optional[str] = rest_field( + name="endpointUrl", visibility=["read", "create", "update", "delete", "query"] + ) + component: Literal[DataTransferComponent.AZURE_BLOB_STORAGE] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. AZURE_BLOB_STORAGE.""" + + @overload + def __init__( + self, + *, + container_name: str, + endpoint_url: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.component = DataTransferComponent.AZURE_BLOB_STORAGE # type: ignore + + +class AzureBlobSourceSinkDetails(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Blob Storage data source/sink. + + :ivar endpoint_url: Azure Blob container endpoint. Required. + :vartype endpoint_url: str + """ + + endpoint_url: str = rest_field(name="endpointUrl", visibility=["read", "create", "update", "delete", "query"]) + """Azure Blob container endpoint. Required.""" + + @overload + def __init__( + self, + *, + endpoint_url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Backup information of a resource. :ivar continuous_backup_information: Information about the status of continuous backups. @@ -395,7 +676,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BackupPolicy(_Model): +class BackupPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The object representing the policy for taking backups on an account. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -436,7 +717,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BackupPolicyMigrationState(_Model): +class BackupPolicyMigrationState(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The object representing the state of the migration between the backup policies. :ivar status: Describes the status of migration between backup policy types. Known values are: @@ -484,7 +765,65 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BackupSchedule(_Model): +class BackupResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + """ + + backup_id: Optional[str] = rest_field(name="backupId", visibility=["read", "create", "update", "delete", "query"]) + """The unique identifier of backup.""" + backup_state: Optional[Union[str, "_models.BackupState"]] = rest_field( + name="backupState", visibility=["read", "create", "update", "delete", "query"] + ) + """The current state of the backup. Known values are: \"Initiated\", \"InProgress\", + \"Succeeded\", and \"Failed\".""" + backup_start_timestamp: Optional[datetime.datetime] = rest_field( + name="backupStartTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the backup process begins.""" + backup_stop_timestamp: Optional[datetime.datetime] = rest_field( + name="backupStopTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the backup process ends.""" + backup_expiry_timestamp: Optional[datetime.datetime] = rest_field( + name="backupExpiryTimestamp", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the backup will expire.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BackupSchedule(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """BackupSchedule. :ivar schedule_name: The unique identifier of backup schedule. @@ -530,23 +869,31 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Capability(_Model): - """Cosmos DB capability object. +class BaseCopyJobProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Base copy job properties. - :ivar name: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current - values also include "EnableTable" and "EnableGremlin". - :vartype name: str + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BlobToCassandraRUCopyJobProperties, CassandraRUToBlobCopyJobProperties, + CassandraRUToCassandraRUCopyJobProperties, MongoRUToMongoRUCopyJobProperties, + MongoRUToMongoVCoreCopyJobProperties, NoSqlRUToNoSqlRUCopyJobProperties + + :ivar job_type: Copy Job Type. Required. Known values are: "CassandraRUToCassandraRU", + "CassandraRUToAzureBlobStorage", "AzureBlobStorageToCassandraRU", "MongoRUToMongoRU", + "MongoRUToMongoVCore", and "NoSqlRUToNoSqlRU". + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.CopyJobType """ - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB capability. For example, \"name\": \"EnableCassandra\". Current values - also include \"EnableTable\" and \"EnableGremlin\".""" + __mapping__: dict[str, _Model] = {} + job_type: str = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) + """Copy Job Type. Required. Known values are: \"CassandraRUToCassandraRU\", + \"CassandraRUToAzureBlobStorage\", \"AzureBlobStorageToCassandraRU\", \"MongoRUToMongoRU\", + \"MongoRUToMongoVCore\", and \"NoSqlRUToNoSqlRU\".""" @overload def __init__( self, *, - name: Optional[str] = None, + job_type: str, ) -> None: ... @overload @@ -560,28 +907,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Capacity(_Model): - """The object that represents all properties related to capacity enforcement on an account. +class BaseCopyJobTask(_Model): + """The properties of a Copy Job Task. - :ivar total_throughput_limit: The total throughput limit imposed on the account. A - totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned - on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of - throughput. - :vartype total_throughput_limit: int + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int """ - total_throughput_limit: Optional[int] = rest_field( - name="totalThroughputLimit", visibility=["read", "create", "update", "delete", "query"] + total_count: Optional[int] = rest_field(name="totalCount", visibility=["read"]) + """Task level Total Count.""" + processed_count: Optional[int] = rest_field(name="processedCount", visibility=["read"]) + """Task level Processed Count.""" + + +class BaseCosmosDataTransferDataSourceSink( + DataTransferDataSourceSink, discriminator="BaseCosmosDataTransferDataSourceSink" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + + :ivar remote_account_name: + :vartype remote_account_name: str + :ivar component: Required. BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK. + :vartype component: str or + ~azure.mgmt.cosmosdb.models.BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK + """ + + __mapping__: dict[str, _Model] = {} + remote_account_name: Optional[str] = rest_field( + name="remoteAccountName", visibility=["read", "create", "update", "delete", "query"] ) - """The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a - strict limit of max throughput that can be provisioned on that account to be 2000. A - totalThroughputLimit of -1 indicates no limits on provisioning of throughput.""" + component: Literal[DataTransferComponent.BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK.""" @overload def __init__( self, *, - total_throughput_limit: Optional[int] = None, + remote_account_name: Optional[str] = None, ) -> None: ... @overload @@ -593,41 +961,267 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.component = DataTransferComponent.BASE_COSMOS_DATA_TRANSFER_DATA_SOURCE_SINK # type: ignore -class CassandraClusterDataCenterNodeItem(_Model): - """CassandraClusterDataCenterNodeItem. +class BlobToCassandraRUCopyJobProperties( + BaseCopyJobProperties, discriminator="AzureBlobStorageToCassandraRU" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Source Azure Blob Storage to Destination Cassandra copy job properties. - :ivar address: The node's IP address. - :vartype address: str - :ivar state: The state of the node in Cassandra ring. Known values are: "Normal", "Leaving", - "Joining", "Moving", and "Stopped". - :vartype state: str or ~azure.mgmt.cosmosdb.models.NodeState - :ivar status: - :vartype status: str - :ivar cassandra_process_status: Cassandra service status on this node. - :vartype cassandra_process_status: str - :ivar load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding - all content in the snapshots subdirectories. Because all SSTable data files are included, any - data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. - :vartype load: str - :ivar tokens: List of tokens this node covers. - :vartype tokens: list[str] - :ivar size: - :vartype size: int - :ivar host_id: The network ID of the node. - :vartype host_id: str - :ivar rack: The rack this node is part of. - :vartype rack: str - :ivar timestamp: The timestamp when these statistics were captured. - :vartype timestamp: str - :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. - :vartype disk_used_kb: int - :ivar disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. - :vartype disk_free_kb: int - :ivar memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. - :vartype memory_used_kb: int - :ivar memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) + :ivar source_details: Azure Storage container DataStore details. Required. + :vartype source_details: ~azure.mgmt.cosmosdb.models.AzureBlobSourceSinkDetails + :ivar destination_details: Destination Cassandra DataStore details. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.BlobToCassandraRUCopyJobTask] + :ivar job_type: Copy Job Type. Required. AZURE_BLOB_STORAGE_TO_CASSANDRA_RU. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU + """ + + source_details: "_models.AzureBlobSourceSinkDetails" = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Storage container DataStore details. Required.""" + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Cassandra DataStore details.""" + tasks: list["_models.BlobToCassandraRUCopyJobTask"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. AZURE_BLOB_STORAGE_TO_CASSANDRA_RU.""" + + @overload + def __init__( + self, + *, + source_details: "_models.AzureBlobSourceSinkDetails", + tasks: list["_models.BlobToCassandraRUCopyJobTask"], + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.job_type = CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU # type: ignore + + +class BlobToCassandraRUCopyJobTask(BaseCopyJobTask): # pylint: disable=docstring-keyword-should-match-keyword-only + """BlobToCassandraRUCopyJobTask. + + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source Azure Blob container. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.AzureBlobContainer + :ivar destination: Destination Cassandra table. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.CosmosDBCassandraTable + """ + + source: "_models.AzureBlobContainer" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source Azure Blob container. Required.""" + destination: "_models.CosmosDBCassandraTable" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Cassandra table. Required.""" + + @overload + def __init__( + self, + *, + source: "_models.AzureBlobContainer", + destination: "_models.CosmosDBCassandraTable", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Capability(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB capability object. + + :ivar name: Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current + values also include "EnableTable" and "EnableGremlin". + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB capability. For example, \"name\": \"EnableCassandra\". Current values + also include \"EnableTable\" and \"EnableGremlin\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Capacity(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The object that represents all properties related to capacity enforcement on an account. + + :ivar total_throughput_limit: The total throughput limit imposed on the account. A + totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned + on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of + throughput. + :vartype total_throughput_limit: int + """ + + total_throughput_limit: Optional[int] = rest_field( + name="totalThroughputLimit", visibility=["read", "create", "update", "delete", "query"] + ) + """The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a + strict limit of max throughput that can be provisioned on that account to be 2000. A + totalThroughputLimit of -1 indicates no limits on provisioning of throughput.""" + + @overload + def __init__( + self, + *, + total_throughput_limit: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CapacityModeChangeTransitionState(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The transition state information related capacity mode change with update 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 + """ + + capacity_mode_transition_status: Optional[Union[str, "_models.CapacityModeTransitionStatus"]] = rest_field( + name="capacityModeTransitionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The transition status of capacity mode. Known values are: \"Invalid\", \"Initialized\", + \"InProgress\", \"Completed\", and \"Failed\".""" + current_capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = rest_field( + name="currentCapacityMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the current capacity mode of the account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + previous_capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = rest_field( + name="previousCapacityMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the previous capacity mode of the account before successful transition. Known values + are: \"None\", \"Provisioned\", and \"Serverless\".""" + capacity_mode_transition_begin_timestamp: Optional[datetime.datetime] = rest_field( + name="capacityModeTransitionBeginTimestamp", visibility=["read"], format="rfc3339" + ) + """Begin time in UTC of the capacity mode change.""" + capacity_mode_transition_end_timestamp: Optional[datetime.datetime] = rest_field( + name="capacityModeTransitionEndTimestamp", visibility=["read"], format="rfc3339" + ) + """End time in UTC of the capacity mode change.""" + capacity_mode_last_successful_transition_end_timestamp: Optional[datetime.datetime] = rest_field( + name="capacityModeLastSuccessfulTransitionEndTimestamp", visibility=["read"], format="rfc3339" + ) + """End time in UTC of the last successful capacity mode change.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CassandraClusterDataCenterNodeItem(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """CassandraClusterDataCenterNodeItem. + + :ivar address: The node's IP address. + :vartype address: str + :ivar state: The state of the node in Cassandra ring. Known values are: "Normal", "Leaving", + "Joining", "Moving", and "Stopped". + :vartype state: str or ~azure.mgmt.cosmosdb.models.NodeState + :ivar status: + :vartype status: str + :ivar cassandra_process_status: Cassandra service status on this node. + :vartype cassandra_process_status: str + :ivar load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding + all content in the snapshots subdirectories. Because all SSTable data files are included, any + data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. + :vartype load: str + :ivar tokens: List of tokens this node covers. + :vartype tokens: list[str] + :ivar size: + :vartype size: int + :ivar host_id: The network ID of the node. + :vartype host_id: str + :ivar rack: The rack this node is part of. + :vartype rack: str + :ivar timestamp: The timestamp when these statistics were captured. + :vartype timestamp: str + :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. + :vartype disk_used_kb: int + :ivar disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. + :vartype disk_free_kb: int + :ivar memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. + :vartype memory_used_kb: int + :ivar memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. :vartype memory_buffers_and_cached_kb: int :ivar memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. @@ -732,7 +1326,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraClusterPublicStatus(_Model): +class CassandraClusterPublicStatus(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties of a managed Cassandra cluster public status. :ivar e_tag: @@ -789,7 +1383,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraClusterPublicStatusDataCentersItem(_Model): # pylint: disable=name-too-long +class CassandraClusterPublicStatusDataCentersItem( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """CassandraClusterPublicStatusDataCentersItem. :ivar name: The name of this Datacenter. @@ -830,7 +1426,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraError(_Model): +class CassandraError(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """CassandraError. :ivar code: The code of error that occurred. @@ -875,7 +1471,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraKeyspaceCreateUpdateParameters(ARMResourceProperties): +class CassandraKeyspaceCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB Cassandra keyspace. :ivar id: The unique resource identifier of the ARM resource. @@ -945,7 +1543,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class CassandraKeyspaceCreateUpdateProperties(_Model): +class CassandraKeyspaceCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB Cassandra keyspace. :ivar resource: The standard JSON format of a Cassandra keyspace. Required. @@ -984,7 +1582,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraKeyspaceGetProperties(_Model): +class CassandraKeyspaceGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB Cassandra keyspace. :ivar resource: @@ -1019,7 +1617,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OptionsResource(_Model): +class OptionsResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB options resource object. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -1056,7 +1654,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraKeyspaceGetPropertiesOptions(OptionsResource): +class CassandraKeyspaceGetPropertiesOptions( + OptionsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """CassandraKeyspaceGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -1085,7 +1685,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraKeyspaceResource(_Model): +class CassandraKeyspaceResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB Cassandra keyspace resource object. :ivar id: Name of the Cosmos DB Cassandra keyspace. Required. @@ -1113,7 +1713,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraKeyspaceGetPropertiesResource(CassandraKeyspaceResource): +class CassandraKeyspaceGetPropertiesResource( + CassandraKeyspaceResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """CassandraKeyspaceGetPropertiesResource. :ivar id: Name of the Cosmos DB Cassandra keyspace. Required. @@ -1198,7 +1800,7 @@ class ProxyResource(Resource): """ -class CassandraKeyspaceGetResults(ProxyResource): +class CassandraKeyspaceGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB Cassandra keyspace. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -1286,7 +1888,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class CassandraPartitionKey(_Model): +class CassandraPartitionKey(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB Cassandra table partition key. :ivar name: Name of the Cosmos DB Cassandra table partition key. @@ -1314,7 +1916,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraRoleAssignmentResource(ProxyResource): +class CassandraRoleAssignmentResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB Cassandra Role Assignment. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -1375,7 +1977,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class CassandraRoleAssignmentResourceProperties(_Model): # pylint: disable=name-too-long +class CassandraRoleAssignmentResourceProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Azure Cosmos DB Cassandra Role Assignment resource object. :ivar role_definition_id: The unique identifier for the associated Role Definition. @@ -1427,7 +2031,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraRoleDefinitionResource(ProxyResource): +class CassandraRoleDefinitionResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB Cassandra Role Definition. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -1488,7 +2092,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class CassandraRoleDefinitionResourceProperties(_Model): # pylint: disable=name-too-long +class CassandraRoleDefinitionResourceProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Azure Cosmos DB Cassandra Role Definition resource object. :ivar id: The path id for the Role Definition. @@ -1553,35 +2159,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraSchema(_Model): - """Cosmos DB Cassandra table schema. +class CassandraRUToBlobCopyJobProperties( + BaseCopyJobProperties, discriminator="CassandraRUToAzureBlobStorage" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Source Cassandra to Destination Azure Blob Storage copy job properties. - :ivar columns: List of Cassandra table columns. - :vartype columns: list[~azure.mgmt.cosmosdb.models.Column] - :ivar partition_keys: List of partition key. - :vartype partition_keys: list[~azure.mgmt.cosmosdb.models.CassandraPartitionKey] - :ivar cluster_keys: List of cluster key. - :vartype cluster_keys: list[~azure.mgmt.cosmosdb.models.ClusterKey] + :ivar source_details: Source Cassandra DataStore details. + :vartype source_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar destination_details: Destination Cassandra DataStore details. Required. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.AzureBlobSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.CassandraRUToBlobCopyJobTask] + :ivar job_type: Copy Job Type. Required. CASSANDRA_RU_TO_AZURE_BLOB_STORAGE. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE """ - columns: Optional[list["_models.Column"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """List of Cassandra table columns.""" - partition_keys: Optional[list["_models.CassandraPartitionKey"]] = rest_field( - name="partitionKeys", visibility=["read", "create", "update", "delete", "query"] + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] ) - """List of partition key.""" - cluster_keys: Optional[list["_models.ClusterKey"]] = rest_field( - name="clusterKeys", visibility=["read", "create", "update", "delete", "query"] + """Source Cassandra DataStore details.""" + destination_details: "_models.AzureBlobSourceSinkDetails" = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] ) - """List of cluster key.""" + """Destination Cassandra DataStore details. Required.""" + tasks: list["_models.CassandraRUToBlobCopyJobTask"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. CASSANDRA_RU_TO_AZURE_BLOB_STORAGE.""" @overload def __init__( self, *, - columns: Optional[list["_models.Column"]] = None, - partition_keys: Optional[list["_models.CassandraPartitionKey"]] = None, - cluster_keys: Optional[list["_models.ClusterKey"]] = None, + destination_details: "_models.AzureBlobSourceSinkDetails", + tasks: list["_models.CassandraRUToBlobCopyJobTask"], + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, ) -> None: ... @overload @@ -1593,47 +2207,33 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.job_type = CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE # type: ignore -class CassandraTableCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Cassandra table. +class CassandraRUToBlobCopyJobTask(BaseCopyJobTask): # pylint: disable=docstring-keyword-should-match-keyword-only + """CassandraRUToBlobCopyJobTask. - :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 properties: Properties to create and update Azure Cosmos DB Cassandra table. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateProperties + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source Cassandra table. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.CosmosDBCassandraTable + :ivar destination: Destination Azure Blob container. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.AzureBlobContainer """ - properties: "_models.CassandraTableCreateUpdateProperties" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties to create and update Azure Cosmos DB Cassandra table. Required.""" - - __flattened_items = ["resource", "options"] + source: "_models.CosmosDBCassandraTable" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source Cassandra table. Required.""" + destination: "_models.AzureBlobContainer" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Destination Azure Blob container. Required.""" @overload def __init__( self, *, - properties: "_models.CassandraTableCreateUpdateProperties", - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, + source: "_models.CosmosDBCassandraTable", + destination: "_models.AzureBlobContainer", ) -> None: ... @overload @@ -1644,51 +2244,46 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class CassandraTableCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB Cassandra table. +class CassandraRUToCassandraRUCopyJobProperties( + BaseCopyJobProperties, discriminator="CassandraRUToCassandraRU" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Source Cassandra to Destination Cassandra copy job properties. - :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 - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar source_details: Source Cassandra DataStore details. + :vartype source_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar destination_details: Destination Cassandra DataStore details. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.CassandraRUToCassandraRUCopyJobTask] + :ivar job_type: Copy Job Type. Required. CASSANDRA_RU_TO_CASSANDRA_RU. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.CASSANDRA_RU_TO_CASSANDRA_RU """ - resource: "_models.CassandraTableResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The standard JSON format of a Cassandra table. Required.""" - options: Optional["_models.CreateUpdateOptions"] = rest_field( + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Source Cassandra DataStore details.""" + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Cassandra DataStore details.""" + tasks: list["_models.CassandraRUToCassandraRUCopyJobTask"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """A key-value pair of options to be applied for the request. This corresponds to the headers sent - with the request.""" + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. CASSANDRA_RU_TO_CASSANDRA_RU.""" @overload def __init__( self, *, - resource: "_models.CassandraTableResource", - options: Optional["_models.CreateUpdateOptions"] = None, + tasks: list["_models.CassandraRUToCassandraRUCopyJobTask"], + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, ) -> None: ... @overload @@ -1700,13 +2295,206 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.job_type = CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU # type: ignore -class CassandraTableGetProperties(_Model): - """The properties of an Azure Cosmos DB Cassandra table. +class CassandraRUToCassandraRUCopyJobTask( + BaseCopyJobTask +): # pylint: disable=docstring-keyword-should-match-keyword-only + """CassandraRUToCassandraRUCopyJobTask. - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source Cassandra table. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.CosmosDBCassandraTable + :ivar destination: Destination Cassandra table. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.CosmosDBCassandraTable + """ + + source: "_models.CosmosDBCassandraTable" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source Cassandra table. Required.""" + destination: "_models.CosmosDBCassandraTable" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Cassandra table. Required.""" + + @overload + def __init__( + self, + *, + source: "_models.CosmosDBCassandraTable", + destination: "_models.CosmosDBCassandraTable", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CassandraSchema(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Cassandra table schema. + + :ivar columns: List of Cassandra table columns. + :vartype columns: list[~azure.mgmt.cosmosdb.models.Column] + :ivar partition_keys: List of partition key. + :vartype partition_keys: list[~azure.mgmt.cosmosdb.models.CassandraPartitionKey] + :ivar cluster_keys: List of cluster key. + :vartype cluster_keys: list[~azure.mgmt.cosmosdb.models.ClusterKey] + """ + + columns: Optional[list["_models.Column"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of Cassandra table columns.""" + partition_keys: Optional[list["_models.CassandraPartitionKey"]] = rest_field( + name="partitionKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """List of partition key.""" + cluster_keys: Optional[list["_models.ClusterKey"]] = rest_field( + name="clusterKeys", visibility=["read", "create", "update", "delete", "query"] + ) + """List of cluster key.""" + + @overload + def __init__( + self, + *, + columns: Optional[list["_models.Column"]] = None, + partition_keys: Optional[list["_models.CassandraPartitionKey"]] = None, + cluster_keys: Optional[list["_models.ClusterKey"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CassandraTableCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB Cassandra table. + + :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 properties: Properties to create and update Azure Cosmos DB Cassandra table. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateProperties + """ + + properties: "_models.CassandraTableCreateUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update Azure Cosmos DB Cassandra table. Required.""" + + __flattened_items = ["resource", "options"] + + @overload + def __init__( + self, + *, + properties: "_models.CassandraTableCreateUpdateProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CassandraTableCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB Cassandra table. + + :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 + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + """ + + resource: "_models.CassandraTableResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a Cassandra table. Required.""" + options: Optional["_models.CreateUpdateOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" + + @overload + def __init__( + self, + *, + resource: "_models.CassandraTableResource", + options: Optional["_models.CreateUpdateOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CassandraTableGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Cassandra table. + + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesResource :ivar options: :vartype options: ~azure.mgmt.cosmosdb.models.CassandraTableGetPropertiesOptions """ @@ -1737,7 +2525,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraTableGetPropertiesOptions(OptionsResource): +class CassandraTableGetPropertiesOptions( + OptionsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """CassandraTableGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -1766,7 +2556,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraTableResource(_Model): +class CassandraTableResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB Cassandra table resource object. :ivar id: Name of the Cosmos DB Cassandra table. Required. @@ -1813,7 +2603,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraTableGetPropertiesResource(CassandraTableResource): +class CassandraTableGetPropertiesResource( + CassandraTableResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """CassandraTableGetPropertiesResource. :ivar id: Name of the Cosmos DB Cassandra table. Required. @@ -1862,7 +2654,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CassandraTableGetResults(ProxyResource): +class CassandraTableGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB Cassandra table. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -1950,21 +2742,47 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class Certificate(_Model): - """Certificate. +class CassandraViewCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB Cassandra view. - :ivar pem: PEM formatted public key. - :vartype pem: str + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar tags: 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 properties: Properties to create and update Azure Cosmos DB Cassandra view. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateProperties """ - pem: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """PEM formatted public key.""" + properties: "_models.CassandraViewCreateUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update Azure Cosmos DB Cassandra view. Required.""" + + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - pem: Optional[str] = None, + properties: "_models.CassandraViewCreateUpdateProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -1975,46 +2793,51 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class ClientEncryptionIncludedPath(_Model): - """. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :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 + +class CassandraViewCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB Cassandra view. + + :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 """ - path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Path that needs to be encrypted. Required.""" - client_encryption_key_id: str = rest_field( - name="clientEncryptionKeyId", visibility=["read", "create", "update", "delete", "query"] - ) - """The identifier of the Client Encryption Key to be used to encrypt the path. Required.""" - encryption_type: str = rest_field(name="encryptionType", visibility=["read", "create", "update", "delete", "query"]) - """The type of encryption to be performed. Eg - Deterministic, Randomized. Required.""" - encryption_algorithm: str = rest_field( - name="encryptionAlgorithm", visibility=["read", "create", "update", "delete", "query"] + resource: "_models.CassandraViewResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a Cassandra view. Required.""" + options: Optional["_models.CreateUpdateOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. Required.""" + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" @overload def __init__( self, *, - path: str, - client_encryption_key_id: str, - encryption_type: str, - encryption_algorithm: str, + resource: "_models.CassandraViewResource", + options: Optional["_models.CreateUpdateOptions"] = None, ) -> None: ... @overload @@ -2028,73 +2851,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClientEncryptionKeyCreateUpdateParameters(_Model): # pylint: disable=name-too-long - """Parameters to create and update ClientEncryptionKey. +class CassandraViewGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Cassandra view. - :ivar properties: Properties to create and update ClientEncryptionKey. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateProperties + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.CassandraViewGetPropertiesOptions """ - properties: "_models.ClientEncryptionKeyCreateUpdateProperties" = rest_field( + resource: Optional["_models.CassandraViewGetPropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update ClientEncryptionKey. Required.""" - - __flattened_items = ["resource"] - - @overload - def __init__( - self, - *, - properties: "_models.ClientEncryptionKeyCreateUpdateProperties", - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} - super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) - - -class ClientEncryptionKeyCreateUpdateProperties(_Model): # pylint: disable=name-too-long - """Properties to create and update ClientEncryptionKey. - - :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource - """ - - resource: "_models.ClientEncryptionKeyResource" = rest_field( + options: Optional["_models.CassandraViewGetPropertiesOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The standard JSON format of a ClientEncryptionKey. Required.""" @overload def __init__( self, *, - resource: "_models.ClientEncryptionKeyResource", + resource: Optional["_models.CassandraViewGetPropertiesResource"] = None, + options: Optional["_models.CassandraViewGetPropertiesOptions"] = None, ) -> None: ... @overload @@ -2108,22 +2886,22 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClientEncryptionKeyGetProperties(_Model): - """The properties of a ClientEncryptionKey resource. +class CassandraViewGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """CassandraViewGetPropertiesOptions. - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource + :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 """ - resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - @overload def __init__( self, *, - resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, ) -> None: ... @overload @@ -2137,47 +2915,26 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClientEncryptionKeyResource(_Model): - """Cosmos DB client encryption key resource object. +class CassandraViewResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Cassandra view resource object. - :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 """ - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the ClientEncryptionKey.""" - encryption_algorithm: Optional[str] = rest_field( - name="encryptionAlgorithm", visibility=["read", "create", "update", "delete", "query"] - ) - """Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt - data.""" - wrapped_data_encryption_key: Optional[bytes] = rest_field( - name="wrappedDataEncryptionKey", visibility=["read", "create", "update", "delete", "query"], format="base64" - ) - """Wrapped (encrypted) form of the key represented as a byte array.""" - key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = rest_field( - name="keyWrapMetadata", visibility=["read", "create", "update", "delete", "query"] - ) - """Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption - key.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Cassandra view. Required.""" + view_definition: str = rest_field(name="viewDefinition", visibility=["read", "create", "update", "delete", "query"]) + """View Definition of the Cosmos DB Cassandra view. Required.""" @overload 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, + id: str, # pylint: disable=redefined-builtin + view_definition: str, ) -> None: ... @overload @@ -2191,20 +2948,15 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): - """ClientEncryptionKeyGetPropertiesResource. +class CassandraViewGetPropertiesResource( + CassandraViewResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """CassandraViewGetPropertiesResource. - :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 :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. @@ -2226,10 +2978,8 @@ class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): 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, + id: str, # pylint: disable=redefined-builtin + view_definition: str, ) -> None: ... @overload @@ -2243,8 +2993,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClientEncryptionKeyGetResults(ProxyResource): - """Client Encryption Key. +class CassandraViewGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Cassandra view. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -2257,22 +3007,49 @@ class ClientEncryptionKeyGetResults(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: The properties of a ClientEncryptionKey. - :vartype properties: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetProperties + :ivar properties: The properties of an Azure Cosmos DB Cassandra view. + :vartype properties: ~azure.mgmt.cosmosdb.models.CassandraViewGetProperties + :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 """ - properties: Optional["_models.ClientEncryptionKeyGetProperties"] = rest_field( + properties: Optional["_models.CassandraViewGetProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a ClientEncryptionKey.""" + """The properties of an Azure Cosmos DB Cassandra view.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity for the resource.""" - __flattened_items = ["resource"] + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - properties: Optional["_models.ClientEncryptionKeyGetProperties"] = None, + properties: Optional["_models.CassandraViewGetProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -2304,33 +3081,21 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class ClientEncryptionPolicy(_Model): - """Cosmos DB client encryption policy. +class Certificate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Certificate. - :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 + :ivar pem: PEM formatted public key. + :vartype pem: str """ - included_paths: list["_models.ClientEncryptionIncludedPath"] = rest_field( - name="includedPaths", visibility=["read", "create", "update", "delete", "query"] - ) - """Paths of the item that need encryption along with path-specific settings. Required.""" - policy_format_version: int = rest_field( - name="policyFormatVersion", visibility=["read", "create", "update", "delete", "query"] - ) - """Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 - supports id and partition key path encryption. Required.""" + pem: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """PEM formatted public key.""" @overload def __init__( self, *, - included_paths: list["_models.ClientEncryptionIncludedPath"], - policy_format_version: int, + pem: Optional[str] = None, ) -> None: ... @overload @@ -2344,23 +3109,48 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CloudError(_Model): - """An error response from the service. +class ChaosFaultProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A request object to enable/disable the chaos fault. - :ivar error: Error Response. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated + :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 """ - error: Optional["_models.ErrorResponseAutoGenerated"] = rest_field( + action: Optional[Union[str, "_models.SupportedActions"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Error Response.""" + """Indicates whether what action to take for the Chaos Fault. Known values are: \"Enable\" and + \"Disable\".""" + region: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Region of the account where the Chaos Fault is to be enabled/disabled.""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] + ) + """Database name.""" + container_name: Optional[str] = rest_field( + name="containerName", visibility=["read", "create", "update", "delete", "query"] + ) + """Container name.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """A provisioning state of the Chaos Fault.""" @overload def __init__( self, *, - error: Optional["_models.ErrorResponseAutoGenerated"] = None, + action: Optional[Union[str, "_models.SupportedActions"]] = None, + region: Optional[str] = None, + database_name: Optional[str] = None, + container_name: Optional[str] = None, ) -> None: ... @overload @@ -2374,27 +3164,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClusterKey(_Model): - """Cosmos DB Cassandra table cluster key. +class ChaosFaultResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A request object to enable/disable the chaos fault. - :ivar name: Name of the Cosmos DB Cassandra table cluster key. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and - "Desc". - :vartype order_by: 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: A request object to enable/disable the chaos fault. + :vartype properties: ~azure.mgmt.cosmosdb.models.ChaosFaultProperties """ - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB Cassandra table cluster key.""" - order_by: Optional[str] = rest_field(name="orderBy", visibility=["read", "create", "update", "delete", "query"]) - """Order of the Cosmos DB Cassandra table cluster key, only support \"Asc\" and \"Desc\".""" + properties: Optional["_models.ChaosFaultProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A request object to enable/disable the chaos fault.""" + + __flattened_items = ["action", "region", "database_name", "container_name", "provisioning_state"] @overload def __init__( self, *, - name: Optional[str] = None, - order_by: Optional[str] = None, + properties: Optional["_models.ChaosFaultProperties"] = None, ) -> None: ... @overload @@ -2405,64 +3204,64 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class ClusterResource(ProxyResource): - """Representation of a managed Cassandra cluster. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties of a managed Cassandra cluster. - :vartype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties - :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 + +class ClientEncryptionIncludedPath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """. + + :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 """ - properties: Optional["_models.ClusterResourceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Path that needs to be encrypted. Required.""" + client_encryption_key_id: str = rest_field( + name="clientEncryptionKeyId", visibility=["read", "create", "update", "delete", "query"] ) - """Properties of a managed Cassandra cluster.""" - location: Optional[str] = rest_field(visibility=["read", "create", "update"]) - """The location of the resource group to which the resource belongs.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """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\\".""" - identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + """The identifier of the Client Encryption Key to be used to encrypt the path. Required.""" + encryption_type: str = rest_field(name="encryptionType", visibility=["read", "create", "update", "delete", "query"]) + """The type of encryption to be performed. Eg - Deterministic, Randomized. Required.""" + encryption_algorithm: str = rest_field( + name="encryptionAlgorithm", visibility=["read", "create", "update", "delete", "query"] ) - """Identity for the resource.""" + """The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. Required.""" @overload def __init__( self, *, - properties: Optional["_models.ClusterResourceProperties"] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, + path: str, + client_encryption_key_id: str, + encryption_type: str, + encryption_algorithm: str, ) -> None: ... @overload @@ -2476,239 +3275,106 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ClusterResourceProperties(_Model): - """Properties of a managed Cassandra cluster. +class ClientEncryptionKeyCreateUpdateParameters( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Parameters to create and update ClientEncryptionKey. - :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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. - :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 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 + :ivar properties: Properties to create and update ClientEncryptionKey. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateProperties """ - provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read", "create", "update", "delete", "query"] - ) - """The status of the resource at the time the operation was called. Known values are: - \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" - restore_from_backup_id: Optional[str] = rest_field(name="restoreFromBackupId", visibility=["create"]) - """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.""" - delegated_management_subnet_id: Optional[str] = rest_field( - name="delegatedManagementSubnetId", visibility=["read", "create"] - ) - """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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" - cassandra_version: Optional[str] = rest_field( - name="cassandraVersion", visibility=["read", "create", "update", "delete", "query"] - ) - """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.""" - cluster_name_override: Optional[str] = rest_field(name="clusterNameOverride", visibility=["read", "create"]) - """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.""" - authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = rest_field( - name="authenticationMethod", visibility=["read", "create", "update", "delete", "query"] - ) - """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\".""" - initial_cassandra_admin_password: Optional[str] = rest_field( - name="initialCassandraAdminPassword", visibility=["create"] + properties: "_models.ClientEncryptionKeyCreateUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """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'.""" - prometheus_endpoint: Optional["_models.SeedNode"] = rest_field( - name="prometheusEndpoint", visibility=["read", "create", "update", "delete", "query"] + """Properties to create and update ClientEncryptionKey. Required.""" + + __flattened_items = ["resource"] + + @overload + def __init__( + self, + *, + properties: "_models.ClientEncryptionKeyCreateUpdateProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ClientEncryptionKeyCreateUpdateProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Properties to create and update ClientEncryptionKey. + + :ivar resource: The standard JSON format of a ClientEncryptionKey. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyResource + """ + + resource: "_models.ClientEncryptionKeyResource" = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Hostname or IP address where the Prometheus endpoint containing data about the managed - Cassandra nodes can be reached.""" - repair_enabled: Optional[bool] = rest_field( - name="repairEnabled", visibility=["read", "create", "update", "delete", "query"] + """The standard JSON format of a ClientEncryptionKey. Required.""" + + @overload + def __init__( + self, + *, + resource: "_models.ClientEncryptionKeyResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ClientEncryptionKeyGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a ClientEncryptionKey resource. + + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetPropertiesResource + """ + + resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """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.""" - auto_replicate: Optional[Union[str, "_models.AutoReplicate"]] = rest_field( - name="autoReplicate", visibility=["read", "create", "update", "delete", "query"] - ) - """The form of AutoReplicate that is being used by this cluster. Known values are: \"None\", - \"SystemKeyspaces\", and \"AllKeyspaces\".""" - client_certificates: Optional[list["_models.Certificate"]] = rest_field( - name="clientCertificates", visibility=["read", "create", "update", "delete", "query"] - ) - """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.""" - external_gossip_certificates: Optional[list["_models.Certificate"]] = rest_field( - name="externalGossipCertificates", visibility=["read", "create", "update", "delete", "query"] - ) - """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.""" - gossip_certificates: Optional[list["_models.Certificate"]] = rest_field( - name="gossipCertificates", visibility=["read"] - ) - """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.""" - external_seed_nodes: Optional[list["_models.SeedNode"]] = rest_field( - name="externalSeedNodes", visibility=["read", "create", "update", "delete", "query"] - ) - """List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed - node lists of all managed nodes.""" - seed_nodes: Optional[list["_models.SeedNode"]] = rest_field(name="seedNodes", visibility=["read"]) - """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.""" - external_data_centers: Optional[list[str]] = rest_field( - name="externalDataCenters", visibility=["read", "create", "update", "delete", "query"] - ) - """List of the data center names for unmanaged data centers in this cluster to be included in - auto-replication.""" - hours_between_backups: Optional[int] = rest_field( - name="hoursBetweenBackups", visibility=["read", "create", "update", "delete", "query"] - ) - """(Deprecated) Number of hours to wait between taking a backup of the cluster.""" - deallocated: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the cluster and associated data centers has been deallocated.""" - cassandra_audit_logging_enabled: Optional[bool] = rest_field( - name="cassandraAuditLoggingEnabled", visibility=["read", "create", "update", "delete", "query"] - ) - """Whether Cassandra audit logging is enabled.""" - provision_error: Optional["_models.CassandraError"] = rest_field( - name="provisionError", visibility=["read", "create", "update", "delete", "query"] - ) - """Error related to resource provisioning.""" - extensions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Extensions to be added or updated on cluster.""" - backup_schedules: Optional[list["_models.BackupSchedule"]] = rest_field( - name="backupSchedules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of backup schedules that define when you want to back up your data.""" - scheduled_event_strategy: Optional[Union[str, "_models.ScheduledEventStrategy"]] = rest_field( - name="scheduledEventStrategy", visibility=["read", "create", "update", "delete", "query"] - ) - """How the nodes in the cluster react to scheduled events. Known values are: \"Ignore\", - \"StopAny\", and \"StopByRack\".""" - azure_connection_method: Optional[Union[str, "_models.AzureConnectionType"]] = rest_field( - name="azureConnectionMethod", visibility=["read", "create", "update", "delete", "query"] - ) - """How to connect to the azure services needed for running the cluster. Known values are: \"None\" - and \"VPN\".""" - private_link_resource_id: Optional[str] = rest_field(name="privateLinkResourceId", visibility=["read"]) - """If the Connection Method is Vpn, this is the Id of the private link resource that the - datacenters need to connect to.""" @overload 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, - 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, - 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, + resource: Optional["_models.ClientEncryptionKeyGetPropertiesResource"] = None, ) -> None: ... @overload @@ -2722,26 +3388,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Column(_Model): - """Cosmos DB Cassandra table column. +class ClientEncryptionKeyResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB client encryption key resource object. - :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 + :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 """ - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB Cassandra table column.""" - type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Type of the Cosmos DB Cassandra table column.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the ClientEncryptionKey.""" + encryption_algorithm: Optional[str] = rest_field( + name="encryptionAlgorithm", visibility=["read", "create", "update", "delete", "query"] + ) + """Encryption algorithm that will be used along with this client encryption key to encrypt/decrypt + data.""" + wrapped_data_encryption_key: Optional[bytes] = rest_field( + name="wrappedDataEncryptionKey", visibility=["read", "create", "update", "delete", "query"], format="base64" + ) + """Wrapped (encrypted) form of the key represented as a byte array.""" + key_wrap_metadata: Optional["_models.KeyWrapMetadata"] = rest_field( + name="keyWrapMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption + key.""" @overload def __init__( self, *, - name: Optional[str] = None, - type: Optional[str] = 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, ) -> None: ... @overload @@ -2755,23 +3442,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CommandOutput(_Model): - """Response of /command api. +class ClientEncryptionKeyGetPropertiesResource( + ClientEncryptionKeyResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """ClientEncryptionKeyGetPropertiesResource. - :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 + :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 """ - command_output: Optional[str] = rest_field( - name="commandOutput", visibility=["read", "create", "update", "delete", "query"] - ) - """Output of the command.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) + """A system generated property that denotes the last updated timestamp of the resource.""" + etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) + """A system generated property representing the resource etag required for optimistic concurrency + control.""" @overload def __init__( self, *, - command_output: Optional[str] = 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, ) -> None: ... @overload @@ -2785,45 +3496,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CommandPostBody(_Model): - """Specification of which command to run where. +class ClientEncryptionKeyGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Client Encryption Key. - :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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of a ClientEncryptionKey. + :vartype properties: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetProperties """ - command: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The command which should be run. Required.""" - arguments: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The arguments for the command to be run.""" - host: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """IP address of the cassandra host to run the command on. Required.""" - cassandra_stop_start: Optional[bool] = rest_field( - name="cassandra-stop-start", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.ClientEncryptionKeyGetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """If true, stops cassandra before executing the command and then start it again.""" - readwrite: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """If true, allows the command to *write* to the cassandra directory, otherwise read-only.""" + """The properties of a ClientEncryptionKey.""" + + __flattened_items = ["resource"] @overload def __init__( self, *, - command: str, - host: str, - arguments: Optional[dict[str, str]] = None, - cassandra_stop_start: Optional[bool] = None, - readwrite: Optional[bool] = None, + properties: Optional["_models.ClientEncryptionKeyGetProperties"] = None, ) -> None: ... @overload @@ -2834,115 +3536,54 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class CompositePath(_Model): - """CompositePath. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :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 - """ - path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path for which the indexing behavior applies to. Index paths typically start with root and - end with wildcard (/path/*).""" - order: Optional[Union[str, "_models.CompositePathSortOrder"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Sort order for composite paths. Known values are: \"ascending\" and \"descending\".""" +class ClientEncryptionPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB client encryption policy. - @overload - def __init__( - self, - *, - path: Optional[str] = None, - order: Optional[Union[str, "_models.CompositePathSortOrder"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ComputedProperty(_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 - """ - - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of a computed property, for example - \"cp_lowerName\".""" - query: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The query that evaluates the value for computed property, for example - \"SELECT VALUE - LOWER(c.name) FROM c\".""" - - @overload - def __init__( - self, - *, - name: Optional[str] = None, - query: Optional[str] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class ConflictResolutionPolicy(_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 + :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 """ - mode: Optional[Union[str, "_models.ConflictResolutionMode"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the conflict resolution mode. Known values are: \"LastWriterWins\" and \"Custom\".""" - conflict_resolution_path: Optional[str] = rest_field( - name="conflictResolutionPath", visibility=["read", "create", "update", "delete", "query"] + included_paths: list["_models.ClientEncryptionIncludedPath"] = rest_field( + name="includedPaths", visibility=["read", "create", "update", "delete", "query"] ) - """The conflict resolution path in the case of LastWriterWins mode.""" - conflict_resolution_procedure: Optional[str] = rest_field( - name="conflictResolutionProcedure", visibility=["read", "create", "update", "delete", "query"] + """Paths of the item that need encryption along with path-specific settings. Required.""" + policy_format_version: int = rest_field( + name="policyFormatVersion", visibility=["read", "create", "update", "delete", "query"] ) - """The procedure to resolve conflicts in the case of custom mode.""" + """Version of the client encryption policy definition. Supported versions are 1 and 2. Version 2 + supports id and partition key path encryption. Required.""" @overload def __init__( self, *, - mode: Optional[Union[str, "_models.ConflictResolutionMode"]] = None, - conflict_resolution_path: Optional[str] = None, - conflict_resolution_procedure: Optional[str] = None, + included_paths: list["_models.ClientEncryptionIncludedPath"], + policy_format_version: int, ) -> None: ... @overload @@ -2956,47 +3597,23 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ConnectionError(_Model): - """ConnectionError. +class CloudError(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An error response from the service. - :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 error: Error Response. + :vartype error: ~azure.mgmt.cosmosdb.models.ErrorResponseAutoGenerated """ - connection_state: Optional[Union[str, "_models.ConnectionState"]] = rest_field( - name="connectionState", visibility=["read", "create", "update", "delete", "query"] + error: Optional["_models.ErrorResponseAutoGenerated"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The kind of connection error that occurred. Known values are: \"Unknown\", \"OK\", - \"OperatorToDataCenterNetworkError\", \"DatacenterToDatacenterNetworkError\", - \"InternalOperatorToDataCenterCertificateError\", and \"InternalError\".""" - i_p_from: Optional[str] = rest_field(name="iPFrom", visibility=["read", "create", "update", "delete", "query"]) - """The IP of host that originated the failed connection.""" - i_p_to: Optional[str] = rest_field(name="iPTo", visibility=["read", "create", "update", "delete", "query"]) - """The IP that the connection attempted to reach.""" - port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The TCP port the connection was attempted on.""" - exception: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Detailed error message about the failed connection.""" + """Error Response.""" @overload 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, + error: Optional["_models.ErrorResponseAutoGenerated"] = None, ) -> None: ... @overload @@ -3010,49 +3627,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ConsistencyPolicy(_Model): - """The consistency policy for the Cosmos DB database account. +class ClusterKey(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Cassandra table cluster key. - :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 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 """ - default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"] = rest_field( - name="defaultConsistencyLevel", visibility=["read", "create", "update", "delete", "query"] - ) - """The default consistency level and configuration settings of the Cosmos DB account. Required. - Known values are: \"Eventual\", \"Session\", \"BoundedStaleness\", \"Strong\", and - \"ConsistentPrefix\".""" - max_staleness_prefix: Optional[int] = rest_field( - name="maxStalenessPrefix", visibility=["read", "create", "update", "delete", "query"] - ) - """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'.""" - max_interval_in_seconds: Optional[int] = rest_field( - name="maxIntervalInSeconds", visibility=["read", "create", "update", "delete", "query"] - ) - """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'.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Cassandra table cluster key.""" + order_by: Optional[str] = rest_field(name="orderBy", visibility=["read", "create", "update", "delete", "query"]) + """Order of the Cosmos DB Cassandra table cluster key, only support \"Asc\" and \"Desc\".""" @overload def __init__( self, *, - default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], - max_staleness_prefix: Optional[int] = None, - max_interval_in_seconds: Optional[int] = None, + name: Optional[str] = None, + order_by: Optional[str] = None, ) -> None: ... @overload @@ -3066,42 +3661,61 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ContainerPartitionKey(_Model): - """The configuration of the partition key to be used for partitioning data into multiple - partitions. +class ClusterResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Representation of a managed Cassandra cluster. - :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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties of a managed Cassandra cluster. + :vartype properties: ~azure.mgmt.cosmosdb.models.ClusterResourceProperties + :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 """ - paths: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """List of paths using which data within the container can be partitioned.""" - kind: Optional[Union[str, "_models.PartitionKind"]] = rest_field( + properties: Optional["_models.ClusterResourceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """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\".""" - version: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Indicates the version of the partition key definition.""" - system_key: Optional[bool] = rest_field(name="systemKey", visibility=["read"]) - """Indicates if the container is using a system generated partition key.""" + """Properties of a managed Cassandra cluster.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity for the resource.""" @overload def __init__( self, *, - paths: Optional[list[str]] = None, - kind: Optional[Union[str, "_models.PartitionKind"]] = None, - version: Optional[int] = None, + properties: Optional["_models.ClusterResourceProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -3115,23 +3729,248 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ContinuousBackupInformation(_Model): - """Information about the status of continuous backups. - - :ivar latest_restorable_timestamp: The latest restorable timestamp for a resource. - :vartype latest_restorable_timestamp: str - """ - - latest_restorable_timestamp: Optional[str] = rest_field( - name="latestRestorableTimestamp", visibility=["read", "create", "update", "delete", "query"] - ) - """The latest restorable timestamp for a resource.""" +class ClusterResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a managed Cassandra cluster. + + :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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + :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 + """ + + provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the resource at the time the operation was called. Known values are: + \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + restore_from_backup_id: Optional[str] = rest_field(name="restoreFromBackupId", visibility=["create"]) + """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.""" + delegated_management_subnet_id: Optional[str] = rest_field( + name="delegatedManagementSubnetId", visibility=["read", "create"] + ) + """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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" + cassandra_version: Optional[str] = rest_field( + name="cassandraVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + cluster_name_override: Optional[str] = rest_field(name="clusterNameOverride", visibility=["read", "create"]) + """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.""" + authentication_method: Optional[Union[str, "_models.AuthenticationMethod"]] = rest_field( + name="authenticationMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + initial_cassandra_admin_password: Optional[str] = rest_field( + name="initialCassandraAdminPassword", visibility=["create"] + ) + """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'.""" + prometheus_endpoint: Optional["_models.SeedNode"] = rest_field( + name="prometheusEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Hostname or IP address where the Prometheus endpoint containing data about the managed + Cassandra nodes can be reached.""" + repair_enabled: Optional[bool] = rest_field( + name="repairEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + auto_replicate: Optional[Union[str, "_models.AutoReplicate"]] = rest_field( + name="autoReplicate", visibility=["read", "create", "update", "delete", "query"] + ) + """The form of AutoReplicate that is being used by this cluster. Known values are: \"None\", + \"SystemKeyspaces\", and \"AllKeyspaces\".""" + client_certificates: Optional[list["_models.Certificate"]] = rest_field( + name="clientCertificates", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + external_gossip_certificates: Optional[list["_models.Certificate"]] = rest_field( + name="externalGossipCertificates", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + gossip_certificates: Optional[list["_models.Certificate"]] = rest_field( + name="gossipCertificates", visibility=["read"] + ) + """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.""" + external_seed_nodes: Optional[list["_models.SeedNode"]] = rest_field( + name="externalSeedNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IP addresses of seed nodes in unmanaged data centers. These will be added to the seed + node lists of all managed nodes.""" + seed_nodes: Optional[list["_models.SeedNode"]] = rest_field(name="seedNodes", visibility=["read"]) + """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.""" + external_data_centers: Optional[list[str]] = rest_field( + name="externalDataCenters", visibility=["read", "create", "update", "delete", "query"] + ) + """List of the data center names for unmanaged data centers in this cluster to be included in + auto-replication.""" + hours_between_backups: Optional[int] = rest_field( + name="hoursBetweenBackups", visibility=["read", "create", "update", "delete", "query"] + ) + """(Deprecated) Number of hours to wait between taking a backup of the cluster.""" + deallocated: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the cluster and associated data centers has been deallocated.""" + cassandra_audit_logging_enabled: Optional[bool] = rest_field( + name="cassandraAuditLoggingEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether Cassandra audit logging is enabled.""" + cluster_type: Optional[Union[str, "_models.ClusterType"]] = rest_field( + name="clusterType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" + provision_error: Optional["_models.CassandraError"] = rest_field( + name="provisionError", visibility=["read", "create", "update", "delete", "query"] + ) + """Error related to resource provisioning.""" + extensions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Extensions to be added or updated on cluster.""" + backup_schedules: Optional[list["_models.BackupSchedule"]] = rest_field( + name="backupSchedules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of backup schedules that define when you want to back up your data.""" + scheduled_event_strategy: Optional[Union[str, "_models.ScheduledEventStrategy"]] = rest_field( + name="scheduledEventStrategy", visibility=["read", "create", "update", "delete", "query"] + ) + """How the nodes in the cluster react to scheduled events. Known values are: \"Ignore\", + \"StopAny\", and \"StopByRack\".""" + azure_connection_method: Optional[Union[str, "_models.AzureConnectionType"]] = rest_field( + name="azureConnectionMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """How to connect to the azure services needed for running the cluster. Known values are: \"None\" + and \"VPN\".""" + private_link_resource_id: Optional[str] = rest_field(name="privateLinkResourceId", visibility=["read"]) + """If the Connection Method is Vpn, this is the Id of the private link resource that the + datacenters need to connect to.""" @overload - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - latest_restorable_timestamp: Optional[str] = None, + 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, ) -> None: ... @overload @@ -3145,21 +3984,26 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ContinuousBackupRestoreLocation(_Model): - """Properties of the regional restorable account. +class Column(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Cassandra table column. - :ivar location: The name of the continuous backup restore location. - :vartype location: str + :ivar name: Name of the Cosmos DB Cassandra table column. + :vartype name: str + :ivar type: Type of the Cosmos DB Cassandra table column. + :vartype type: str """ - location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of the continuous backup restore location.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Cassandra table column.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Type of the Cosmos DB Cassandra table column.""" @overload def __init__( self, *, - location: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, ) -> None: ... @overload @@ -3173,31 +4017,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ContinuousModeBackupPolicy(BackupPolicy, discriminator="Continuous"): - """The object representing continuous mode backup policy. +class CommandAsyncPostBody(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specification of which command to run where. - :ivar migration_state: The object representing the state of the migration between the backup - policies. - :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :ivar continuous_mode_properties: Configuration values for continuous mode backup. - :vartype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties - :ivar type: Describes the mode of backups. Required. CONTINUOUS. - :vartype type: str or ~azure.mgmt.cosmosdb.models.CONTINUOUS + :ivar command: The command which should be run. Required. + :vartype command: str + :ivar arguments: The arguments for the command to be run. + :vartype arguments: any + :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 """ - continuous_mode_properties: Optional["_models.ContinuousModeProperties"] = rest_field( - name="continuousModeProperties", visibility=["read", "create", "update", "delete", "query"] + command: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command which should be run. Required.""" + arguments: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The arguments for the command to be run.""" + host: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP address of the cassandra host to run the command on. Required.""" + cassandra_stop_start: Optional[bool] = rest_field( + name="cassandra-stop-start", visibility=["read", "create", "update", "delete", "query"] ) - """Configuration values for continuous mode backup.""" - type: Literal[BackupPolicyType.CONTINUOUS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Describes the mode of backups. Required. CONTINUOUS.""" + """If true, stops cassandra before executing the command and then start it again.""" + read_write: Optional[bool] = rest_field( + name="readWrite", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, allows the command to *write* to the cassandra directory, otherwise read-only.""" @overload def __init__( self, *, - migration_state: Optional["_models.BackupPolicyMigrationState"] = None, - continuous_mode_properties: Optional["_models.ContinuousModeProperties"] = None, + command: str, + host: str, + arguments: Optional[Any] = None, + cassandra_stop_start: Optional[bool] = None, + read_write: Optional[bool] = None, ) -> None: ... @overload @@ -3209,28 +4069,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.type = BackupPolicyType.CONTINUOUS # type: ignore -class ContinuousModeProperties(_Model): - """Configuration values for periodic mode backup. +class CommandOutput(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Response of /command api. - :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 + :ivar command_output: Output of the command. + :vartype command_output: str """ - tier: Optional[Union[str, "_models.ContinuousTier"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + command_output: Optional[str] = rest_field( + name="commandOutput", visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate type of Continuos backup mode. Known values are: \"Continuous7Days\" and - \"Continuous30Days\".""" + """Output of the command.""" @overload def __init__( self, *, - tier: Optional[Union[str, "_models.ContinuousTier"]] = None, + command_output: Optional[str] = None, ) -> None: ... @overload @@ -3244,55 +4101,130 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CorsPolicy(_Model): - """The CORS policy for the Cosmos DB database account. +class CommandPostBody(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specification of which command to run where. - :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 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 """ - allowed_origins: str = rest_field(name="allowedOrigins", visibility=["read", "create", "update", "delete", "query"]) - """The origin domains that are permitted to make a request against the service via CORS. Required.""" - allowed_methods: Optional[str] = rest_field( - name="allowedMethods", visibility=["read", "create", "update", "delete", "query"] + command: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command which should be run. Required.""" + arguments: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The arguments for the command to be run.""" + host: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP address of the cassandra host to run the command on. Required.""" + cassandra_stop_start: Optional[bool] = rest_field( + name="cassandra-stop-start", visibility=["read", "create", "update", "delete", "query"] ) - """The methods (HTTP request verbs) that the origin domain may use for a CORS request.""" - allowed_headers: Optional[str] = rest_field( - name="allowedHeaders", visibility=["read", "create", "update", "delete", "query"] + """If true, stops cassandra before executing the command and then start it again.""" + readwrite: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If true, allows the command to *write* to the cassandra directory, otherwise read-only.""" + + @overload + def __init__( + self, + *, + command: str, + host: str, + arguments: Optional[dict[str, str]] = None, + cassandra_stop_start: Optional[bool] = None, + readwrite: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommandPublicResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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: any + :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 + """ + + command: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The command which should be run.""" + command_id: Optional[str] = rest_field(name="commandId", visibility=["read", "create", "update", "delete", "query"]) + """The unique id of command.""" + arguments: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The arguments for the command to be run.""" + host: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP address of the cassandra host to run the command on.""" + is_admin: Optional[bool] = rest_field(name="isAdmin", visibility=["read", "create", "update", "delete", "query"]) + """Whether command has admin privileges.""" + cassandra_stop_start: Optional[bool] = rest_field( + name="cassandraStopStart", visibility=["read", "create", "update", "delete", "query"] ) - """The request headers that the origin domain may specify on the CORS request.""" - exposed_headers: Optional[str] = rest_field( - name="exposedHeaders", visibility=["read", "create", "update", "delete", "query"] + """If true, stops cassandra before executing the command and then start it again.""" + read_write: Optional[bool] = rest_field( + name="readWrite", visibility=["read", "create", "update", "delete", "query"] ) - """The response headers that may be sent in the response to the CORS request and exposed by the - browser to the request issuer.""" - max_age_in_seconds: Optional[int] = rest_field( - name="maxAgeInSeconds", visibility=["read", "create", "update", "delete", "query"] + """If true, allows the command to *write* to the cassandra directory, otherwise read-only.""" + result: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Result output of the command.""" + status: Optional[Union[str, "_models.CommandStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The maximum amount time that a browser should cache the preflight OPTIONS request.""" + """Status of the command. Known values are: \"Done\", \"Running\", \"Enqueue\", \"Processing\", + \"Finished\", and \"Failed\".""" + output_file: Optional[str] = rest_field( + name="outputFile", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the file where the result is written.""" @overload 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, + command: Optional[str] = None, + command_id: Optional[str] = None, + arguments: Optional[Any] = 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, ) -> None: ... @overload @@ -3306,31 +4238,30 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CreateUpdateOptions(_Model): - """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys - are "If-Match", "If-None-Match", "Session-Token" and "Throughput". +class CompositePath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """CompositePath. - :ivar throughput: Request Units per second. For example, "throughput": 10000. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. Note: Either throughput or - autoscaleSettings is required, but not both. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :vartype path: str + :ivar order: Sort order for composite paths. Known values are: "ascending" and "descending". + :vartype order: str or ~azure.mgmt.cosmosdb.models.CompositePathSortOrder """ - throughput: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Request Units per second. For example, \"throughput\": 10000.""" - autoscale_settings: Optional["_models.AutoscaleSettings"] = rest_field( - name="autoscaleSettings", visibility=["read", "create", "update", "delete", "query"] + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path for which the indexing behavior applies to. Index paths typically start with root and + end with wildcard (/path/*).""" + order: Optional[Union[str, "_models.CompositePathSortOrder"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but - not both.""" + """Sort order for composite paths. Known values are: \"ascending\" and \"descending\".""" @overload def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + path: Optional[str] = None, + order: Optional[Union[str, "_models.CompositePathSortOrder"]] = None, ) -> None: ... @overload @@ -3344,120 +4275,75 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DatabaseAccountConnectionString(_Model): - """Connection string for the Cosmos DB account. +class ComputedProperty(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The definition of a computed property. - :ivar connection_string: Value of the connection string. - :vartype connection_string: str - :ivar description: Description of the connection string. - :vartype description: str - :ivar key_kind: Kind of the connection string key. Known values are: "Primary", "Secondary", - "PrimaryReadonly", and "SecondaryReadonly". - :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.Kind - :ivar type: Type of the connection string. Known values are: "Sql", "Table", "MongoDB", - "Cassandra", "CassandraConnectorMetadata", "Gremlin", "SqlDedicatedGateway", "GremlinV2", and - "Undefined". - :vartype type: str or ~azure.mgmt.cosmosdb.models.Type + :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 """ - connection_string: Optional[str] = rest_field(name="connectionString", visibility=["read"]) - """Value of the connection string.""" - description: Optional[str] = rest_field(visibility=["read"]) - """Description of the connection string.""" - key_kind: Optional[Union[str, "_models.Kind"]] = rest_field(name="keyKind", visibility=["read"]) - """Kind of the connection string key. Known values are: \"Primary\", \"Secondary\", - \"PrimaryReadonly\", and \"SecondaryReadonly\".""" - type: Optional[Union[str, "_models.Type"]] = rest_field(visibility=["read"]) - """Type of the connection string. Known values are: \"Sql\", \"Table\", \"MongoDB\", - \"Cassandra\", \"CassandraConnectorMetadata\", \"Gremlin\", \"SqlDedicatedGateway\", - \"GremlinV2\", and \"Undefined\".""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of a computed property, for example - \"cp_lowerName\".""" + query: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The query that evaluates the value for computed property, for example - \"SELECT VALUE + LOWER(c.name) FROM c\".""" + @overload + def __init__( + self, + *, + name: Optional[str] = None, + query: Optional[str] = None, + ) -> None: ... -class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB database accounts. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - :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 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: - :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar properties: Properties to create and update Azure Cosmos DB database accounts. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateProperties - """ + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the type of database account. This can only be set at database account creation. - Known values are: \"GlobalDocumentDB\", \"MongoDB\", and \"Parse\".""" - properties: "_models.DatabaseAccountCreateUpdateProperties" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties to create and update Azure Cosmos DB database accounts. Required.""" - __flattened_items = [ - "consistency_policy", - "locations", - "database_account_offer_type", - "ip_rules", - "is_virtual_network_filter_enabled", - "enable_automatic_failover", - "capabilities", - "virtual_network_rules", - "enable_multiple_write_locations", - "enable_cassandra_connector", - "connector_offer", - "disable_key_based_metadata_write_access", - "key_vault_key_uri", - "default_identity", - "public_network_access", - "enable_free_tier", - "api_properties", - "enable_analytical_storage", - "analytical_storage_configuration", - "create_mode", - "backup_policy", - "cors", - "network_acl_bypass", - "network_acl_bypass_resource_ids", - "disable_local_auth", - "restore_parameters", - "capacity", - "keys_metadata", - "enable_partition_merge", - "enable_burst_capacity", - "minimal_tls_version", - "customer_managed_key_status", - "enable_priority_based_execution", - "default_priority_level", - "enable_per_region_per_partition_autoscale", - "enforce_hierarchical_partition_key_id_last_level", - ] +class ConflictResolutionPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + """ + + mode: Optional[Union[str, "_models.ConflictResolutionMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the conflict resolution mode. Known values are: \"LastWriterWins\" and \"Custom\".""" + conflict_resolution_path: Optional[str] = rest_field( + name="conflictResolutionPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The conflict resolution path in the case of LastWriterWins mode.""" + conflict_resolution_procedure: Optional[str] = rest_field( + name="conflictResolutionProcedure", visibility=["read", "create", "update", "delete", "query"] + ) + """The procedure to resolve conflicts in the case of custom mode.""" @overload def __init__( self, *, - properties: "_models.DatabaseAccountCreateUpdateProperties", - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, + mode: Optional[Union[str, "_models.ConflictResolutionMode"]] = None, + conflict_resolution_path: Optional[str] = None, + conflict_resolution_procedure: Optional[str] = None, ) -> None: ... @overload @@ -3468,325 +4354,155 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) +class ConnectionError(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + """ -class DatabaseAccountCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB database accounts. + connection_state: Optional[Union[str, "_models.ConnectionState"]] = rest_field( + name="connectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of connection error that occurred. Known values are: \"Unknown\", \"OK\", + \"OperatorToDataCenterNetworkError\", \"DatacenterToDatacenterNetworkError\", + \"InternalOperatorToDataCenterCertificateError\", and \"InternalError\".""" + i_p_from: Optional[str] = rest_field(name="iPFrom", visibility=["read", "create", "update", "delete", "query"]) + """The IP of host that originated the failed connection.""" + i_p_to: Optional[str] = rest_field(name="iPTo", visibility=["read", "create", "update", "delete", "query"]) + """The IP that the connection attempted to reach.""" + port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The TCP port the connection was attempted on.""" + exception: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Detailed error message about the failed connection.""" - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB - account. Required. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Required. - Default value is "Standard". - :vartype database_account_offer_type: str - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. "Small" - :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled", "Disabled", and "SecuredByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known - values are: "None" and "AzureServices". - :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :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. - :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 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 - Per-Region Per-partition autoscale Preview feature on the account. - :vartype enable_per_region_per_partition_autoscale: bool - :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of - hierarchical partition key ID last level enforcement on the account. - :vartype enforce_hierarchical_partition_key_id_last_level: bool + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConsistencyPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The consistency policy for the Cosmos DB database account. + + :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 """ - consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( - name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] + default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"] = rest_field( + name="defaultConsistencyLevel", visibility=["read", "create", "update", "delete", "query"] ) - """The consistency policy for the Cosmos DB account.""" - locations: list["_models.Location"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An array that contains the georeplication locations enabled for the Cosmos DB account. - Required.""" - database_account_offer_type: Literal["Standard"] = rest_field( - name="databaseAccountOfferType", visibility=["read", "create", "update", "delete", "query"] - ) - """The offer type for the Cosmos DB database account. Required. Default value is \"Standard\".""" - ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( - name="ipRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of IpRules.""" - is_virtual_network_filter_enabled: Optional[bool] = rest_field( - name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] + """The default consistency level and configuration settings of the Cosmos DB account. Required. + Known values are: \"Eventual\", \"Session\", \"BoundedStaleness\", \"Strong\", and + \"ConsistentPrefix\".""" + max_staleness_prefix: Optional[int] = rest_field( + name="maxStalenessPrefix", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" - enable_automatic_failover: Optional[bool] = rest_field( - name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] + """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'.""" + max_interval_in_seconds: Optional[int] = rest_field( + name="maxIntervalInSeconds", visibility=["read", "create", "update", "delete", "query"] ) - """Enables automatic failover of the write region in the rare event that the region is unavailable - due to an outage. Automatic failover will result in a new write region for the account and is - chosen based on the failover priorities configured for the account.""" - capabilities: Optional[list["_models.Capability"]] = rest_field( + """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'.""" + + @overload + def __init__( + self, + *, + default_consistency_level: Union[str, "_models.DefaultConsistencyLevel"], + max_staleness_prefix: Optional[int] = None, + max_interval_in_seconds: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContainerPartitionKey(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The configuration of the partition key to be used for partitioning data into multiple + partitions. + + :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 + """ + + paths: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of paths using which data within the container can be partitioned.""" + kind: Optional[Union[str, "_models.PartitionKind"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """List of Cosmos DB capabilities for the account.""" - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( - name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of Virtual Network ACL rules configured for the Cosmos DB account.""" - enable_multiple_write_locations: Optional[bool] = rest_field( - name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the account to write in multiple locations.""" - enable_cassandra_connector: Optional[bool] = rest_field( - name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the cassandra connector on the Cosmos DB C* account.""" - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( - name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] - ) - """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" - disable_key_based_metadata_write_access: Optional[bool] = rest_field( - name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Disable write operations on metadata resources (databases, containers, throughput) via account - keys.""" - key_vault_key_uri: Optional[str] = rest_field( - name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] - ) - """The URI of the key vault.""" - default_identity: Optional[str] = rest_field( - name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] - ) - """The default identity for accessing key vault used in features like customer managed keys. The - default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", - \"SystemAssignedIdentity\" and more.""" - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( - name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", - and \"SecuredByPerimeter\".""" - enable_free_tier: Optional[bool] = rest_field( - name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether Free Tier is enabled.""" - api_properties: Optional["_models.ApiProperties"] = rest_field( - name="apiProperties", visibility=["read", "create", "update", "delete", "query"] - ) - """API specific properties. Currently, supported only for MongoDB API.""" - enable_analytical_storage: Optional[bool] = rest_field( - name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether to enable storage analytics.""" - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( - name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical storage specific properties.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" - backup_policy: Optional["_models.BackupPolicy"] = rest_field( - name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The object representing the policy for taking backups on an account.""" - cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The CORS policy for the Cosmos DB database account.""" - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( - name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and - \"AzureServices\".""" - network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( - name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] - ) - """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" - disable_local_auth: Optional[bool] = rest_field( - name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] - ) - """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for - authentication.""" - restore_parameters: Optional["_models.RestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Parameters to indicate the information about the restore.""" - capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The object that represents all properties related to capacity enforcement on an account.""" - keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( - name="keysMetadata", visibility=["read"] - ) - """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.""" - enable_partition_merge: Optional[bool] = rest_field( - name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" - enable_burst_capacity: Optional[bool] = rest_field( - name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( - name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] - ) - """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\".""" - customer_managed_key_status: Optional[str] = rest_field( - name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the status of the Customer Managed Key feature on the account. In case there are - errors, the property provides troubleshooting guidance.""" - enable_priority_based_execution: Optional[bool] = rest_field( - name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" - default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( - name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] - ) - """Enum to indicate default Priority Level of request for Priority Based Execution. Known values - are: \"High\" and \"Low\".""" - enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( - name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on - the account.""" - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( - name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on - the account.""" + """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\".""" + version: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates the version of the partition key definition.""" + system_key: Optional[bool] = rest_field(name="systemKey", visibility=["read"]) + """Indicates if the container is using a system generated partition key.""" @overload - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - locations: list["_models.Location"], - consistency_policy: Optional["_models.ConsistencyPolicy"] = None, - ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - capabilities: Optional[list["_models.Capability"]] = None, - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["_models.ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - backup_policy: Optional["_models.BackupPolicy"] = None, - cors: Optional[list["_models.CorsPolicy"]] = None, - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, - network_acl_bypass_resource_ids: Optional[list[str]] = None, - disable_local_auth: Optional[bool] = None, - restore_parameters: Optional["_models.RestoreParameters"] = None, - capacity: Optional["_models.Capacity"] = None, - enable_partition_merge: Optional[bool] = 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, - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + paths: Optional[list[str]] = None, + kind: Optional[Union[str, "_models.PartitionKind"]] = None, + version: Optional[int] = None, ) -> None: ... @overload @@ -3798,50 +4514,2084 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.database_account_offer_type: Literal["Standard"] = "Standard" -class DatabaseAccountGetProperties(_Model): - """Properties for the database account. +class ContinuousBackupInformation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Information about the status of continuous backups. - :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 - :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Default - value: Standard. Default value is "Standard". - :vartype database_account_offer_type: str - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool + :ivar latest_restorable_timestamp: The latest restorable timestamp for a resource. + :vartype latest_restorable_timestamp: str + """ + + latest_restorable_timestamp: Optional[str] = rest_field( + name="latestRestorableTimestamp", visibility=["read", "create", "update", "delete", "query"] + ) + """The latest restorable timestamp for a resource.""" + + @overload + def __init__( + self, + *, + latest_restorable_timestamp: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContinuousBackupRestoreLocation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of the regional restorable account. + + :ivar location: The name of the continuous backup restore location. + :vartype location: str + """ + + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the continuous backup restore location.""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContinuousModeBackupPolicy( + BackupPolicy, discriminator="Continuous" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """The object representing continuous mode backup policy. + + :ivar migration_state: The object representing the state of the migration between the backup + policies. + :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState + :ivar continuous_mode_properties: Configuration values for continuous mode backup. + :vartype continuous_mode_properties: ~azure.mgmt.cosmosdb.models.ContinuousModeProperties + :ivar type: Describes the mode of backups. Required. CONTINUOUS. + :vartype type: str or ~azure.mgmt.cosmosdb.models.CONTINUOUS + """ + + continuous_mode_properties: Optional["_models.ContinuousModeProperties"] = rest_field( + name="continuousModeProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration values for continuous mode backup.""" + type: Literal[BackupPolicyType.CONTINUOUS] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Describes the mode of backups. Required. CONTINUOUS.""" + + @overload + def __init__( + self, + *, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, + continuous_mode_properties: Optional["_models.ContinuousModeProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type = BackupPolicyType.CONTINUOUS # type: ignore + + +class ContinuousModeProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Configuration values for periodic mode backup. + + :ivar tier: Enum to indicate type of Continuos backup mode. Known values are: + "Continuous7Days", "Continuous30Days", and "Continuous35Days". + :vartype tier: str or ~azure.mgmt.cosmosdb.models.ContinuousTier + """ + + tier: Optional[Union[str, "_models.ContinuousTier"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate type of Continuos backup mode. Known values are: \"Continuous7Days\", + \"Continuous30Days\", and \"Continuous35Days\".""" + + @overload + def __init__( + self, + *, + tier: Optional[Union[str, "_models.ContinuousTier"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CopyJobGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A Cosmos DB Copy Job. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of a Copy Job. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.CopyJobProperties + """ + + properties: "_models.CopyJobProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The properties of a Copy Job. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.CopyJobProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CopyJobProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a Copy Job. + + :ivar job_properties: Job Properties. Required. + :vartype job_properties: ~azure.mgmt.cosmosdb.models.BaseCopyJobProperties + :ivar status: Job Status. Known values are: "Pending", "Partitioning", "Running", "Paused", + "Completed", "Faulted", and "Cancelled". + :vartype status: str or ~azure.mgmt.cosmosdb.models.CopyJobStatus + :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.ErrorResponse + :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.CopyJobMode + """ + + job_properties: "_models.BaseCopyJobProperties" = rest_field( + name="jobProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Job Properties. Required.""" + status: Optional[Union[str, "_models.CopyJobStatus"]] = rest_field(visibility=["read"]) + """Job Status. Known values are: \"Pending\", \"Partitioning\", \"Running\", \"Paused\", + \"Completed\", \"Faulted\", and \"Cancelled\".""" + processed_count: Optional[int] = rest_field(name="processedCount", visibility=["read"]) + """Processed Count.""" + total_count: Optional[int] = rest_field(name="totalCount", visibility=["read"]) + """Total Count.""" + last_updated_utc_time: Optional[datetime.datetime] = rest_field( + name="lastUpdatedUtcTime", visibility=["read"], format="rfc3339" + ) + """Last Updated Time (ISO-8601 format).""" + worker_count: Optional[int] = rest_field( + name="workerCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Worker count.""" + error: Optional["_models.ErrorResponse"] = rest_field(visibility=["read"]) + """Error response for Faulted job.""" + duration: Optional[str] = rest_field(visibility=["read"]) + """Total Duration of Job.""" + mode: Optional[Union[str, "_models.CopyJobMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Mode of job execution. Known values are: \"Offline\" and \"Online\".""" + + @overload + def __init__( + self, + *, + job_properties: "_models.BaseCopyJobProperties", + worker_count: Optional[int] = None, + mode: Optional[Union[str, "_models.CopyJobMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CorsPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The CORS policy for the Cosmos DB database account. + + :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 + """ + + allowed_origins: str = rest_field(name="allowedOrigins", visibility=["read", "create", "update", "delete", "query"]) + """The origin domains that are permitted to make a request against the service via CORS. Required.""" + allowed_methods: Optional[str] = rest_field( + name="allowedMethods", visibility=["read", "create", "update", "delete", "query"] + ) + """The methods (HTTP request verbs) that the origin domain may use for a CORS request.""" + allowed_headers: Optional[str] = rest_field( + name="allowedHeaders", visibility=["read", "create", "update", "delete", "query"] + ) + """The request headers that the origin domain may specify on the CORS request.""" + exposed_headers: Optional[str] = rest_field( + name="exposedHeaders", visibility=["read", "create", "update", "delete", "query"] + ) + """The response headers that may be sent in the response to the CORS request and exposed by the + browser to the request issuer.""" + max_age_in_seconds: Optional[int] = rest_field( + name="maxAgeInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum amount time that a browser should cache the preflight OPTIONS request.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosCassandraDataTransferDataSourceSink( + BaseCosmosDataTransferDataSourceSink, discriminator="CosmosDBCassandra" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """A CosmosDB Cassandra API data source/sink. + + :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 + :ivar component: Required. COSMOS_DB_CASSANDRA. + :vartype component: str or ~azure.mgmt.cosmosdb.models.COSMOS_DB_CASSANDRA + """ + + keyspace_name: str = rest_field(name="keyspaceName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + table_name: str = rest_field(name="tableName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + component: Literal[DataTransferComponent.COSMOS_DB_CASSANDRA] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. COSMOS_DB_CASSANDRA.""" + + @overload + def __init__( + self, + *, + keyspace_name: str, + table_name: str, + remote_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.component = DataTransferComponent.COSMOS_DB_CASSANDRA # type: ignore + + +class CosmosDBCassandraTable(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB Cassandra table. + + :ivar keyspace_name: Azure Cosmos DB for Apache Cassandra keyspace. Required. + :vartype keyspace_name: str + :ivar table_name: Azure Cosmos DB for Apache Cassandra table. Required. + :vartype table_name: str + """ + + keyspace_name: str = rest_field(name="keyspaceName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for Apache Cassandra keyspace. Required.""" + table_name: str = rest_field(name="tableName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for Apache Cassandra table. Required.""" + + @overload + def __init__( + self, + *, + keyspace_name: str, + table_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosDBMongoCollection(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB Mongo collection. + + :ivar database_name: Azure Cosmos DB for MongoDB (RU) database. Required. + :vartype database_name: str + :ivar collection_name: Azure Cosmos DB for MongoDB (RU) collection. Required. + :vartype collection_name: str + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for MongoDB (RU) database. Required.""" + collection_name: str = rest_field(name="collectionName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for MongoDB (RU) collection. Required.""" + + @overload + def __init__( + self, + *, + database_name: str, + collection_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosDBMongoVCoreCollection(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB Mongo vCore collection. + + :ivar database_name: Azure Cosmos DB for MongoDB (vCore) database. Required. + :vartype database_name: str + :ivar collection_name: Azure Cosmos DB for MongoDB (vCore) collection. Required. + :vartype collection_name: str + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for MongoDB (vCore) database. Required.""" + collection_name: str = rest_field(name="collectionName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for MongoDB (vCore) collection. Required.""" + + @overload + def __init__( + self, + *, + database_name: str, + collection_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosDBNoSqlContainer(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB NoSQL container. + + :ivar database_name: Azure Cosmos DB for NoSQL database. Required. + :vartype database_name: str + :ivar container_name: Azure Cosmos DB for NoSQL container. Required. + :vartype container_name: str + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for NoSQL database. Required.""" + container_name: str = rest_field(name="containerName", visibility=["read", "create", "update", "delete", "query"]) + """Azure Cosmos DB for NoSQL container. Required.""" + + @overload + def __init__( + self, + *, + database_name: str, + container_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosDBSourceSinkDetails(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB data source/sink details. + + :ivar remote_account_name: Name of remote account in case of cross-account data transfer. + :vartype remote_account_name: str + """ + + remote_account_name: Optional[str] = rest_field( + name="remoteAccountName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of remote account in case of cross-account data transfer.""" + + @overload + def __init__( + self, + *, + remote_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CosmosMongoDataTransferDataSourceSink( + BaseCosmosDataTransferDataSourceSink, discriminator="CosmosDBMongo" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB Mongo API data source/sink. + + :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 + :ivar component: Required. COSMOS_DB_MONGO. + :vartype component: str or ~azure.mgmt.cosmosdb.models.COSMOS_DB_MONGO + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + collection_name: str = rest_field(name="collectionName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + component: Literal[DataTransferComponent.COSMOS_DB_MONGO] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. COSMOS_DB_MONGO.""" + + @overload + def __init__( + self, + *, + database_name: str, + collection_name: str, + remote_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.component = DataTransferComponent.COSMOS_DB_MONGO # type: ignore + + +class CosmosMongoVCoreDataTransferDataSourceSink( + DataTransferDataSourceSink, discriminator="CosmosDBMongoVCore" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """A CosmosDB Mongo vCore API data source/sink. + + :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 + :ivar component: Required. COSMOS_DB_MONGO_V_CORE. + :vartype component: str or ~azure.mgmt.cosmosdb.models.COSMOS_DB_MONGO_V_CORE + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + collection_name: str = rest_field(name="collectionName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + host_name: Optional[str] = rest_field(name="hostName", visibility=["read", "create", "update", "delete", "query"]) + connection_string_key_vault_uri: Optional[str] = rest_field( + name="connectionStringKeyVaultUri", visibility=["read", "create", "update", "delete", "query"] + ) + component: Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. COSMOS_DB_MONGO_V_CORE.""" + + @overload + def __init__( + self, + *, + database_name: str, + collection_name: str, + host_name: Optional[str] = None, + connection_string_key_vault_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.component = DataTransferComponent.COSMOS_DB_MONGO_V_CORE # type: ignore + + +class CosmosSqlDataTransferDataSourceSink( + BaseCosmosDataTransferDataSourceSink, discriminator="CosmosDBSql" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB No Sql API data source/sink. + + :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 + :ivar component: Required. COSMOS_DB_SQL. + :vartype component: str or ~azure.mgmt.cosmosdb.models.COSMOS_DB_SQL + """ + + database_name: str = rest_field(name="databaseName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + container_name: str = rest_field(name="containerName", visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + component: Literal[DataTransferComponent.COSMOS_DB_SQL] = rest_discriminator(name="component", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. COSMOS_DB_SQL.""" + + @overload + def __init__( + self, + *, + database_name: str, + container_name: str, + remote_account_name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.component = DataTransferComponent.COSMOS_DB_SQL # type: ignore + + +class CreateJobRequest(ARMProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create Data Transfer Job. + + :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 + """ + + properties: "_models.DataTransferJobProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Data Transfer Create Job Properties. Required.""" + + @overload + def __init__( + self, + *, + properties: "_models.DataTransferJobProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CreateUpdateOptions(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys + are "If-Match", "If-None-Match", "Session-Token" and "Throughput". + + :ivar throughput: Request Units per second. For example, "throughput": 10000. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. Note: Either throughput or + autoscaleSettings is required, but not both. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + + throughput: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Request Units per second. For example, \"throughput\": 10000.""" + autoscale_settings: Optional["_models.AutoscaleSettings"] = rest_field( + name="autoscaleSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but + not both.""" + + @overload + def __init__( + self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseAccountConnectionString(_Model): + """Connection string for the Cosmos DB account. + + :ivar connection_string: Value of the connection string. + :vartype connection_string: str + :ivar description: Description of the connection string. + :vartype description: str + :ivar key_kind: Kind of the connection string key. Known values are: "Primary", "Secondary", + "PrimaryReadonly", and "SecondaryReadonly". + :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.Kind + :ivar type: Type of the connection string. Known values are: "Sql", "Table", "MongoDB", + "Cassandra", "CassandraConnectorMetadata", "Gremlin", "SqlDedicatedGateway", "GremlinV2", and + "Undefined". + :vartype type: str or ~azure.mgmt.cosmosdb.models.Type + """ + + connection_string: Optional[str] = rest_field(name="connectionString", visibility=["read"]) + """Value of the connection string.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the connection string.""" + key_kind: Optional[Union[str, "_models.Kind"]] = rest_field(name="keyKind", visibility=["read"]) + """Kind of the connection string key. Known values are: \"Primary\", \"Secondary\", + \"PrimaryReadonly\", and \"SecondaryReadonly\".""" + type: Optional[Union[str, "_models.Type"]] = rest_field(visibility=["read"]) + """Type of the connection string. Known values are: \"Sql\", \"Table\", \"MongoDB\", + \"Cassandra\", \"CassandraConnectorMetadata\", \"Gremlin\", \"SqlDedicatedGateway\", + \"GremlinV2\", and \"Undefined\".""" + + +class DatabaseAccountCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB database accounts. + + :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 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: + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar properties: Properties to create and update Azure Cosmos DB database accounts. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountCreateUpdateProperties + """ + + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the type of database account. This can only be set at database account creation. + Known values are: \"GlobalDocumentDB\", \"MongoDB\", and \"Parse\".""" + properties: "_models.DatabaseAccountCreateUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update Azure Cosmos DB database accounts. Required.""" + + __flattened_items = [ + "consistency_policy", + "locations", + "database_account_offer_type", + "ip_rules", + "is_virtual_network_filter_enabled", + "enable_automatic_failover", + "capabilities", + "virtual_network_rules", + "enable_multiple_write_locations", + "enable_cassandra_connector", + "connector_offer", + "disable_key_based_metadata_write_access", + "key_vault_key_uri", + "default_identity", + "public_network_access", + "enable_free_tier", + "api_properties", + "enable_analytical_storage", + "analytical_storage_configuration", + "create_mode", + "backup_policy", + "cors", + "network_acl_bypass", + "network_acl_bypass_resource_ids", + "diagnostic_log_settings", + "disable_local_auth", + "restore_parameters", + "capacity", + "capacity_mode", + "enable_materialized_views", + "keys_metadata", + "enable_partition_merge", + "enable_burst_capacity", + "minimal_tls_version", + "customer_managed_key_status", + "enable_priority_based_execution", + "default_priority_level", + "enable_per_region_per_partition_autoscale", + "enable_all_versions_and_deletes_change_feed", + "soft_delete_configuration", + "enforce_hierarchical_partition_key_id_last_level", + ] + + @overload + def __init__( + self, + *, + properties: "_models.DatabaseAccountCreateUpdateProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DatabaseAccountCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB database accounts. + + :ivar consistency_policy: The consistency policy for the Cosmos DB account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB + account. Required. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Required. + Default value is "Standard". + :vartype database_account_offer_type: str + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool + :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :vartype enable_automatic_failover: bool + :ivar capabilities: List of Cosmos DB capabilities for the account. + :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. + :vartype enable_multiple_write_locations: bool + :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enable_cassandra_connector: bool + :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. "Small" + :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + (databases, containers, throughput) via account keys. + :vartype disable_key_based_metadata_write_access: bool + :ivar key_vault_key_uri: The URI of the key vault. + :vartype key_vault_key_uri: str + :ivar default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :vartype default_identity: str + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. + :vartype enable_free_tier: bool + :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. + :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :vartype enable_analytical_storage: bool + :ivar analytical_storage_configuration: Analytical storage specific properties. + :vartype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar backup_policy: The object representing the policy for taking backups on an account. + :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :ivar cors: The CORS policy for the Cosmos DB database account. + :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + values are: "None" and "AzureServices". + :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :vartype network_acl_bypass_resource_ids: list[str] + :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings + for the Cosmos DB Account. + :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :ivar capacity: The object that represents all properties related to capacity enforcement on an + account. + :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity + :ivar 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. + :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 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 + Per-Region Per-partition autoscale Preview feature on the account. + :vartype enable_per_region_per_partition_autoscale: bool + :ivar enable_all_versions_and_deletes_change_feed: Flag to indicate if All Versions and Deletes + Change feed feature is enabled on the account. + :vartype enable_all_versions_and_deletes_change_feed: bool + :ivar soft_delete_configuration: The configuration for soft delete on the Cosmos DB account. + :vartype soft_delete_configuration: ~azure.mgmt.cosmosdb.models.SoftDeleteConfiguration + :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of + hierarchical partition key ID last level enforcement on the account. + :vartype enforce_hierarchical_partition_key_id_last_level: bool + """ + + consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( + name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The consistency policy for the Cosmos DB account.""" + locations: list["_models.Location"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An array that contains the georeplication locations enabled for the Cosmos DB account. + Required.""" + database_account_offer_type: Literal["Standard"] = rest_field( + name="databaseAccountOfferType", visibility=["read", "create", "update", "delete", "query"] + ) + """The offer type for the Cosmos DB database account. Required. Default value is \"Standard\".""" + ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IpRules.""" + is_virtual_network_filter_enabled: Optional[bool] = rest_field( + name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" + enable_automatic_failover: Optional[bool] = rest_field( + name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables automatic failover of the write region in the rare event that the region is unavailable + due to an outage. Automatic failover will result in a new write region for the account and is + chosen based on the failover priorities configured for the account.""" + capabilities: Optional[list["_models.Capability"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of Cosmos DB capabilities for the account.""" + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( + name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Virtual Network ACL rules configured for the Cosmos DB account.""" + enable_multiple_write_locations: Optional[bool] = rest_field( + name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the account to write in multiple locations.""" + enable_cassandra_connector: Optional[bool] = rest_field( + name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the cassandra connector on the Cosmos DB C* account.""" + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( + name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] + ) + """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" + disable_key_based_metadata_write_access: Optional[bool] = rest_field( + name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable write operations on metadata resources (databases, containers, throughput) via account + keys.""" + key_vault_key_uri: Optional[str] = rest_field( + name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of the key vault.""" + default_identity: Optional[str] = rest_field( + name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The default identity for accessing key vault used in features like customer managed keys. The + default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", + \"SystemAssignedIdentity\" and more.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", + and \"SecuredByPerimeter\".""" + enable_free_tier: Optional[bool] = rest_field( + name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether Free Tier is enabled.""" + api_properties: Optional["_models.ApiProperties"] = rest_field( + name="apiProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """API specific properties. Currently, supported only for MongoDB API.""" + enable_analytical_storage: Optional[bool] = rest_field( + name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable storage analytics.""" + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( + name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical storage specific properties.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + backup_policy: Optional["_models.BackupPolicy"] = rest_field( + name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The object representing the policy for taking backups on an account.""" + cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The CORS policy for the Cosmos DB database account.""" + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( + name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and + \"AzureServices\".""" + network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( + name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = rest_field( + name="diagnosticLogSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The Object representing the different Diagnostic log settings for the Cosmos DB Account.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for + authentication.""" + restore_parameters: Optional["_models.RestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters to indicate the information about the restore.""" + capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object that represents all properties related to capacity enforcement on an account.""" + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = rest_field( + name="capacityMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the capacityMode of the Cosmos DB account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + enable_materialized_views: Optional[bool] = rest_field( + name="enableMaterializedViews", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable MaterializedViews on the Cosmos DB account.""" + keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( + name="keysMetadata", visibility=["read"] + ) + """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.""" + enable_partition_merge: Optional[bool] = rest_field( + name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" + enable_burst_capacity: Optional[bool] = rest_field( + name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( + name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + customer_managed_key_status: Optional[str] = rest_field( + name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the status of the Customer Managed Key feature on the account. In case there are + errors, the property provides troubleshooting guidance.""" + enable_priority_based_execution: Optional[bool] = rest_field( + name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( + name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate default Priority Level of request for Priority Based Execution. Known values + are: \"High\" and \"Low\".""" + enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( + name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on + the account.""" + enable_all_versions_and_deletes_change_feed: Optional[bool] = rest_field( + name="enableAllVersionsAndDeletesChangeFeed", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate if All Versions and Deletes Change feed feature is enabled on the account.""" + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = rest_field( + name="softDeleteConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for soft delete on the Cosmos DB account.""" + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( + name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on + the account.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + locations: list["_models.Location"], + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + capabilities: Optional[list["_models.Capability"]] = None, + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[list["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[list[str]] = None, + 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, + 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, + enable_all_versions_and_deletes_change_feed: Optional[bool] = None, + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = None, + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.database_account_offer_type: Literal["Standard"] = "Standard" + + +class DatabaseAccountGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties for the database account. + + :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 + :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Default + value: Standard. Default value is "Standard". + :vartype database_account_offer_type: str + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool + :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare + event that the region is unavailable due to an outage. Automatic failover will result in a new + write region for the account and is chosen based on the failover priorities configured for the + account. + :vartype enable_automatic_failover: bool + :ivar consistency_policy: The consistency policy for the Cosmos DB database account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar capabilities: List of Cosmos DB capabilities for the account. + :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] + :ivar write_locations: An array that contains the write location for the Cosmos DB account. + :vartype write_locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar read_locations: An array that contains of the read locations enabled for the Cosmos DB + account. + :vartype read_locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar locations: An array that contains all of the locations enabled for the Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar failover_policies: An array that contains the regions ordered by their failover + priorities. + :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] + :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + account. + :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] + :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the + Cosmos DB account. + :vartype private_endpoint_connections: + list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. + :vartype enable_multiple_write_locations: bool + :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enable_cassandra_connector: bool + :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* + account. "Small" + :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer + :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + (databases, containers, throughput) via account keys. + :vartype disable_key_based_metadata_write_access: bool + :ivar key_vault_key_uri: The URI of the key vault. + :vartype key_vault_key_uri: str + :ivar default_identity: The default identity for accessing key vault used in features like + customer managed keys. The default identity needs to be explicitly set by the users. It can be + "FirstPartyIdentity", "SystemAssignedIdentity" and more. + :vartype default_identity: str + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess + :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. + :vartype enable_free_tier: bool + :ivar api_properties: API specific properties. + :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties + :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. + :vartype enable_analytical_storage: bool + :ivar analytical_storage_configuration: Analytical storage specific properties. + :vartype analytical_storage_configuration: + ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration + :ivar instance_id: A unique identifier assigned to the database account. + :vartype instance_id: str + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar restore_parameters: Parameters to indicate the information about the restore. + :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters + :ivar backup_policy: The object representing the policy for taking backups on an account. + :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy + :ivar cors: The CORS policy for the Cosmos DB database account. + :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] + :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + values are: "None" and "AzureServices". + :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass + :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + Bypass for the Cosmos DB account. + :vartype network_acl_bypass_resource_ids: list[str] + :ivar diagnostic_log_settings: The Object representing the different Diagnostic log settings + for the Cosmos DB Account. + :vartype diagnostic_log_settings: ~azure.mgmt.cosmosdb.models.DiagnosticLogSettings + :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be + used exclusively for authentication. + :vartype disable_local_auth: bool + :ivar capacity: The object that represents all properties related to capacity enforcement on an + account. + :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity + :ivar 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 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 key_vault_key_uri_version: The version of the Customer Managed Key currently being used + by the account. + :vartype key_vault_key_uri_version: 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 + Per-Region Per-partition autoscale Preview feature on the account. + :vartype enable_per_region_per_partition_autoscale: bool + :ivar enable_all_versions_and_deletes_change_feed: Flag to indicate if All Versions and Deletes + Change feed feature is enabled on the account. + :vartype enable_all_versions_and_deletes_change_feed: bool + :ivar soft_delete_configuration: The configuration for soft delete on the Cosmos DB account. + :vartype soft_delete_configuration: ~azure.mgmt.cosmosdb.models.SoftDeleteConfiguration + :ivar throughput_pool_dedicated_r_us: Total dedicated throughput (RU/s) for database account. + Represents the sum of all manual provisioned throughput and all autoscale max RU/s across all + shared throughput databases and dedicated throughput containers in the account for 1 region. + READ ONLY. + :vartype throughput_pool_dedicated_r_us: int + :ivar throughput_pool_max_consumable_r_us: When this account is part of a fleetspace with + throughput pooling enabled, this is the maximum additional throughput (RU/s) that can be + consumed from the pool, summed across all shared throughput databases and dedicated throughput + containers in the account for 1 region. READ ONLY. + :vartype throughput_pool_max_consumable_r_us: int + :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of + hierarchical partition key ID last level enforcement on the account. + :vartype enforce_hierarchical_partition_key_id_last_level: bool + """ + + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state of the resource.""" + document_endpoint: Optional[str] = rest_field(name="documentEndpoint", visibility=["read"]) + """The connection endpoint for the Cosmos DB database account.""" + database_account_offer_type: Optional[Literal["Standard"]] = rest_field( + name="databaseAccountOfferType", visibility=["read"] + ) + """The offer type for the Cosmos DB database account. Default value: Standard. Default value is + \"Standard\".""" + ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IpRules.""" + is_virtual_network_filter_enabled: Optional[bool] = rest_field( + name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" + enable_automatic_failover: Optional[bool] = rest_field( + name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables automatic failover of the write region in the rare event that the region is unavailable + due to an outage. Automatic failover will result in a new write region for the account and is + chosen based on the failover priorities configured for the account.""" + consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( + name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The consistency policy for the Cosmos DB database account.""" + capabilities: Optional[list["_models.Capability"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of Cosmos DB capabilities for the account.""" + write_locations: Optional[list["_models.Location"]] = rest_field(name="writeLocations", visibility=["read"]) + """An array that contains the write location for the Cosmos DB account.""" + read_locations: Optional[list["_models.Location"]] = rest_field(name="readLocations", visibility=["read"]) + """An array that contains of the read locations enabled for the Cosmos DB account.""" + locations: Optional[list["_models.Location"]] = rest_field(visibility=["read"]) + """An array that contains all of the locations enabled for the Cosmos DB account.""" + failover_policies: Optional[list["_models.FailoverPolicy"]] = rest_field( + name="failoverPolicies", visibility=["read"] + ) + """An array that contains the regions ordered by their failover priorities.""" + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( + name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Virtual Network ACL rules configured for the Cosmos DB account.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of Private Endpoint Connections configured for the Cosmos DB account.""" + enable_multiple_write_locations: Optional[bool] = rest_field( + name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the account to write in multiple locations.""" + enable_cassandra_connector: Optional[bool] = rest_field( + name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the cassandra connector on the Cosmos DB C* account.""" + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( + name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] + ) + """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" + disable_key_based_metadata_write_access: Optional[bool] = rest_field( + name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable write operations on metadata resources (databases, containers, throughput) via account + keys.""" + key_vault_key_uri: Optional[str] = rest_field( + name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of the key vault.""" + default_identity: Optional[str] = rest_field( + name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The default identity for accessing key vault used in features like customer managed keys. The + default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", + \"SystemAssignedIdentity\" and more.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", + and \"SecuredByPerimeter\".""" + enable_free_tier: Optional[bool] = rest_field( + name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether Free Tier is enabled.""" + api_properties: Optional["_models.ApiProperties"] = rest_field( + name="apiProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """API specific properties.""" + enable_analytical_storage: Optional[bool] = rest_field( + name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable storage analytics.""" + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( + name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical storage specific properties.""" + instance_id: Optional[str] = rest_field(name="instanceId", visibility=["read"]) + """A unique identifier assigned to the database account.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + restore_parameters: Optional["_models.RestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters to indicate the information about the restore.""" + backup_policy: Optional["_models.BackupPolicy"] = rest_field( + name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The object representing the policy for taking backups on an account.""" + cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The CORS policy for the Cosmos DB database account.""" + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( + name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and + \"AzureServices\".""" + network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( + name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = rest_field( + name="diagnosticLogSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The Object representing the different Diagnostic log settings for the Cosmos DB Account.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for + authentication.""" + capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object that represents all properties related to capacity enforcement on an account.""" + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = rest_field( + name="capacityMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the capacityMode of the Cosmos DB account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + capacity_mode_change_transition_state: Optional["_models.CapacityModeChangeTransitionState"] = rest_field( + name="capacityModeChangeTransitionState", visibility=["read", "create", "update", "delete", "query"] + ) + """The object that represents the migration state for the CapacityMode of the Cosmos DB account.""" + enable_materialized_views: Optional[bool] = rest_field( + name="enableMaterializedViews", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable MaterializedViews on the Cosmos DB account.""" + keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( + name="keysMetadata", visibility=["read"] + ) + """The object that represents the metadata for the Account Keys of the Cosmos DB account.""" + enable_partition_merge: Optional[bool] = rest_field( + name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" + enable_burst_capacity: Optional[bool] = rest_field( + name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( + name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + customer_managed_key_status: Optional[str] = rest_field( + name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the status of the Customer Managed Key feature on the account. In case there are + errors, the property provides troubleshooting guidance.""" + key_vault_key_uri_version: Optional[str] = rest_field(name="keyVaultKeyUriVersion", visibility=["read"]) + """The version of the Customer Managed Key currently being used by the account.""" + enable_priority_based_execution: Optional[bool] = rest_field( + name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( + name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate default Priority Level of request for Priority Based Execution. Known values + are: \"High\" and \"Low\".""" + enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( + name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on + the account.""" + enable_all_versions_and_deletes_change_feed: Optional[bool] = rest_field( + name="enableAllVersionsAndDeletesChangeFeed", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate if All Versions and Deletes Change feed feature is enabled on the account.""" + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = rest_field( + name="softDeleteConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for soft delete on the Cosmos DB account.""" + throughput_pool_dedicated_r_us: Optional[int] = rest_field( + name="throughputPoolDedicatedRUs", visibility=["read", "create", "update", "delete", "query"] + ) + """Total dedicated throughput (RU/s) for database account. Represents the sum of all manual + provisioned throughput and all autoscale max RU/s across all shared throughput databases and + dedicated throughput containers in the account for 1 region. READ ONLY.""" + throughput_pool_max_consumable_r_us: Optional[int] = rest_field( + name="throughputPoolMaxConsumableRUs", visibility=["read", "create", "update", "delete", "query"] + ) + """When this account is part of a fleetspace with throughput pooling enabled, this is the maximum + additional throughput (RU/s) that can be consumed from the pool, summed across all shared + throughput databases and dedicated throughput containers in the account for 1 region. READ + ONLY.""" + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( + name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on + the account.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + capabilities: Optional[list["_models.Capability"]] = None, + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + restore_parameters: Optional["_models.RestoreParameters"] = None, + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[list["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[list[str]] = None, + 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, + 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, + enable_all_versions_and_deletes_change_feed: Optional[bool] = None, + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = None, + throughput_pool_dedicated_r_us: Optional[int] = None, + throughput_pool_max_consumable_r_us: Optional[int] = None, + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseAccountGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB database account. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties for the database account. + :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetProperties + :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 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 + """ + + properties: Optional["_models.DatabaseAccountGetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties for the database account.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity for the resource.""" + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the type of database account. This can only be set at database account creation. + Known values are: \"GlobalDocumentDB\", \"MongoDB\", and \"Parse\".""" + + __flattened_items = [ + "provisioning_state", + "document_endpoint", + "database_account_offer_type", + "ip_rules", + "is_virtual_network_filter_enabled", + "enable_automatic_failover", + "consistency_policy", + "capabilities", + "write_locations", + "read_locations", + "locations", + "failover_policies", + "virtual_network_rules", + "private_endpoint_connections", + "enable_multiple_write_locations", + "enable_cassandra_connector", + "connector_offer", + "disable_key_based_metadata_write_access", + "key_vault_key_uri", + "default_identity", + "public_network_access", + "enable_free_tier", + "api_properties", + "enable_analytical_storage", + "analytical_storage_configuration", + "instance_id", + "create_mode", + "restore_parameters", + "backup_policy", + "cors", + "network_acl_bypass", + "network_acl_bypass_resource_ids", + "diagnostic_log_settings", + "disable_local_auth", + "capacity", + "capacity_mode", + "capacity_mode_change_transition_state", + "enable_materialized_views", + "keys_metadata", + "enable_partition_merge", + "enable_burst_capacity", + "minimal_tls_version", + "customer_managed_key_status", + "key_vault_key_uri_version", + "enable_priority_based_execution", + "default_priority_level", + "enable_per_region_per_partition_autoscale", + "enable_all_versions_and_deletes_change_feed", + "soft_delete_configuration", + "throughput_pool_dedicated_r_us", + "throughput_pool_max_consumable_r_us", + "enforce_hierarchical_partition_key_id_last_level", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DatabaseAccountGetProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DatabaseAccountKeysMetadata(_Model): + """The metadata related to each access key for the given Cosmos DB database account. + + :ivar primary_master_key: The metadata related to the Primary Read-Write Key for the given + Cosmos DB database account. + :vartype primary_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata + :ivar secondary_master_key: The metadata related to the Secondary Read-Write Key for the given + Cosmos DB database account. + :vartype secondary_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata + :ivar primary_readonly_master_key: The metadata related to the Primary Read-Only Key for the + given Cosmos DB database account. + :vartype primary_readonly_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata + :ivar secondary_readonly_master_key: The metadata related to the Secondary Read-Only Key for + the given Cosmos DB database account. + :vartype secondary_readonly_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata + """ + + primary_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( + name="primaryMasterKey", visibility=["read"] + ) + """The metadata related to the Primary Read-Write Key for the given Cosmos DB database account.""" + secondary_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( + name="secondaryMasterKey", visibility=["read"] + ) + """The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account.""" + primary_readonly_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( + name="primaryReadonlyMasterKey", visibility=["read"] + ) + """The metadata related to the Primary Read-Only Key for the given Cosmos DB database account.""" + secondary_readonly_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( + name="secondaryReadonlyMasterKey", visibility=["read"] + ) + """The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account.""" + + +class DatabaseAccountListConnectionStringsResult( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """The connection strings for the given database account. + + :ivar connection_strings: An array that contains the connection strings for the Cosmos DB + account. + :vartype connection_strings: list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] + """ + + connection_strings: Optional[list["_models.DatabaseAccountConnectionString"]] = rest_field( + name="connectionStrings", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the connection strings for the Cosmos DB account.""" + + @overload + def __init__( + self, + *, + connection_strings: Optional[list["_models.DatabaseAccountConnectionString"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseAccountListReadOnlyKeysResult(_Model): + """The read-only access keys for the given database account. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. + :vartype secondary_readonly_master_key: str + """ + + primary_readonly_master_key: Optional[str] = rest_field(name="primaryReadonlyMasterKey", visibility=["read"]) + """Base 64 encoded value of the primary read-only key.""" + secondary_readonly_master_key: Optional[str] = rest_field(name="secondaryReadonlyMasterKey", visibility=["read"]) + """Base 64 encoded value of the secondary read-only key.""" + + +class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): + """The access keys for the given database account. + + :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. + :vartype primary_readonly_master_key: str + :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. + :vartype secondary_readonly_master_key: str + :ivar primary_master_key: Base 64 encoded value of the primary read-write key. + :vartype primary_master_key: str + :ivar secondary_master_key: Base 64 encoded value of the secondary read-write key. + :vartype secondary_master_key: str + """ + + primary_master_key: Optional[str] = rest_field(name="primaryMasterKey", visibility=["read"]) + """Base 64 encoded value of the primary read-write key.""" + secondary_master_key: Optional[str] = rest_field(name="secondaryMasterKey", visibility=["read"]) + """Base 64 encoded value of the secondary read-write key.""" + + +class DatabaseAccountRegenerateKeyParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to regenerate the keys within the database account. + + :ivar key_kind: The access key to regenerate. Required. Known values are: "primary", + "secondary", "primaryReadonly", and "secondaryReadonly". + :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind + :ivar skip_account_keys_last_usage_check: Optional flag indicating whether to skip account keys + last usage check. + :vartype skip_account_keys_last_usage_check: bool + """ + + key_kind: Union[str, "_models.KeyKind"] = rest_field( + name="keyKind", visibility=["read", "create", "update", "delete", "query"] + ) + """The access key to regenerate. Required. Known values are: \"primary\", \"secondary\", + \"primaryReadonly\", and \"secondaryReadonly\".""" + skip_account_keys_last_usage_check: Optional[bool] = rest_field( + name="skipAccountKeysLastUsageCheck", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional flag indicating whether to skip account keys last usage check.""" + + @overload + def __init__( + self, + *, + key_kind: Union[str, "_models.KeyKind"], + skip_account_keys_last_usage_check: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseAccountUpdateParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters for patching Azure Cosmos DB database account properties. + + :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 location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity + :ivar properties: Properties to update Azure Cosmos DB database accounts. + :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\".""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The location of the resource group to which the resource belongs.""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity for the resource.""" + properties: Optional["_models.DatabaseAccountUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to update Azure Cosmos DB database accounts.""" + + __flattened_items = [ + "consistency_policy", + "locations", + "ip_rules", + "is_virtual_network_filter_enabled", + "enable_automatic_failover", + "capabilities", + "virtual_network_rules", + "enable_multiple_write_locations", + "enable_cassandra_connector", + "connector_offer", + "disable_key_based_metadata_write_access", + "key_vault_key_uri", + "default_identity", + "public_network_access", + "enable_free_tier", + "api_properties", + "enable_analytical_storage", + "analytical_storage_configuration", + "backup_policy", + "cors", + "network_acl_bypass", + "network_acl_bypass_resource_ids", + "diagnostic_log_settings", + "disable_local_auth", + "capacity", + "capacity_mode", + "enable_materialized_views", + "keys_metadata", + "enable_partition_merge", + "enable_burst_capacity", + "minimal_tls_version", + "customer_managed_key_status", + "enable_priority_based_execution", + "default_priority_level", + "enable_per_region_per_partition_autoscale", + "enable_all_versions_and_deletes_change_feed", + "soft_delete_configuration", + "enforce_hierarchical_partition_key_id_last_level", + ] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + location: Optional[str] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.DatabaseAccountUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DatabaseAccountUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to update Azure Cosmos DB database accounts. + + :ivar consistency_policy: The consistency policy for the Cosmos DB account. + :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy + :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB + account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar ip_rules: List of IpRules. + :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] + :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual + Network ACL rules. + :vartype is_virtual_network_filter_enabled: bool :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. :vartype enable_automatic_failover: bool - :ivar consistency_policy: The consistency policy for the Cosmos DB database account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy :ivar capabilities: List of Cosmos DB capabilities for the account. :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar write_locations: An array that contains the write location for the Cosmos DB account. - :vartype write_locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar read_locations: An array that contains of the read locations enabled for the Cosmos DB - account. - :vartype read_locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar locations: An array that contains all of the locations enabled for the Cosmos DB account. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar failover_policies: An array that contains the regions ordered by their failover - priorities. - :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB account. :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the - Cosmos DB account. - :vartype private_endpoint_connections: - list[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. :vartype enable_multiple_write_locations: bool :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. @@ -3863,20 +6613,13 @@ class DatabaseAccountGetProperties(_Model): :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. + :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. :vartype enable_analytical_storage: bool :ivar analytical_storage_configuration: Analytical storage specific properties. :vartype analytical_storage_configuration: ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar instance_id: A unique identifier assigned to the database account. - :vartype instance_id: str - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: ~azure.mgmt.cosmosdb.models.RestoreParameters :ivar backup_policy: The object representing the policy for taking backups on an account. :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy :ivar cors: The CORS policy for the Cosmos DB database account. @@ -3887,14 +6630,23 @@ class DatabaseAccountGetProperties(_Model): :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 keys_metadata: The object that represents the metadata for the Account Keys of the Cosmos - DB account. + :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. @@ -3909,9 +6661,6 @@ class DatabaseAccountGetProperties(_Model): :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 key_vault_key_uri_version: The version of the Customer Managed Key currently being used - by the account. - :vartype key_vault_key_uri_version: 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 @@ -3921,221 +6670,2419 @@ class DatabaseAccountGetProperties(_Model): :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account. :vartype enable_per_region_per_partition_autoscale: bool + :ivar enable_all_versions_and_deletes_change_feed: Flag to indicate if All Versions and Deletes + Change feed feature is enabled on the account. + :vartype enable_all_versions_and_deletes_change_feed: bool + :ivar soft_delete_configuration: The configuration for soft delete on the Cosmos DB account. + :vartype soft_delete_configuration: ~azure.mgmt.cosmosdb.models.SoftDeleteConfiguration :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. :vartype enforce_hierarchical_partition_key_id_last_level: bool """ - provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) - """The provisioning state of the resource.""" - document_endpoint: Optional[str] = rest_field(name="documentEndpoint", visibility=["read"]) - """The connection endpoint for the Cosmos DB database account.""" - database_account_offer_type: Optional[Literal["Standard"]] = rest_field( - name="databaseAccountOfferType", visibility=["read"] - ) - """The offer type for the Cosmos DB database account. Default value: Standard. Default value is - \"Standard\".""" - ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( - name="ipRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of IpRules.""" - is_virtual_network_filter_enabled: Optional[bool] = rest_field( - name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" - enable_automatic_failover: Optional[bool] = rest_field( - name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] + consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( + name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The consistency policy for the Cosmos DB account.""" + locations: Optional[list["_models.Location"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the georeplication locations enabled for the Cosmos DB account.""" + ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of IpRules.""" + is_virtual_network_filter_enabled: Optional[bool] = rest_field( + name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" + enable_automatic_failover: Optional[bool] = rest_field( + name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables automatic failover of the write region in the rare event that the region is unavailable + due to an outage. Automatic failover will result in a new write region for the account and is + chosen based on the failover priorities configured for the account.""" + capabilities: Optional[list["_models.Capability"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of Cosmos DB capabilities for the account.""" + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( + name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Virtual Network ACL rules configured for the Cosmos DB account.""" + enable_multiple_write_locations: Optional[bool] = rest_field( + name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the account to write in multiple locations.""" + enable_cassandra_connector: Optional[bool] = rest_field( + name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables the cassandra connector on the Cosmos DB C* account.""" + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( + name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] + ) + """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" + disable_key_based_metadata_write_access: Optional[bool] = rest_field( + name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable write operations on metadata resources (databases, containers, throughput) via account + keys.""" + key_vault_key_uri: Optional[str] = rest_field( + name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of the key vault.""" + default_identity: Optional[str] = rest_field( + name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The default identity for accessing key vault used in features like customer managed keys. The + default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", + \"SystemAssignedIdentity\" and more.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", + and \"SecuredByPerimeter\".""" + enable_free_tier: Optional[bool] = rest_field( + name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether Free Tier is enabled.""" + api_properties: Optional["_models.ApiProperties"] = rest_field( + name="apiProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """API specific properties. Currently, supported only for MongoDB API.""" + enable_analytical_storage: Optional[bool] = rest_field( + name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable storage analytics.""" + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( + name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical storage specific properties.""" + backup_policy: Optional["_models.BackupPolicy"] = rest_field( + name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The object representing the policy for taking backups on an account.""" + cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The CORS policy for the Cosmos DB database account.""" + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( + name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and + \"AzureServices\".""" + network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( + name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" + diagnostic_log_settings: Optional["_models.DiagnosticLogSettings"] = rest_field( + name="diagnosticLogSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The Object representing the different Diagnostic log settings for the Cosmos DB Account.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for + authentication.""" + capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The object that represents all properties related to capacity enforcement on an account.""" + capacity_mode: Optional[Union[str, "_models.CapacityMode"]] = rest_field( + name="capacityMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the capacityMode of the Cosmos DB account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + enable_materialized_views: Optional[bool] = rest_field( + name="enableMaterializedViews", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether to enable MaterializedViews on the Cosmos DB account.""" + keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( + name="keysMetadata", visibility=["read"] + ) + """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.""" + enable_partition_merge: Optional[bool] = rest_field( + name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" + enable_burst_capacity: Optional[bool] = rest_field( + name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" + minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( + name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """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\".""" + customer_managed_key_status: Optional[str] = rest_field( + name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the status of the Customer Managed Key feature on the account. In case there are + errors, the property provides troubleshooting guidance.""" + enable_priority_based_execution: Optional[bool] = rest_field( + name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" + default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( + name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate default Priority Level of request for Priority Based Execution. Known values + are: \"High\" and \"Low\".""" + enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( + name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on + the account.""" + enable_all_versions_and_deletes_change_feed: Optional[bool] = rest_field( + name="enableAllVersionsAndDeletesChangeFeed", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate if All Versions and Deletes Change feed feature is enabled on the account.""" + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = rest_field( + name="softDeleteConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for soft delete on the Cosmos DB account.""" + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( + name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on + the account.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + consistency_policy: Optional["_models.ConsistencyPolicy"] = None, + locations: Optional[list["_models.Location"]] = None, + ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, + is_virtual_network_filter_enabled: Optional[bool] = None, + enable_automatic_failover: Optional[bool] = None, + capabilities: Optional[list["_models.Capability"]] = None, + virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, + enable_multiple_write_locations: Optional[bool] = None, + enable_cassandra_connector: Optional[bool] = None, + connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, + disable_key_based_metadata_write_access: Optional[bool] = None, + key_vault_key_uri: Optional[str] = None, + default_identity: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + enable_free_tier: Optional[bool] = None, + api_properties: Optional["_models.ApiProperties"] = None, + enable_analytical_storage: Optional[bool] = None, + analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, + backup_policy: Optional["_models.BackupPolicy"] = None, + cors: Optional[list["_models.CorsPolicy"]] = None, + network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, + network_acl_bypass_resource_ids: Optional[list[str]] = None, + 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, + 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, + enable_all_versions_and_deletes_change_feed: Optional[bool] = None, + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = None, + enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DatabaseRestoreResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specific Databases to restore. + + :ivar database_name: The name of the database available for restore. + :vartype database_name: str + :ivar collection_names: The names of the collections available for restore. + :vartype collection_names: list[str] + """ + + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the database available for restore.""" + collection_names: Optional[list[str]] = rest_field( + name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The names of the collections available for restore.""" + + @overload + def __init__( + self, + *, + database_name: Optional[str] = None, + collection_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataCenterResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A managed Cassandra data center. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties of a managed Cassandra data center. + :vartype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties + """ + + properties: Optional["_models.DataCenterResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of a managed Cassandra data center.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.DataCenterResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataCenterResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a managed Cassandra data center. + + :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 data_center_location: The region this data center should be created in. + :vartype data_center_location: str + :ivar delegated_subnet_id: Resource id of a subnet the nodes in this data center should have + their network interfaces connected to. The subnet must be in the same region specified in + 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's + 'delegatedManagementSubnetId' property. This resource id will be of the form + '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + :vartype delegated_subnet_id: str + :ivar node_count: The number of nodes the data center should have. This is the desired number. + After it is set, it may take some time for the data center to be scaled to match. To monitor + the number of nodes and their status, use the fetchNodeStatus method on the cluster. + :vartype node_count: int + :ivar seed_nodes: IP addresses for seed nodes in this data center. This is for reference. + Generally you will want to use the seedNodes property on the cluster, which aggregates the seed + nodes from all data centers in the cluster. + :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] + :ivar base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration file + to be included in the cassandra.yaml for all nodes in this data center. The fragment should be + Base64 encoded, and only a subset of keys are allowed. + :vartype base64_encoded_cassandra_yaml_fragment: str + :ivar managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure the + system assigned identity of the cluster has been assigned appropriate permissions(key + get/wrap/unwrap permissions) on the key. + :vartype managed_disk_customer_key_uri: str + :ivar backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for + encryption of the backup storage account. + :vartype backup_storage_customer_key_uri: str + :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + :vartype sku: str + :ivar disk_sku: Disk SKU used for data centers. Default value is P30. + :vartype disk_sku: str + :ivar disk_capacity: Number of disks attached to each node. Default is 4. + :vartype disk_capacity: int + :ivar availability_zone: If the data center has Availability Zone support, apply it to the + Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :vartype availability_zone: bool + :ivar authentication_method_ldap_properties: Ldap authentication method properties. This + feature is in preview. + :vartype authentication_method_ldap_properties: + ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties + :ivar deallocated: Whether the data center has been deallocated. + :vartype deallocated: bool + :ivar provision_error: Error related to resource provisioning. + :vartype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError + :ivar private_endpoint_ip_address: Ip of the VPN Endpoint for this data center. + :vartype private_endpoint_ip_address: str + """ + + provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the resource at the time the operation was called. Known values are: + \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + data_center_location: Optional[str] = rest_field(name="dataCenterLocation", visibility=["read", "create"]) + """The region this data center should be created in.""" + delegated_subnet_id: Optional[str] = rest_field(name="delegatedSubnetId", visibility=["read", "create"]) + """Resource id of a subnet the nodes in this data center should have their network interfaces + connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must + be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' + property. This resource id will be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" + node_count: Optional[int] = rest_field(name="nodeCount", visibility=["read", "create", "update", "delete", "query"]) + """The number of nodes the data center should have. This is the desired number. After it is set, + it may take some time for the data center to be scaled to match. To monitor the number of nodes + and their status, use the fetchNodeStatus method on the cluster.""" + seed_nodes: Optional[list["_models.SeedNode"]] = rest_field(name="seedNodes", visibility=["read"]) + """IP addresses for seed nodes in this data center. This is for reference. Generally you will want + to use the seedNodes property on the cluster, which aggregates the seed nodes from all data + centers in the cluster.""" + base64_encoded_cassandra_yaml_fragment: Optional[str] = rest_field( + name="base64EncodedCassandraYamlFragment", visibility=["read", "create", "update", "delete", "query"] + ) + """A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all + nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are + allowed.""" + managed_disk_customer_key_uri: Optional[str] = rest_field( + name="managedDiskCustomerKeyUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Key uri to use for encryption of managed disks. Ensure the system assigned identity of the + cluster has been assigned appropriate permissions(key get/wrap/unwrap permissions) on the key.""" + backup_storage_customer_key_uri: Optional[str] = rest_field( + name="backupStorageCustomerKeyUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the Key Uri of the customer key to use for encryption of the backup storage account.""" + sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2.""" + disk_sku: Optional[str] = rest_field(name="diskSku", visibility=["read", "create", "update", "delete", "query"]) + """Disk SKU used for data centers. Default value is P30.""" + disk_capacity: Optional[int] = rest_field( + name="diskCapacity", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of disks attached to each node. Default is 4.""" + availability_zone: Optional[bool] = rest_field( + name="availabilityZone", visibility=["read", "create", "update", "delete", "query"] + ) + """If the data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that + host the cassandra data center virtual machines.""" + authentication_method_ldap_properties: Optional["_models.AuthenticationMethodLdapProperties"] = rest_field( + name="authenticationMethodLdapProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Ldap authentication method properties. This feature is in preview.""" + deallocated: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Whether the data center has been deallocated.""" + provision_error: Optional["_models.CassandraError"] = rest_field( + name="provisionError", visibility=["read", "create", "update", "delete", "query"] + ) + """Error related to resource provisioning.""" + private_endpoint_ip_address: Optional[str] = rest_field( + name="privateEndpointIpAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Ip of the VPN Endpoint for this data center.""" + + @overload + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = None, + data_center_location: Optional[str] = None, + delegated_subnet_id: Optional[str] = None, + node_count: Optional[int] = None, + base64_encoded_cassandra_yaml_fragment: Optional[str] = None, + managed_disk_customer_key_uri: Optional[str] = None, + backup_storage_customer_key_uri: Optional[str] = None, + sku: Optional[str] = None, + disk_sku: Optional[str] = None, + disk_capacity: Optional[int] = None, + availability_zone: Optional[bool] = None, + authentication_method_ldap_properties: Optional["_models.AuthenticationMethodLdapProperties"] = None, + deallocated: Optional[bool] = None, + provision_error: Optional["_models.CassandraError"] = None, + private_endpoint_ip_address: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataMaskingPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Data masking policy for the container. + + :ivar included_paths: List of JSON paths to include in the masking policy. + :vartype included_paths: list[~azure.mgmt.cosmosdb.models.DataMaskingPolicyIncludedPathsItem] + :ivar excluded_paths: List of JSON paths to exclude from masking. + :vartype excluded_paths: list[~azure.mgmt.cosmosdb.models.DataMaskingPolicyExcludedPathsItem] + :ivar is_policy_enabled: Flag indicating whether the data masking policy is enabled. + :vartype is_policy_enabled: bool + """ + + included_paths: Optional[list["_models.DataMaskingPolicyIncludedPathsItem"]] = rest_field( + name="includedPaths", visibility=["read", "create", "update", "delete", "query"] + ) + """List of JSON paths to include in the masking policy.""" + excluded_paths: Optional[list["_models.DataMaskingPolicyExcludedPathsItem"]] = rest_field( + name="excludedPaths", visibility=["read", "create", "update", "delete", "query"] + ) + """List of JSON paths to exclude from masking.""" + is_policy_enabled: Optional[bool] = rest_field( + name="isPolicyEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag indicating whether the data masking policy is enabled.""" + + @overload + def __init__( + self, + *, + included_paths: Optional[list["_models.DataMaskingPolicyIncludedPathsItem"]] = None, + excluded_paths: Optional[list["_models.DataMaskingPolicyExcludedPathsItem"]] = None, + is_policy_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataMaskingPolicyExcludedPathsItem(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """JSON path to exclude from masking. + + :ivar path: The JSON path to exclude from masking (e.g. "/id"). Required. + :vartype path: str + """ + + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The JSON path to exclude from masking (e.g. \"/id\"). Required.""" + + @overload + def __init__( + self, + *, + path: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataMaskingPolicyIncludedPathsItem(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """JSON path to include in the masking policy. + + :ivar path: The JSON path to apply masking (e.g. "/contact/phones"). Required. + :vartype path: str + :ivar strategy: Masking strategy to apply (e.g. "MaskSubstring"). + :vartype strategy: str + :ivar start_position: Start position for substring masking (when applicable). + :vartype start_position: int + :ivar length: Length of substring to mask (when applicable). + :vartype length: int + """ + + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The JSON path to apply masking (e.g. \"/contact/phones\"). Required.""" + strategy: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Masking strategy to apply (e.g. \"MaskSubstring\").""" + start_position: Optional[int] = rest_field( + name="startPosition", visibility=["read", "create", "update", "delete", "query"] + ) + """Start position for substring masking (when applicable).""" + length: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Length of substring to mask (when applicable).""" + + @overload + def __init__( + self, + *, + path: str, + strategy: Optional[str] = None, + start_position: Optional[int] = None, + length: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataTransferJobGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A Cosmos DB Data Transfer Job. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of a DataTransfer Job. + :vartype properties: ~azure.mgmt.cosmosdb.models.DataTransferJobProperties + """ + + properties: Optional["_models.DataTransferJobProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a DataTransfer Job.""" + + __flattened_items = [ + "job_name", + "source", + "destination", + "status", + "processed_count", + "total_count", + "last_updated_utc_time", + "worker_count", + "error", + "duration", + "mode", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.DataTransferJobProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DataTransferJobProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a DataTransfer Job. + + :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 + """ + + job_name: Optional[str] = rest_field(name="jobName", visibility=["read"]) + """Job Name.""" + source: "_models.DataTransferDataSourceSink" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Source DataStore details. Required.""" + destination: "_models.DataTransferDataSourceSink" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Destination DataStore details. Required.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Job Status.""" + processed_count: Optional[int] = rest_field(name="processedCount", visibility=["read"]) + """Processed Count.""" + total_count: Optional[int] = rest_field(name="totalCount", visibility=["read"]) + """Total Count.""" + last_updated_utc_time: Optional[datetime.datetime] = rest_field( + name="lastUpdatedUtcTime", visibility=["read"], format="rfc3339" + ) + """Last Updated Time (ISO-8601 format).""" + worker_count: Optional[int] = rest_field( + name="workerCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Worker count.""" + error: Optional["_models.ErrorResponseAutoGenerated"] = rest_field(visibility=["read"]) + """Error response for Faulted job.""" + duration: Optional[str] = rest_field(visibility=["read"]) + """Total Duration of Job.""" + mode: Optional[Union[str, "_models.DataTransferJobMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Mode of job execution. Known values are: \"Offline\" and \"Online\".""" + + @overload + def __init__( + self, + *, + source: "_models.DataTransferDataSourceSink", + destination: "_models.DataTransferDataSourceSink", + worker_count: Optional[int] = None, + mode: Optional[Union[str, "_models.DataTransferJobMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegionalServiceResource(_Model): + """Resource for a regional service location. + + :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 + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The regional service name.""" + location: Optional[str] = rest_field(visibility=["read"]) + """The location name.""" + status: Optional[Union[str, "_models.ServiceStatus"]] = rest_field(visibility=["read"]) + """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", + \"Deleting\", \"Error\", and \"Stopped\".""" + + +class DataTransferRegionalServiceResource(RegionalServiceResource): + """Resource for a regional service location. + + :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 + """ + + +class ServiceResourceCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties in ServiceResourceCreateUpdateParameters. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataTransferServiceResourceCreateUpdateProperties, + GraphAPIComputeServiceResourceCreateUpdateProperties, + MaterializedViewsBuilderServiceResourceCreateUpdateProperties, + SqlDedicatedGatewayServiceResourceCreateUpdateProperties + + :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 + """ + + __mapping__: dict[str, _Model] = {} + instance_size: Optional[Union[str, "_models.ServiceSize"]] = rest_field( + name="instanceSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and + \"Cosmos.D16s\".""" + instance_count: Optional[int] = rest_field( + name="instanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Instance count for the service.""" + service_type: str = rest_discriminator( + name="serviceType", visibility=["read", "create", "update", "delete", "query"] + ) + """ServiceType for the service. Required. Known values are: \"SqlDedicatedGateway\", + \"DataTransfer\", \"GraphAPICompute\", and \"MaterializedViewsBuilder\".""" + + @overload + def __init__( + self, + *, + service_type: str, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataTransferServiceResourceCreateUpdateProperties( + ServiceResourceCreateUpdateProperties, discriminator="DataTransfer" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Properties for Create or Update request for DataTransferServiceResource. + + :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. DATA_TRANSFER. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.DATA_TRANSFER + """ + + service_type: Literal[ServiceType.DATA_TRANSFER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. DATA_TRANSFER.""" + + @overload + def __init__( + self, + *, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.service_type = ServiceType.DATA_TRANSFER # type: ignore + + +class ServiceResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Services response resource. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataTransferServiceResourceProperties, GraphAPIComputeServiceResourceProperties, + MaterializedViewsBuilderServiceResourceProperties, SqlDedicatedGatewayServiceResourceProperties + + :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 + """ + + __mapping__: dict[str, _Model] = {} + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """Time of the last state change (ISO-8601 format).""" + instance_size: Optional[Union[str, "_models.ServiceSize"]] = rest_field( + name="instanceSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and + \"Cosmos.D16s\".""" + instance_count: Optional[int] = rest_field( + name="instanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Instance count for the service.""" + service_type: str = rest_discriminator( + name="serviceType", visibility=["read", "create", "update", "delete", "query"] + ) + """ServiceType for the service. Required. Known values are: \"SqlDedicatedGateway\", + \"DataTransfer\", \"GraphAPICompute\", and \"MaterializedViewsBuilder\".""" + status: Optional[Union[str, "_models.ServiceStatus"]] = rest_field(visibility=["read"]) + """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", + \"Deleting\", \"Error\", and \"Stopped\".""" + + @overload + def __init__( + self, + *, + service_type: str, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataTransferServiceResourceProperties( + ServiceResourceProperties, discriminator="DataTransfer" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties for DataTransferServiceResource. + + :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 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 locations: An array that contains all of the locations for the service. + :vartype locations: list[~azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource] + :ivar service_type: ServiceType for the service. Required. DATA_TRANSFER. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.DATA_TRANSFER + """ + + locations: Optional[list["_models.DataTransferRegionalServiceResource"]] = rest_field(visibility=["read"]) + """An array that contains all of the locations for the service.""" + service_type: Literal[ServiceType.DATA_TRANSFER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. DATA_TRANSFER.""" + + @overload + def __init__( + self, + *, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.service_type = ServiceType.DATA_TRANSFER # type: ignore + + +class DiagnosticLogSettings(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + """ + + enable_full_text_query: Optional[Union[str, "_models.EnableFullTextQuery"]] = rest_field( + name="enableFullTextQuery", visibility=["read", "create", "update", "delete", "query"] + ) + """Describe the level of detail with which queries are to be logged. Known values are: \"None\", + \"True\", and \"False\".""" + + @overload + def __init__( + self, + *, + enable_full_text_query: Optional[Union[str, "_models.EnableFullTextQuery"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.cosmosdb.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.cosmosdb.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.cosmosdb.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponseAutoGenerated(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Error Response. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message indicating why the operation failed.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExcludedPath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """ExcludedPath. + + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :vartype path: str + """ + + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path for which the indexing behavior applies to. Index paths typically start with root and + end with wildcard (/path/*).""" + + @overload + def __init__( + self, + *, + path: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FailoverPolicies(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The list of new failover policies for the failover priority change. + + :ivar failover_policies: List of failover policies. Required. + :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] + """ + + failover_policies: list["_models.FailoverPolicy"] = rest_field( + name="failoverPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """List of failover policies. Required.""" + + @overload + def __init__( + self, + *, + failover_policies: list["_models.FailoverPolicy"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FailoverPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The failover policy for a given region of a database account. + + :ivar id: The unique identifier of the region in which the database account replicates to. + Example: <accountName>-<locationName>. + :vartype id: str + :ivar location_name: The name of the region in which the database account exists. + :vartype location_name: str + :ivar failover_priority: The failover priority of the region. A failover priority of 0 + indicates a write region. The maximum value for a failover priority = (total number of regions + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :vartype failover_priority: int + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The unique identifier of the region in which the database account replicates to. Example: + <accountName>-<locationName>.""" + location_name: Optional[str] = rest_field( + name="locationName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the region in which the database account exists.""" + failover_priority: Optional[int] = rest_field( + name="failoverPriority", visibility=["read", "create", "update", "delete", "query"] + ) + """The failover priority of the region. A failover priority of 0 indicates a write region. The + maximum value for a failover priority = (total number of regions - 1). Failover priority values + must be unique for each of the regions in which the database account exists.""" + + @overload + def __init__( + self, + *, + location_name: Optional[str] = None, + failover_priority: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetAnalyticsProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """FleetAnalyticsProperties. + + :ivar provisioning_state: A provisioning state of the FleetAnalytics. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar storage_location_type: The type of the fleet analytics resource. Known values are: + "StorageAccount" and "FabricLakehouse". + :vartype storage_location_type: str or + ~azure.mgmt.cosmosdb.models.FleetAnalyticsPropertiesStorageLocationType + :ivar storage_location_uri: The unique identifier of the fleet analytics resource. + :vartype storage_location_uri: str + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """A provisioning state of the FleetAnalytics. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + storage_location_type: Optional[Union[str, "_models.FleetAnalyticsPropertiesStorageLocationType"]] = rest_field( + name="storageLocationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the fleet analytics resource. Known values are: \"StorageAccount\" and + \"FabricLakehouse\".""" + storage_location_uri: Optional[str] = rest_field( + name="storageLocationUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique identifier of the fleet analytics resource.""" + + @overload + def __init__( + self, + *, + storage_location_type: Optional[Union[str, "_models.FleetAnalyticsPropertiesStorageLocationType"]] = None, + storage_location_uri: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetAnalyticsResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB FleetAnalytics. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetAnalyticsProperties + """ + + properties: Optional["_models.FleetAnalyticsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + __flattened_items = ["provisioning_state", "storage_location_type", "storage_location_uri"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FleetAnalyticsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class TrackedResource(Resource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the 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 + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetResource(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB FleetResource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar 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 + :ivar properties: Properties to update Azure Cosmos DB fleet resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetResourceProperties + """ + + properties: Optional["_models.FleetResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to update Azure Cosmos DB fleet resource.""" + + __flattened_items = ["provisioning_state"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.FleetResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FleetResourceProperties(_Model): + """Properties to update Azure Cosmos DB fleet resource. + + :ivar provisioning_state: A provisioning state of the Fleet. Known values are: "Uninitialized", + "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", "Failed", "Canceled", + "Updating", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """A provisioning state of the Fleet. Known values are: \"Uninitialized\", \"Initializing\", + \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", + \"Updating\", and \"Creating\".""" + + +class FleetResourceUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents a fleet resource for updates. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties to update Azure Cosmos DB fleet resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetResourceProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.FleetResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to update Azure Cosmos DB fleet resource.""" + + __flattened_items = ["provisioning_state"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.FleetResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FleetspaceAccountProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account. + + :ivar provisioning_state: A provisioning state of the Fleetspace Account. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar global_database_account_properties: Configuration for fleetspace Account in the + fleetspace. + :vartype global_database_account_properties: + ~azure.mgmt.cosmosdb.models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """A provisioning state of the Fleetspace Account. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + global_database_account_properties: Optional[ + "_models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties" + ] = rest_field(name="globalDatabaseAccountProperties", visibility=["read", "create", "update", "delete", "query"]) + """Configuration for fleetspace Account in the fleetspace.""" + + @overload + def __init__( + self, + *, + global_database_account_properties: Optional[ + "_models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties" + ] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetspaceAccountPropertiesGlobalDatabaseAccountProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Configuration for fleetspace Account in the fleetspace. + + :ivar resource_id: The resource identifier of global database account in the Fleetspace + Account. + :vartype resource_id: str + :ivar arm_location: The location of global database account in the Fleetspace Account. + :vartype arm_location: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource identifier of global database account in the Fleetspace Account.""" + arm_location: Optional[str] = rest_field( + name="armLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The location of global database account in the Fleetspace Account.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + arm_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetspaceAccountResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Fleetspace Account. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: An Azure Cosmos DB Global Database Account which is part of a Fleetspace + Account. + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceAccountProperties + """ + + properties: Optional["_models.FleetspaceAccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account.""" + + __flattened_items = ["provisioning_state", "global_database_account_properties"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FleetspaceAccountProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FleetspaceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to update Azure Cosmos DB Fleetspace. + + :ivar provisioning_state: A provisioning state of the Fleetspace. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status + :ivar fleetspace_api_kind: The kind of API this fleetspace belongs to. Acceptable values: + 'NoSQL'. "NoSQL" + :vartype fleetspace_api_kind: str or + ~azure.mgmt.cosmosdb.models.FleetspacePropertiesFleetspaceApiKind + :ivar service_tier: Service Tier for the fleetspace. GeneralPurpose types refers to single + write region accounts that can be added to this fleetspace, whereas BusinessCritical refers to + multi write region. Known values are: "GeneralPurpose" and "BusinessCritical". + :vartype service_tier: str or ~azure.mgmt.cosmosdb.models.FleetspacePropertiesServiceTier + :ivar data_regions: List of data regions assigned to the fleetspace. Eg [westus2]. + :vartype data_regions: list[str] + :ivar throughput_pool_configuration: Configuration for throughput pool in the fleetspace. + :vartype throughput_pool_configuration: + ~azure.mgmt.cosmosdb.models.FleetspacePropertiesThroughputPoolConfiguration + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """A provisioning state of the Fleetspace. Known values are: \"Uninitialized\", \"Initializing\", + \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", + \"Updating\", and \"Creating\".""" + fleetspace_api_kind: Optional[Union[str, "_models.FleetspacePropertiesFleetspaceApiKind"]] = rest_field( + name="fleetspaceApiKind", visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of API this fleetspace belongs to. Acceptable values: 'NoSQL'. \"NoSQL\"""" + service_tier: Optional[Union[str, "_models.FleetspacePropertiesServiceTier"]] = rest_field( + name="serviceTier", visibility=["read", "create", "update", "delete", "query"] + ) + """Service Tier for the fleetspace. GeneralPurpose types refers to single write region accounts + that can be added to this fleetspace, whereas BusinessCritical refers to multi write region. + Known values are: \"GeneralPurpose\" and \"BusinessCritical\".""" + data_regions: Optional[list[str]] = rest_field( + name="dataRegions", visibility=["read", "create", "update", "delete", "query"] + ) + """List of data regions assigned to the fleetspace. Eg [westus2].""" + throughput_pool_configuration: Optional["_models.FleetspacePropertiesThroughputPoolConfiguration"] = rest_field( + name="throughputPoolConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration for throughput pool in the fleetspace.""" + + @overload + def __init__( + self, + *, + fleetspace_api_kind: Optional[Union[str, "_models.FleetspacePropertiesFleetspaceApiKind"]] = None, + service_tier: Optional[Union[str, "_models.FleetspacePropertiesServiceTier"]] = None, + data_regions: Optional[list[str]] = None, + throughput_pool_configuration: Optional["_models.FleetspacePropertiesThroughputPoolConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetspacePropertiesThroughputPoolConfiguration( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Configuration for throughput pool in the fleetspace. + + :ivar min_throughput: Minimum throughput for the pool. + :vartype min_throughput: int + :ivar max_throughput: Maximum throughput for the pool. + :vartype max_throughput: int + :ivar dedicated_r_us: Total dedicated throughput (RU/s) for fleetspace. Represents the sum of + all manual provisioned throughput and all autoscale max RU/s across all shared throughput + databases and dedicated throughput containers across all accounts in the fleetspace for 1 + region. + :vartype dedicated_r_us: int + :ivar max_consumable_r_us: Maximum consumable throughput (RU/s) for fleetspace. Represents the + maximum throughput that resources in the fleetspace can consume from the fleetspace's pool in 1 + region. + :vartype max_consumable_r_us: int + """ + + min_throughput: Optional[int] = rest_field( + name="minThroughput", visibility=["read", "create", "update", "delete", "query"] + ) + """Minimum throughput for the pool.""" + max_throughput: Optional[int] = rest_field( + name="maxThroughput", visibility=["read", "create", "update", "delete", "query"] + ) + """Maximum throughput for the pool.""" + dedicated_r_us: Optional[int] = rest_field( + name="dedicatedRUs", visibility=["read", "create", "update", "delete", "query"] + ) + """Total dedicated throughput (RU/s) for fleetspace. Represents the sum of all manual provisioned + throughput and all autoscale max RU/s across all shared throughput databases and dedicated + throughput containers across all accounts in the fleetspace for 1 region.""" + max_consumable_r_us: Optional[int] = rest_field( + name="maxConsumableRUs", visibility=["read", "create", "update", "delete", "query"] + ) + """Maximum consumable throughput (RU/s) for fleetspace. Represents the maximum throughput that + resources in the fleetspace can consume from the fleetspace's pool in 1 region.""" + + @overload + def __init__( + self, + *, + min_throughput: Optional[int] = None, + max_throughput: Optional[int] = None, + dedicated_r_us: Optional[int] = None, + max_consumable_r_us: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FleetspaceResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Fleetspace. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties to update Azure Cosmos DB Fleetspace. + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceProperties + """ + + properties: Optional["_models.FleetspaceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to update Azure Cosmos DB Fleetspace.""" + + __flattened_items = [ + "provisioning_state", + "fleetspace_api_kind", + "service_tier", + "data_regions", + "throughput_pool_configuration", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FleetspaceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FleetspaceUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents a fleetspace resource for updates. + + :ivar properties: Properties of the fleetspace. + :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceProperties + """ + + properties: Optional["_models.FleetspaceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the fleetspace.""" + + __flattened_items = [ + "provisioning_state", + "fleetspace_api_kind", + "service_tier", + "data_regions", + "throughput_pool_configuration", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FleetspaceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FullTextIndexPath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents the full text index path. + + :ivar path: The path to the full text field in the document. Required. + :vartype path: str + """ + + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path to the full text field in the document. Required.""" + + @overload + def __init__( + self, + *, + path: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FullTextPath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents the full text path specification. + + :ivar path: The path to the full text field in the document. Required. + :vartype path: str + :ivar language: The language of the full text field in the document. + :vartype language: str + """ + + path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path to the full text field in the document. Required.""" + language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The language of the full text field in the document.""" + + @overload + def __init__( + self, + *, + path: str, + language: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FullTextPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB FullText Policy. + + :ivar default_language: The default language for a full text paths. + :vartype default_language: str + :ivar full_text_paths: List of FullText Paths. + :vartype full_text_paths: list[~azure.mgmt.cosmosdb.models.FullTextPath] + """ + + default_language: Optional[str] = rest_field( + name="defaultLanguage", visibility=["read", "create", "update", "delete", "query"] ) - """Enables automatic failover of the write region in the rare event that the region is unavailable - due to an outage. Automatic failover will result in a new write region for the account and is - chosen based on the failover priorities configured for the account.""" - consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( - name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] + """The default language for a full text paths.""" + full_text_paths: Optional[list["_models.FullTextPath"]] = rest_field( + name="fullTextPaths", visibility=["read", "create", "update", "delete", "query"] ) - """The consistency policy for the Cosmos DB database account.""" - capabilities: Optional[list["_models.Capability"]] = rest_field( + """List of FullText Paths.""" + + @overload + def __init__( + self, + *, + default_language: Optional[str] = None, + full_text_paths: Optional[list["_models.FullTextPath"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarnetClusterResource(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Representation of a Garnet cache cluster. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar 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 + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.GarnetClusterResourceProperties + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedCassandraManagedServiceIdentity + """ + + properties: Optional["_models.GarnetClusterResourceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """List of Cosmos DB capabilities for the account.""" - write_locations: Optional[list["_models.Location"]] = rest_field(name="writeLocations", visibility=["read"]) - """An array that contains the write location for the Cosmos DB account.""" - read_locations: Optional[list["_models.Location"]] = rest_field(name="readLocations", visibility=["read"]) - """An array that contains of the read locations enabled for the Cosmos DB account.""" - locations: Optional[list["_models.Location"]] = rest_field(visibility=["read"]) - """An array that contains all of the locations enabled for the Cosmos DB account.""" - failover_policies: Optional[list["_models.FailoverPolicy"]] = rest_field( - name="failoverPolicies", visibility=["read"] - ) - """An array that contains the regions ordered by their failover priorities.""" - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( - name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of Virtual Network ACL rules configured for the Cosmos DB account.""" - private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( - name="privateEndpointConnections", visibility=["read"] - ) - """List of Private Endpoint Connections configured for the Cosmos DB account.""" - enable_multiple_write_locations: Optional[bool] = rest_field( - name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the account to write in multiple locations.""" - enable_cassandra_connector: Optional[bool] = rest_field( - name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the cassandra connector on the Cosmos DB C* account.""" - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( - name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] - ) - """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" - disable_key_based_metadata_write_access: Optional[bool] = rest_field( - name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Disable write operations on metadata resources (databases, containers, throughput) via account - keys.""" - key_vault_key_uri: Optional[str] = rest_field( - name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] - ) - """The URI of the key vault.""" - default_identity: Optional[str] = rest_field( - name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] - ) - """The default identity for accessing key vault used in features like customer managed keys. The - default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", - \"SystemAssignedIdentity\" and more.""" - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( - name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", - and \"SecuredByPerimeter\".""" - enable_free_tier: Optional[bool] = rest_field( - name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether Free Tier is enabled.""" - api_properties: Optional["_models.ApiProperties"] = rest_field( - name="apiProperties", visibility=["read", "create", "update", "delete", "query"] - ) - """API specific properties.""" - enable_analytical_storage: Optional[bool] = rest_field( - name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether to enable storage analytics.""" - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( - name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical storage specific properties.""" - instance_id: Optional[str] = rest_field(name="instanceId", visibility=["read"]) - """A unique identifier assigned to the database account.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" - restore_parameters: Optional["_models.RestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Parameters to indicate the information about the restore.""" - backup_policy: Optional["_models.BackupPolicy"] = rest_field( - name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The object representing the policy for taking backups on an account.""" - cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The CORS policy for the Cosmos DB database account.""" - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( - name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and - \"AzureServices\".""" - network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( - name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] + """The resource-specific properties for this resource.""" + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" - disable_local_auth: Optional[bool] = rest_field( - name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + """Identity for the resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GarnetClusterResourceProperties"] = None, + identity: Optional["_models.ManagedCassandraManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarnetClusterResourcePatch(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Representation of a Garnet cache cluster for updates. + + :ivar properties: Properties of a Garnet cache cluster for updates. + :vartype properties: ~azure.mgmt.cosmosdb.models.GarnetClusterResourcePatchProperties + """ + + properties: Optional["_models.GarnetClusterResourcePatchProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for - authentication.""" - capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The object that represents all properties related to capacity enforcement on an account.""" - keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( - name="keysMetadata", visibility=["read"] + """Properties of a Garnet cache cluster for updates.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.GarnetClusterResourcePatchProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarnetClusterResourcePatchProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a Garnet cache cluster for updates. + + :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 extensions: Extensions to be added or updated on cluster. + :vartype extensions: list[str] + :ivar authentication_method: The authentication method used for the Garnet cluster. "Entra" + :vartype authentication_method: str or ~azure.mgmt.cosmosdb.models.GarnetAuthenticationType + :ivar persistence: Flag to indicate if persistence is enabled for the Garnet cluster. + :vartype persistence: bool + """ + + cluster_type: Optional[Union[str, "_models.ClusterType"]] = rest_field( + name="clusterType", visibility=["read", "create", "update", "delete", "query"] ) - """The object that represents the metadata for the Account Keys of the Cosmos DB account.""" - enable_partition_merge: Optional[bool] = rest_field( - name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" + extensions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Extensions to be added or updated on cluster.""" + authentication_method: Optional[Union[str, "_models.GarnetAuthenticationType"]] = rest_field( + name="authenticationMethod", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" - enable_burst_capacity: Optional[bool] = rest_field( - name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] + """The authentication method used for the Garnet cluster. \"Entra\"""" + persistence: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Flag to indicate if persistence is enabled for the Garnet cluster.""" + + @overload + def __init__( + self, + *, + cluster_type: Optional[Union[str, "_models.ClusterType"]] = None, + extensions: Optional[list[str]] = None, + authentication_method: Optional[Union[str, "_models.GarnetAuthenticationType"]] = None, + persistence: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarnetClusterResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a Garnet cache cluster. + + :ivar provisioning_state: The provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.GarnetCacheProvisioningState + :ivar 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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + :vartype subnet_id: str + :ivar end_points: Endpoints for clients to connect to the cluster. + :vartype end_points: + list[~azure.mgmt.cosmosdb.models.GarnetClusterResourcePropertiesEndPointsItem] + :ivar replication_factor: Number of copies of data maintained by the cluster. + :vartype replication_factor: int + :ivar shard_count: Number of shards in the cluster. + :vartype shard_count: int + :ivar node_sku: Virtual Machine SKU used for clusters. Default value is Standard_DS14_v2. + :vartype node_sku: str + :ivar availability_zone: If the data center has Availability Zone support, apply it to the + Virtual Machine ScaleSet that host the garnet cluster virtual machines. + :vartype availability_zone: bool + :ivar authentication_method: The authentication method used for the Garnet cluster. "Entra" + :vartype authentication_method: str or ~azure.mgmt.cosmosdb.models.GarnetAuthenticationType + :ivar persistence: Flag to indicate if persistence is enabled for the Garnet cluster. + :vartype persistence: bool + :ivar allocation_state: Allocation state of the cluster and data center resources. Active + implies the virtual machines of the cluster are allocated, deallocated implies virtual machines + and resources are deallocated. Known values are: "Active" and "Deallocated". + :vartype allocation_state: str or ~azure.mgmt.cosmosdb.models.AllocationState + :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.ErrorDetail + :ivar extensions: Extensions to be added or updated on cluster. + :vartype extensions: list[str] + """ + + provisioning_state: Optional[Union[str, "_models.GarnetCacheProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] ) - """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( - name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] + """The provisioning state of the resource. Known values are: \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create"]) + """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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" + end_points: Optional[list["_models.GarnetClusterResourcePropertiesEndPointsItem"]] = rest_field( + name="endPoints", visibility=["read"] ) - """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\".""" - customer_managed_key_status: Optional[str] = rest_field( - name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] + """Endpoints for clients to connect to the cluster.""" + replication_factor: Optional[int] = rest_field( + name="replicationFactor", visibility=["read", "create", "update", "delete", "query"] ) - """Indicates the status of the Customer Managed Key feature on the account. In case there are - errors, the property provides troubleshooting guidance.""" - key_vault_key_uri_version: Optional[str] = rest_field(name="keyVaultKeyUriVersion", visibility=["read"]) - """The version of the Customer Managed Key currently being used by the account.""" - enable_priority_based_execution: Optional[bool] = rest_field( - name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] + """Number of copies of data maintained by the cluster.""" + shard_count: Optional[int] = rest_field( + name="shardCount", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" - default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( - name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] + """Number of shards in the cluster.""" + node_sku: Optional[str] = rest_field(name="nodeSku", visibility=["read", "create", "update", "delete", "query"]) + """Virtual Machine SKU used for clusters. Default value is Standard_DS14_v2.""" + availability_zone: Optional[bool] = rest_field( + name="availabilityZone", visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate default Priority Level of request for Priority Based Execution. Known values - are: \"High\" and \"Low\".""" - enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( - name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] + """If the data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that + host the garnet cluster virtual machines.""" + authentication_method: Optional[Union[str, "_models.GarnetAuthenticationType"]] = rest_field( + name="authenticationMethod", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on - the account.""" - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( - name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] + """The authentication method used for the Garnet cluster. \"Entra\"""" + persistence: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Flag to indicate if persistence is enabled for the Garnet cluster.""" + allocation_state: Optional[Union[str, "_models.AllocationState"]] = rest_field( + name="allocationState", visibility=["read", "create", "update", "delete", "query"] + ) + """Allocation state of the cluster and data center resources. Active implies the virtual machines + of the cluster are allocated, deallocated implies virtual machines and resources are + deallocated. Known values are: \"Active\" and \"Deallocated\".""" + cluster_type: Optional[Union[str, "_models.ClusterType"]] = rest_field( + name="clusterType", visibility=["read", "create", "update", "delete", "query"] + ) + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" + provision_error: Optional["_models.ErrorDetail"] = rest_field( + name="provisionError", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on - the account.""" + """Error related to resource provisioning.""" + extensions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Extensions to be added or updated on cluster.""" @overload - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - consistency_policy: Optional["_models.ConsistencyPolicy"] = None, - capabilities: Optional[list["_models.Capability"]] = None, - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["_models.ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - restore_parameters: Optional["_models.RestoreParameters"] = None, - backup_policy: Optional["_models.BackupPolicy"] = None, - cors: Optional[list["_models.CorsPolicy"]] = None, - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, - network_acl_bypass_resource_ids: Optional[list[str]] = None, - disable_local_auth: Optional[bool] = None, - capacity: Optional["_models.Capacity"] = None, - enable_partition_merge: Optional[bool] = 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, - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + subnet_id: Optional[str] = None, + replication_factor: Optional[int] = None, + shard_count: Optional[int] = None, + node_sku: Optional[str] = None, + availability_zone: Optional[bool] = None, + authentication_method: Optional[Union[str, "_models.GarnetAuthenticationType"]] = None, + persistence: Optional[bool] = None, + allocation_state: Optional[Union[str, "_models.AllocationState"]] = None, + cluster_type: Optional[Union[str, "_models.ClusterType"]] = None, + provision_error: Optional["_models.ErrorDetail"] = None, + extensions: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarnetClusterResourcePropertiesEndPointsItem( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Endpoint for clients to connect to the cluster. + + :ivar ip_address: Ipv4 address of the endpoint. + :vartype ip_address: str + :ivar port: Port number. + :vartype port: int + """ + + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """Ipv4 address of the endpoint.""" + port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Port number.""" + + @overload + def __init__( + self, + *, + ip_address: Optional[str] = None, + port: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): + """Resource for a regional service location. + + :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 graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. + :vartype graph_api_compute_endpoint: str + """ + + graph_api_compute_endpoint: Optional[str] = rest_field(name="graphApiComputeEndpoint", visibility=["read"]) + """The regional endpoint for GraphAPICompute.""" + + +class GraphAPIComputeServiceResourceCreateUpdateProperties( + ServiceResourceCreateUpdateProperties, discriminator="GraphAPICompute" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Properties for Create or Update request for GraphAPIComputeServiceResource. + + :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. GRAPH_API_COMPUTE. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.GRAPH_API_COMPUTE + """ + + service_type: Literal[ServiceType.GRAPH_API_COMPUTE] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" + + @overload + def __init__( + self, + *, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.service_type = ServiceType.GRAPH_API_COMPUTE # type: ignore + + +class GraphAPIComputeServiceResourceProperties( + ServiceResourceProperties, discriminator="GraphAPICompute" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties for GraphAPIComputeServiceResource. + + :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 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 graph_api_compute_endpoint: GraphAPICompute endpoint for the service. + :vartype graph_api_compute_endpoint: str + :ivar locations: An array that contains all of the locations for the service. + :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] + :ivar service_type: ServiceType for the service. Required. GRAPH_API_COMPUTE. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.GRAPH_API_COMPUTE + """ + + graph_api_compute_endpoint: Optional[str] = rest_field( + name="graphApiComputeEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """GraphAPICompute endpoint for the service.""" + locations: Optional[list["_models.GraphAPIComputeRegionalServiceResource"]] = rest_field(visibility=["read"]) + """An array that contains all of the locations for the service.""" + service_type: Literal[ServiceType.GRAPH_API_COMPUTE] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" + + @overload + def __init__( + self, + *, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, + graph_api_compute_endpoint: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.service_type = ServiceType.GRAPH_API_COMPUTE # type: ignore + + +class GraphResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Graph resource object. + + :ivar id: Name of the Cosmos DB Graph. Required. + :vartype id: str + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Graph. Required.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin ) -> None: ... @overload @@ -4149,117 +9096,47 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DatabaseAccountGetResults(ProxyResource): - """An Azure Cosmos DB database account. +class GraphResourceCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB Graph resource. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties for the database account. - :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountGetProperties :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\\". + 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 properties: Properties to create and update Azure Cosmos DB Graph resource. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.GraphResourceCreateUpdateProperties """ - properties: Optional["_models.DatabaseAccountGetProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties for the database account.""" - location: Optional[str] = rest_field(visibility=["read", "create", "update"]) - """The location of the resource group to which the resource belongs.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """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\\".""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Identity for the resource.""" - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = rest_field( + properties: "_models.GraphResourceCreateUpdateProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Indicates the type of database account. This can only be set at database account creation. - Known values are: \"GlobalDocumentDB\", \"MongoDB\", and \"Parse\".""" + """Properties to create and update Azure Cosmos DB Graph resource. Required.""" - __flattened_items = [ - "provisioning_state", - "document_endpoint", - "database_account_offer_type", - "ip_rules", - "is_virtual_network_filter_enabled", - "enable_automatic_failover", - "consistency_policy", - "capabilities", - "write_locations", - "read_locations", - "locations", - "failover_policies", - "virtual_network_rules", - "private_endpoint_connections", - "enable_multiple_write_locations", - "enable_cassandra_connector", - "connector_offer", - "disable_key_based_metadata_write_access", - "key_vault_key_uri", - "default_identity", - "public_network_access", - "enable_free_tier", - "api_properties", - "enable_analytical_storage", - "analytical_storage_configuration", - "instance_id", - "create_mode", - "restore_parameters", - "backup_policy", - "cors", - "network_acl_bypass", - "network_acl_bypass_resource_ids", - "disable_local_auth", - "capacity", - "keys_metadata", - "enable_partition_merge", - "enable_burst_capacity", - "minimal_tls_version", - "customer_managed_key_status", - "key_vault_key_uri_version", - "enable_priority_based_execution", - "default_priority_level", - "enable_per_region_per_partition_autoscale", - "enforce_hierarchical_partition_key_id_last_level", - ] + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - properties: Optional["_models.DatabaseAccountGetProperties"] = None, + properties: "_models.GraphResourceCreateUpdateProperties", location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[Union[str, "_models.DatabaseAccountKind"]] = None, ) -> None: ... @overload @@ -4291,59 +9168,65 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class DatabaseAccountKeysMetadata(_Model): - """The metadata related to each access key for the given Cosmos DB database account. +class GraphResourceCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB Graph resource. - :ivar primary_master_key: The metadata related to the Primary Read-Write Key for the given - Cosmos DB database account. - :vartype primary_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata - :ivar secondary_master_key: The metadata related to the Secondary Read-Write Key for the given - Cosmos DB database account. - :vartype secondary_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata - :ivar primary_readonly_master_key: The metadata related to the Primary Read-Only Key for the - given Cosmos DB database account. - :vartype primary_readonly_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata - :ivar secondary_readonly_master_key: The metadata related to the Secondary Read-Only Key for - the given Cosmos DB database account. - :vartype secondary_readonly_master_key: ~azure.mgmt.cosmosdb.models.AccountKeyMetadata + :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 """ - primary_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( - name="primaryMasterKey", visibility=["read"] - ) - """The metadata related to the Primary Read-Write Key for the given Cosmos DB database account.""" - secondary_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( - name="secondaryMasterKey", visibility=["read"] - ) - """The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account.""" - primary_readonly_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( - name="primaryReadonlyMasterKey", visibility=["read"] - ) - """The metadata related to the Primary Read-Only Key for the given Cosmos DB database account.""" - secondary_readonly_master_key: Optional["_models.AccountKeyMetadata"] = rest_field( - name="secondaryReadonlyMasterKey", visibility=["read"] + resource: "_models.GraphResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a Graph resource. Required.""" + options: Optional["_models.CreateUpdateOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account.""" + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" + @overload + def __init__( + self, + *, + resource: "_models.GraphResource", + options: Optional["_models.CreateUpdateOptions"] = None, + ) -> None: ... -class DatabaseAccountListConnectionStringsResult(_Model): # pylint: disable=name-too-long - """The connection strings for the given database account. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - :ivar connection_strings: An array that contains the connection strings for the Cosmos DB - account. - :vartype connection_strings: list[~azure.mgmt.cosmosdb.models.DatabaseAccountConnectionString] + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GraphResourceGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB SQL database. + + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.GraphResourceGetPropertiesOptions """ - connection_strings: Optional[list["_models.DatabaseAccountConnectionString"]] = rest_field( - name="connectionStrings", visibility=["read", "create", "update", "delete", "query"] + resource: Optional["_models.GraphResourceGetPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + options: Optional["_models.GraphResourceGetPropertiesOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """An array that contains the connection strings for the Cosmos DB account.""" @overload def __init__( self, *, - connection_strings: Optional[list["_models.DatabaseAccountConnectionString"]] = None, + resource: Optional["_models.GraphResourceGetPropertiesResource"] = None, + options: Optional["_models.GraphResourceGetPropertiesOptions"] = None, ) -> None: ... @overload @@ -4357,59 +9240,117 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DatabaseAccountListReadOnlyKeysResult(_Model): - """The read-only access keys for the given database account. +class GraphResourceGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """GraphResourceGetPropertiesOptions. - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str + :ivar 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 """ - primary_readonly_master_key: Optional[str] = rest_field(name="primaryReadonlyMasterKey", visibility=["read"]) - """Base 64 encoded value of the primary read-only key.""" - secondary_readonly_master_key: Optional[str] = rest_field(name="secondaryReadonlyMasterKey", visibility=["read"]) - """Base 64 encoded value of the secondary read-only key.""" + @overload + def __init__( + self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): - """The access keys for the given database account. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str - :ivar primary_master_key: Base 64 encoded value of the primary read-write key. - :vartype primary_master_key: str - :ivar secondary_master_key: Base 64 encoded value of the secondary read-write key. - :vartype secondary_master_key: str + +class GraphResourceGetPropertiesResource(GraphResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """GraphResourceGetPropertiesResource. + + :ivar id: Name of the Cosmos DB Graph. Required. + :vartype id: str """ - primary_master_key: Optional[str] = rest_field(name="primaryMasterKey", visibility=["read"]) - """Base 64 encoded value of the primary read-write key.""" - secondary_master_key: Optional[str] = rest_field(name="secondaryMasterKey", visibility=["read"]) - """Base 64 encoded value of the secondary read-write key.""" + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class DatabaseAccountRegenerateKeyParameters(_Model): - """Parameters to regenerate the keys within the database account. - :ivar key_kind: The access key to regenerate. Required. Known values are: "primary", - "secondary", "primaryReadonly", and "secondaryReadonly". - :vartype key_kind: str or ~azure.mgmt.cosmosdb.models.KeyKind +class GraphResourceGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Graph resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the 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: The properties of an Azure Cosmos DB Graph resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.GraphResourceGetProperties + :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 """ - key_kind: Union[str, "_models.KeyKind"] = rest_field( - name="keyKind", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.GraphResourceGetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The access key to regenerate. Required. Known values are: \"primary\", \"secondary\", - \"primaryReadonly\", and \"secondaryReadonly\".""" + """The properties of an Azure Cosmos DB Graph resource.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity for the resource.""" + + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - key_kind: Union[str, "_models.KeyKind"], + properties: Optional["_models.GraphResourceGetProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -4420,12 +9361,40 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class DatabaseAccountUpdateParameters(_Model): - """Parameters for patching Azure Cosmos DB database account properties. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + +class GremlinDatabaseCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB Gremlin database. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :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 @@ -4433,76 +9402,27 @@ class DatabaseAccountUpdateParameters(_Model): with "defaultExperience": "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". :vartype tags: dict[str, str] - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar properties: Properties to update Azure Cosmos DB database accounts. - :vartype properties: ~azure.mgmt.cosmosdb.models.DatabaseAccountUpdateProperties + :ivar properties: Properties to create and update Azure Cosmos DB Gremlin database. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateProperties """ - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """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\".""" - location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The location of the resource group to which the resource belongs.""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Identity for the resource.""" - properties: Optional["_models.DatabaseAccountUpdateProperties"] = rest_field( + properties: "_models.GremlinDatabaseCreateUpdateProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to update Azure Cosmos DB database accounts.""" + """Properties to create and update Azure Cosmos DB Gremlin database. Required.""" - __flattened_items = [ - "consistency_policy", - "locations", - "ip_rules", - "is_virtual_network_filter_enabled", - "enable_automatic_failover", - "capabilities", - "virtual_network_rules", - "enable_multiple_write_locations", - "enable_cassandra_connector", - "connector_offer", - "disable_key_based_metadata_write_access", - "key_vault_key_uri", - "default_identity", - "public_network_access", - "enable_free_tier", - "api_properties", - "enable_analytical_storage", - "analytical_storage_configuration", - "backup_policy", - "cors", - "network_acl_bypass", - "network_acl_bypass_resource_ids", - "disable_local_auth", - "capacity", - "keys_metadata", - "enable_partition_merge", - "enable_burst_capacity", - "minimal_tls_version", - "customer_managed_key_status", - "enable_priority_based_execution", - "default_priority_level", - "enable_per_region_per_partition_autoscale", - "enforce_hierarchical_partition_key_id_last_level", - ] + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - tags: Optional[dict[str, str]] = None, + properties: "_models.GremlinDatabaseCreateUpdateProperties", location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, - properties: Optional["_models.DatabaseAccountUpdateProperties"] = None, ) -> None: ... @overload @@ -4534,282 +9454,258 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class DatabaseAccountUpdateProperties(_Model): - """Properties to update Azure Cosmos DB database accounts. +class GremlinDatabaseCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB Gremlin database. - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: ~azure.mgmt.cosmosdb.models.ConsistencyPolicy - :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB - account. - :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list[~azure.mgmt.cosmosdb.models.IpAddressOrRange] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list[~azure.mgmt.cosmosdb.models.Capability] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list[~azure.mgmt.cosmosdb.models.VirtualNetworkRule] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. "Small" - :vartype connector_offer: str or ~azure.mgmt.cosmosdb.models.ConnectorOffer - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled", "Disabled", and "SecuredByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.cosmosdb.models.PublicNetworkAccess - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: ~azure.mgmt.cosmosdb.models.ApiProperties - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: - ~azure.mgmt.cosmosdb.models.AnalyticalStorageConfiguration - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: ~azure.mgmt.cosmosdb.models.BackupPolicy - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list[~azure.mgmt.cosmosdb.models.CorsPolicy] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known - values are: "None" and "AzureServices". - :vartype network_acl_bypass: str or ~azure.mgmt.cosmosdb.models.NetworkAclBypass - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: ~azure.mgmt.cosmosdb.models.Capacity - :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 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 - Per-Region Per-partition autoscale Preview feature on the account. - :vartype enable_per_region_per_partition_autoscale: bool - :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of - hierarchical partition key ID last level enforcement on the account. - :vartype enforce_hierarchical_partition_key_id_last_level: bool + :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 + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + """ + + resource: "_models.GremlinDatabaseResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a Gremlin database. Required.""" + options: Optional["_models.CreateUpdateOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" + + @overload + def __init__( + self, + *, + resource: "_models.GremlinDatabaseResource", + options: Optional["_models.CreateUpdateOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinDatabaseGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB SQL database. + + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions """ - consistency_policy: Optional["_models.ConsistencyPolicy"] = rest_field( - name="consistencyPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The consistency policy for the Cosmos DB account.""" - locations: Optional[list["_models.Location"]] = rest_field( + resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """An array that contains the georeplication locations enabled for the Cosmos DB account.""" - ip_rules: Optional[list["_models.IpAddressOrRange"]] = rest_field( - name="ipRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of IpRules.""" - is_virtual_network_filter_enabled: Optional[bool] = rest_field( - name="isVirtualNetworkFilterEnabled", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" - enable_automatic_failover: Optional[bool] = rest_field( - name="enableAutomaticFailover", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables automatic failover of the write region in the rare event that the region is unavailable - due to an outage. Automatic failover will result in a new write region for the account and is - chosen based on the failover priorities configured for the account.""" - capabilities: Optional[list["_models.Capability"]] = rest_field( + options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """List of Cosmos DB capabilities for the account.""" - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = rest_field( - name="virtualNetworkRules", visibility=["read", "create", "update", "delete", "query"] - ) - """List of Virtual Network ACL rules configured for the Cosmos DB account.""" - enable_multiple_write_locations: Optional[bool] = rest_field( - name="enableMultipleWriteLocations", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the account to write in multiple locations.""" - enable_cassandra_connector: Optional[bool] = rest_field( - name="enableCassandraConnector", visibility=["read", "create", "update", "delete", "query"] - ) - """Enables the cassandra connector on the Cosmos DB C* account.""" - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = rest_field( - name="connectorOffer", visibility=["read", "create", "update", "delete", "query"] - ) - """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" - disable_key_based_metadata_write_access: Optional[bool] = rest_field( - name="disableKeyBasedMetadataWriteAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Disable write operations on metadata resources (databases, containers, throughput) via account - keys.""" - key_vault_key_uri: Optional[str] = rest_field( - name="keyVaultKeyUri", visibility=["read", "create", "update", "delete", "query"] - ) - """The URI of the key vault.""" - default_identity: Optional[str] = rest_field( - name="defaultIdentity", visibility=["read", "create", "update", "delete", "query"] - ) - """The default identity for accessing key vault used in features like customer managed keys. The - default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", - \"SystemAssignedIdentity\" and more.""" - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( - name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] - ) - """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", - and \"SecuredByPerimeter\".""" - enable_free_tier: Optional[bool] = rest_field( - name="enableFreeTier", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether Free Tier is enabled.""" - api_properties: Optional["_models.ApiProperties"] = rest_field( - name="apiProperties", visibility=["read", "create", "update", "delete", "query"] - ) - """API specific properties. Currently, supported only for MongoDB API.""" - enable_analytical_storage: Optional[bool] = rest_field( - name="enableAnalyticalStorage", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate whether to enable storage analytics.""" - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = rest_field( - name="analyticalStorageConfiguration", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical storage specific properties.""" - backup_policy: Optional["_models.BackupPolicy"] = rest_field( - name="backupPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The object representing the policy for taking backups on an account.""" - cors: Optional[list["_models.CorsPolicy"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The CORS policy for the Cosmos DB database account.""" - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = rest_field( - name="networkAclBypass", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and - \"AzureServices\".""" - network_acl_bypass_resource_ids: Optional[list[str]] = rest_field( - name="networkAclBypassResourceIds", visibility=["read", "create", "update", "delete", "query"] - ) - """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" - disable_local_auth: Optional[bool] = rest_field( - name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] - ) - """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for - authentication.""" - capacity: Optional["_models.Capacity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The object that represents all properties related to capacity enforcement on an account.""" - keys_metadata: Optional["_models.DatabaseAccountKeysMetadata"] = rest_field( - name="keysMetadata", visibility=["read"] - ) - """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.""" - enable_partition_merge: Optional[bool] = rest_field( - name="enablePartitionMerge", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" - enable_burst_capacity: Optional[bool] = rest_field( - name="enableBurstCapacity", visibility=["read", "create", "update", "delete", "query"] - ) - """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" - minimal_tls_version: Optional[Union[str, "_models.MinimalTlsVersion"]] = rest_field( - name="minimalTlsVersion", visibility=["read", "create", "update", "delete", "query"] - ) - """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\".""" - customer_managed_key_status: Optional[str] = rest_field( - name="customerManagedKeyStatus", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the status of the Customer Managed Key feature on the account. In case there are - errors, the property provides troubleshooting guidance.""" - enable_priority_based_execution: Optional[bool] = rest_field( - name="enablePriorityBasedExecution", visibility=["read", "create", "update", "delete", "query"] + + @overload + def __init__( + self, + *, + resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = None, + options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinDatabaseGetPropertiesOptions( + OptionsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """GremlinDatabaseGetPropertiesOptions. + + :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the + ThroughputSetting resource when retrieving offer details. + :vartype throughput: int + :ivar autoscale_settings: Specifies the Autoscale settings. + :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + """ + + @overload + def __init__( + self, + *, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinDatabaseResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Gremlin database resource object. + + :ivar id: Name of the Cosmos DB Gremlin 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 + """ + + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Gremlin database. Required.""" + restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" - default_priority_level: Optional[Union[str, "_models.DefaultPriorityLevel"]] = rest_field( - name="defaultPriorityLevel", visibility=["read", "create", "update", "delete", "query"] + """Parameters to indicate the information about the restore.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate default Priority Level of request for Priority Based Execution. Known values - are: \"High\" and \"Low\".""" - enable_per_region_per_partition_autoscale: Optional[bool] = rest_field( - name="enablePerRegionPerPartitionAutoscale", visibility=["read", "create", "update", "delete", "query"] + """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinDatabaseGetPropertiesResource( + GremlinDatabaseResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """GremlinDatabaseGetPropertiesResource. + + :ivar id: Name of the Cosmos DB Gremlin 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 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 + """ + + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) + """A system generated property that denotes the last updated timestamp of the resource.""" + etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) + """A system generated property representing the resource etag required for optimistic concurrency + control.""" + + @overload + def __init__( + self, + *, + id: str, # pylint: disable=redefined-builtin + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinDatabaseGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Gremlin database. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of an Azure Cosmos DB SQL database. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetProperties + :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 + """ + + properties: Optional["_models.GremlinDatabaseGetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on - the account.""" - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = rest_field( - name="enforceHierarchicalPartitionKeyIdLastLevel", visibility=["read", "create", "update", "delete", "query"] + """The properties of an Azure Cosmos DB SQL database.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on - the account.""" + """Identity for the resource.""" + + __flattened_items = ["resource", "options"] @overload - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - consistency_policy: Optional["_models.ConsistencyPolicy"] = None, - locations: Optional[list["_models.Location"]] = None, - ip_rules: Optional[list["_models.IpAddressOrRange"]] = None, - is_virtual_network_filter_enabled: Optional[bool] = None, - enable_automatic_failover: Optional[bool] = None, - capabilities: Optional[list["_models.Capability"]] = None, - virtual_network_rules: Optional[list["_models.VirtualNetworkRule"]] = None, - enable_multiple_write_locations: Optional[bool] = None, - enable_cassandra_connector: Optional[bool] = None, - connector_offer: Optional[Union[str, "_models.ConnectorOffer"]] = None, - disable_key_based_metadata_write_access: Optional[bool] = None, - key_vault_key_uri: Optional[str] = None, - default_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - enable_free_tier: Optional[bool] = None, - api_properties: Optional["_models.ApiProperties"] = None, - enable_analytical_storage: Optional[bool] = None, - analytical_storage_configuration: Optional["_models.AnalyticalStorageConfiguration"] = None, - backup_policy: Optional["_models.BackupPolicy"] = None, - cors: Optional[list["_models.CorsPolicy"]] = None, - network_acl_bypass: Optional[Union[str, "_models.NetworkAclBypass"]] = None, - network_acl_bypass_resource_ids: Optional[list[str]] = None, - disable_local_auth: Optional[bool] = None, - capacity: Optional["_models.Capacity"] = None, - enable_partition_merge: Optional[bool] = 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, - enforce_hierarchical_partition_key_id_last_level: Optional[bool] = None, + properties: Optional["_models.GremlinDatabaseGetProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -4820,33 +9716,51 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class DatabaseRestoreResource(_Model): - """Specific Databases to restore. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar database_name: The name of the database available for restore. + +class GremlinDatabaseRestoreResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specific Gremlin Databases to restore. + + :ivar database_name: The name of the gremlin 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 graph_names: The names of the graphs available for restore. + :vartype graph_names: list[str] """ database_name: Optional[str] = rest_field( name="databaseName", visibility=["read", "create", "update", "delete", "query"] ) - """The name of the database available for restore.""" - collection_names: Optional[list[str]] = rest_field( - name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + """The name of the gremlin database available for restore.""" + graph_names: Optional[list[str]] = rest_field( + name="graphNames", visibility=["read", "create", "update", "delete", "query"] ) - """The names of the collections available for restore.""" + """The names of the graphs available for restore.""" @overload def __init__( self, *, database_name: Optional[str] = None, - collection_names: Optional[list[str]] = None, + graph_names: Optional[list[str]] = None, ) -> None: ... @overload @@ -4860,34 +9774,137 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataCenterResource(ProxyResource): - """A managed Cassandra data center. +class GremlinGraphCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB Gremlin graph. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties of a managed Cassandra data center. - :vartype properties: ~azure.mgmt.cosmosdb.models.DataCenterResourceProperties + :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 properties: Properties to create and update Azure Cosmos DB Gremlin graph. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateProperties """ - properties: Optional["_models.DataCenterResourceProperties"] = rest_field( + properties: "_models.GremlinGraphCreateUpdateProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update Azure Cosmos DB Gremlin graph. Required.""" + + __flattened_items = ["resource", "options"] + + @overload + def __init__( + self, + *, + properties: "_models.GremlinGraphCreateUpdateProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class GremlinGraphCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB Gremlin graph. + + :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 + the headers sent with the request. + :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + """ + + resource: "_models.GremlinGraphResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a Gremlin graph. Required.""" + options: Optional["_models.CreateUpdateOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" + + @overload + def __init__( + self, + *, + resource: "_models.GremlinGraphResource", + options: Optional["_models.CreateUpdateOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GremlinGraphGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Gremlin graph. + + :ivar resource: + :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource + :ivar options: + :vartype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions + """ + + resource: Optional["_models.GremlinGraphGetPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + options: Optional["_models.GremlinGraphGetPropertiesOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties of a managed Cassandra data center.""" @overload def __init__( self, *, - properties: Optional["_models.DataCenterResourceProperties"] = None, + resource: Optional["_models.GremlinGraphGetPropertiesResource"] = None, + options: Optional["_models.GremlinGraphGetPropertiesOptions"] = None, ) -> None: ... @overload @@ -4901,146 +9918,22 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataCenterResourceProperties(_Model): - """Properties of a managed Cassandra data center. +class GremlinGraphGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """GremlinGraphGetPropertiesOptions. - :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 data_center_location: The region this data center should be created in. - :vartype data_center_location: str - :ivar delegated_subnet_id: Resource id of a subnet the nodes in this data center should have - their network interfaces connected to. The subnet must be in the same region specified in - 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's - 'delegatedManagementSubnetId' property. This resource id will be of the form - '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. - :vartype delegated_subnet_id: str - :ivar node_count: The number of nodes the data center should have. This is the desired number. - After it is set, it may take some time for the data center to be scaled to match. To monitor - the number of nodes and their status, use the fetchNodeStatus method on the cluster. - :vartype node_count: int - :ivar seed_nodes: IP addresses for seed nodes in this data center. This is for reference. - Generally you will want to use the seedNodes property on the cluster, which aggregates the seed - nodes from all data centers in the cluster. - :vartype seed_nodes: list[~azure.mgmt.cosmosdb.models.SeedNode] - :ivar base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration file - to be included in the cassandra.yaml for all nodes in this data center. The fragment should be - Base64 encoded, and only a subset of keys are allowed. - :vartype base64_encoded_cassandra_yaml_fragment: str - :ivar managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure the - system assigned identity of the cluster has been assigned appropriate permissions(key - get/wrap/unwrap permissions) on the key. - :vartype managed_disk_customer_key_uri: str - :ivar backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for - encryption of the backup storage account. - :vartype backup_storage_customer_key_uri: str - :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. - :vartype sku: str - :ivar disk_sku: Disk SKU used for data centers. Default value is P30. - :vartype disk_sku: str - :ivar disk_capacity: Number of disks attached to each node. Default is 4. - :vartype disk_capacity: int - :ivar availability_zone: If the data center has Availability Zone support, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. - :vartype availability_zone: bool - :ivar authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :vartype authentication_method_ldap_properties: - ~azure.mgmt.cosmosdb.models.AuthenticationMethodLdapProperties - :ivar deallocated: Whether the data center has been deallocated. - :vartype deallocated: bool - :ivar provision_error: Error related to resource provisioning. - :vartype provision_error: ~azure.mgmt.cosmosdb.models.CassandraError - :ivar private_endpoint_ip_address: Ip of the VPN Endpoint for this data center. - :vartype private_endpoint_ip_address: 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 """ - provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = rest_field( - name="provisioningState", visibility=["read", "create", "update", "delete", "query"] - ) - """The status of the resource at the time the operation was called. Known values are: - \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" - data_center_location: Optional[str] = rest_field(name="dataCenterLocation", visibility=["read", "create"]) - """The region this data center should be created in.""" - delegated_subnet_id: Optional[str] = rest_field(name="delegatedSubnetId", visibility=["read", "create"]) - """Resource id of a subnet the nodes in this data center should have their network interfaces - connected to. The subnet must be in the same region specified in 'dataCenterLocation' and must - be able to route to the subnet specified in the cluster's 'delegatedManagementSubnetId' - property. This resource id will be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" - node_count: Optional[int] = rest_field(name="nodeCount", visibility=["read", "create", "update", "delete", "query"]) - """The number of nodes the data center should have. This is the desired number. After it is set, - it may take some time for the data center to be scaled to match. To monitor the number of nodes - and their status, use the fetchNodeStatus method on the cluster.""" - seed_nodes: Optional[list["_models.SeedNode"]] = rest_field(name="seedNodes", visibility=["read"]) - """IP addresses for seed nodes in this data center. This is for reference. Generally you will want - to use the seedNodes property on the cluster, which aggregates the seed nodes from all data - centers in the cluster.""" - base64_encoded_cassandra_yaml_fragment: Optional[str] = rest_field( - name="base64EncodedCassandraYamlFragment", visibility=["read", "create", "update", "delete", "query"] - ) - """A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all - nodes in this data center. The fragment should be Base64 encoded, and only a subset of keys are - allowed.""" - managed_disk_customer_key_uri: Optional[str] = rest_field( - name="managedDiskCustomerKeyUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Key uri to use for encryption of managed disks. Ensure the system assigned identity of the - cluster has been assigned appropriate permissions(key get/wrap/unwrap permissions) on the key.""" - backup_storage_customer_key_uri: Optional[str] = rest_field( - name="backupStorageCustomerKeyUri", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the Key Uri of the customer key to use for encryption of the backup storage account.""" - sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2.""" - disk_sku: Optional[str] = rest_field(name="diskSku", visibility=["read", "create", "update", "delete", "query"]) - """Disk SKU used for data centers. Default value is P30.""" - disk_capacity: Optional[int] = rest_field( - name="diskCapacity", visibility=["read", "create", "update", "delete", "query"] - ) - """Number of disks attached to each node. Default is 4.""" - availability_zone: Optional[bool] = rest_field( - name="availabilityZone", visibility=["read", "create", "update", "delete", "query"] - ) - """If the data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that - host the cassandra data center virtual machines.""" - authentication_method_ldap_properties: Optional["_models.AuthenticationMethodLdapProperties"] = rest_field( - name="authenticationMethodLdapProperties", visibility=["read", "create", "update", "delete", "query"] - ) - """Ldap authentication method properties. This feature is in preview.""" - deallocated: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Whether the data center has been deallocated.""" - provision_error: Optional["_models.CassandraError"] = rest_field( - name="provisionError", visibility=["read", "create", "update", "delete", "query"] - ) - """Error related to resource provisioning.""" - private_endpoint_ip_address: Optional[str] = rest_field( - name="privateEndpointIpAddress", visibility=["read", "create", "update", "delete", "query"] - ) - """Ip of the VPN Endpoint for this data center.""" - @overload def __init__( self, *, - provisioning_state: Optional[Union[str, "_models.ManagedCassandraProvisioningState"]] = None, - data_center_location: Optional[str] = None, - delegated_subnet_id: Optional[str] = None, - node_count: Optional[int] = None, - base64_encoded_cassandra_yaml_fragment: Optional[str] = None, - managed_disk_customer_key_uri: Optional[str] = None, - backup_storage_customer_key_uri: Optional[str] = None, - sku: Optional[str] = None, - disk_sku: Optional[str] = None, - disk_capacity: Optional[int] = None, - availability_zone: Optional[bool] = None, - authentication_method_ldap_properties: Optional["_models.AuthenticationMethodLdapProperties"] = None, - deallocated: Optional[bool] = None, - provision_error: Optional["_models.CassandraError"] = None, - private_endpoint_ip_address: Optional[str] = None, + throughput: Optional[int] = None, + autoscale_settings: Optional["_models.AutoscaleSettings"] = None, ) -> None: ... @overload @@ -5054,82 +9947,84 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RegionalServiceResource(_Model): - """Resource for a regional service location. - - :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 - """ - - name: Optional[str] = rest_field(visibility=["read"]) - """The regional service name.""" - location: Optional[str] = rest_field(visibility=["read"]) - """The location name.""" - status: Optional[Union[str, "_models.ServiceStatus"]] = rest_field(visibility=["read"]) - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - - -class DataTransferRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. - - :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 - """ - - -class ServiceResourceCreateUpdateProperties(_Model): - """Properties in ServiceResourceCreateUpdateParameters. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DataTransferServiceResourceCreateUpdateProperties, - GraphAPIComputeServiceResourceCreateUpdateProperties, - MaterializedViewsBuilderServiceResourceCreateUpdateProperties, - SqlDedicatedGatewayServiceResourceCreateUpdateProperties +class GremlinGraphResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB Gremlin graph resource object. - :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 id: Name of the Cosmos DB Gremlin graph. 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 graph. + :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :ivar partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :ivar default_ttl: Default time to live. + :vartype default_ttl: int + :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :ivar conflict_resolution_policy: The conflict resolution policy for the graph. + :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: 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 """ - __mapping__: dict[str, _Model] = {} - instance_size: Optional[Union[str, "_models.ServiceSize"]] = rest_field( - name="instanceSize", visibility=["read", "create", "update", "delete", "query"] + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB Gremlin graph. Required.""" + indexing_policy: Optional["_models.IndexingPolicy"] = rest_field( + name="indexingPolicy", visibility=["read", "create", "update", "delete", "query"] ) - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instance_count: Optional[int] = rest_field( - name="instanceCount", visibility=["read", "create", "update", "delete", "query"] + """The configuration of the indexing policy. By default, the indexing is automatic for all + document paths within the graph.""" + partition_key: Optional["_models.ContainerPartitionKey"] = rest_field( + name="partitionKey", visibility=["read", "create", "update", "delete", "query"] ) - """Instance count for the service.""" - service_type: str = rest_discriminator( - name="serviceType", visibility=["read", "create", "update", "delete", "query"] + """The configuration of the partition key to be used for partitioning data into multiple + partitions.""" + default_ttl: Optional[int] = rest_field( + name="defaultTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Default time to live.""" + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = rest_field( + name="uniqueKeyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique key policy configuration for specifying uniqueness constraints on documents in the + collection in the Azure Cosmos DB service.""" + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = rest_field( + name="conflictResolutionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The conflict resolution policy for the graph.""" + analytical_storage_ttl: Optional[int] = rest_field( + name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical TTL.""" + restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters to indicate the information about the restore.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] ) - """ServiceType for the service. Required. Known values are: \"SqlDedicatedGateway\", - \"DataTransfer\", \"GraphAPICompute\", and \"MaterializedViewsBuilder\".""" + """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" @overload def __init__( self, *, - service_type: str, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + 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, + analytical_storage_ttl: Optional[int] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @overload @@ -5143,29 +10038,63 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DataTransferServiceResourceCreateUpdateProperties( - ServiceResourceCreateUpdateProperties, discriminator="DataTransfer" -): # pylint: disable=name-too-long - """Properties for Create or Update request for DataTransferServiceResource. +class GremlinGraphGetPropertiesResource( + GremlinGraphResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """GremlinGraphGetPropertiesResource. - :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. DATA_TRANSFER. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.DATA_TRANSFER + :ivar id: Name of the Cosmos DB Gremlin graph. 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 graph. + :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy + :ivar partition_key: The configuration of the partition key to be used for partitioning data + into multiple partitions. + :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey + :ivar default_ttl: Default time to live. + :vartype default_ttl: int + :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + constraints on documents in the collection in the Azure Cosmos DB service. + :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy + :ivar conflict_resolution_policy: The conflict resolution policy for the graph. + :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: 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 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 """ - service_type: Literal[ServiceType.DATA_TRANSFER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. DATA_TRANSFER.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) + """A system generated property that denotes the last updated timestamp of the resource.""" + etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) + """A system generated property representing the resource etag required for optimistic concurrency + control.""" @overload def __init__( self, *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + 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, + analytical_storage_ttl: Optional[int] = None, + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @overload @@ -5177,102 +10106,65 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.service_type = ServiceType.DATA_TRANSFER # type: ignore - -class ServiceResourceProperties(_Model): - """Services response resource. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DataTransferServiceResourceProperties, GraphAPIComputeServiceResourceProperties, - MaterializedViewsBuilderServiceResourceProperties, SqlDedicatedGatewayServiceResourceProperties +class GremlinGraphGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Gremlin graph. - :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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of an Azure Cosmos DB Gremlin graph. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinGraphGetProperties + :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 """ - __mapping__: dict[str, _Model] = {} - creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") - """Time of the last state change (ISO-8601 format).""" - instance_size: Optional[Union[str, "_models.ServiceSize"]] = rest_field( - name="instanceSize", visibility=["read", "create", "update", "delete", "query"] - ) - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instance_count: Optional[int] = rest_field( - name="instanceCount", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.GremlinGraphGetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Instance count for the service.""" - service_type: str = rest_discriminator( - name="serviceType", visibility=["read", "create", "update", "delete", "query"] + """The properties of an Azure Cosmos DB Gremlin graph.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update"]) + """The location of the resource group to which the resource belongs.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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\\".""" + identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """ServiceType for the service. Required. Known values are: \"SqlDedicatedGateway\", - \"DataTransfer\", \"GraphAPICompute\", and \"MaterializedViewsBuilder\".""" - status: Optional[Union[str, "_models.ServiceStatus"]] = rest_field(visibility=["read"]) - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - - @overload - def __init__( - self, - *, - service_type: str, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - - -class DataTransferServiceResourceProperties(ServiceResourceProperties, discriminator="DataTransfer"): - """Properties for DataTransferServiceResource. - - :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 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 locations: An array that contains all of the locations for the service. - :vartype locations: list[~azure.mgmt.cosmosdb.models.DataTransferRegionalServiceResource] - :ivar service_type: ServiceType for the service. Required. DATA_TRANSFER. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.DATA_TRANSFER - """ + """Identity for the resource.""" - locations: Optional[list["_models.DataTransferRegionalServiceResource"]] = rest_field(visibility=["read"]) - """An array that contains all of the locations for the service.""" - service_type: Literal[ServiceType.DATA_TRANSFER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. DATA_TRANSFER.""" + __flattened_items = ["resource", "options"] @overload def __init__( self, *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + properties: Optional["_models.GremlinGraphGetProperties"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -5283,69 +10175,57 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - self.service_type = ServiceType.DATA_TRANSFER # type: ignore - - -class ErrorAdditionalInfo(_Model): - """The resource management error additional info. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - type: Optional[str] = rest_field(visibility=["read"]) - """The additional info type.""" - info: Optional[Any] = rest_field(visibility=["read"]) - """The additional info.""" - - -class ErrorDetail(_Model): - """The error detail. + for k, v in _flattened_input.items(): + setattr(self, k, v) - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.cosmosdb.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.cosmosdb.models.ErrorAdditionalInfo] - """ + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - code: Optional[str] = rest_field(visibility=["read"]) - """The error code.""" - message: Optional[str] = rest_field(visibility=["read"]) - """The error message.""" - target: Optional[str] = rest_field(visibility=["read"]) - """The error target.""" - details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) - """The error details.""" - additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( - name="additionalInfo", visibility=["read"] - ) - """The error additional info.""" + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) -class ErrorResponse(_Model): - """Error response. +class GremlinRoleAssignmentResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB Gremlin Role Assignment. - :ivar error: The error object. - :vartype error: ~azure.mgmt.cosmosdb.models.ErrorDetail + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Assignment. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResourceProperties """ - error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The error object.""" + properties: Optional["_models.GremlinRoleAssignmentResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update an Azure Cosmos DB Gremlin Role Assignment.""" + + __flattened_items = ["role_definition_id", "scope", "principal_id", "provisioning_state"] @overload def __init__( self, *, - error: Optional["_models.ErrorDetail"] = None, + properties: Optional["_models.GremlinRoleAssignmentResourceProperties"] = None, ) -> None: ... @overload @@ -5356,29 +10236,66 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class ErrorResponseAutoGenerated(_Model): - """Error Response. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str + +class GremlinRoleAssignmentResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB Gremlin Role Assignment resource object. + + :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 + Gremlin 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 Gremlin 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 """ - code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Error code.""" - message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Error message indicating why the operation failed.""" + role_definition_id: Optional[str] = rest_field( + name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique identifier for the associated Role Definition.""" + scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The data plane resource path for which access is being granted through this Gremlin Role + Assignment.""" + principal_id: Optional[str] = rest_field( + name="principalId", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique identifier for the associated AAD principal in the AAD graph to which access is + being granted through this Gremlin Role Assignment. Tenant ID for the principal is inferred + using the tenant associated with the subscription.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Provisioning state of the resource.""" @overload def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, + role_definition_id: Optional[str] = None, + scope: Optional[str] = None, + principal_id: Optional[str] = None, ) -> None: ... @overload @@ -5392,23 +10309,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExcludedPath(_Model): - """ExcludedPath. +class GremlinRoleDefinitionResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB Gremlin Role Definition. - :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 id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResourceProperties """ - path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path for which the indexing behavior applies to. Index paths typically start with root and - end with wildcard (/path/*).""" + properties: Optional["_models.GremlinRoleDefinitionResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update an Azure Cosmos DB Gremlin Role Definition.""" + + __flattened_items = ["id", "role_name", "type", "assignable_scopes", "permissions"] @overload def __init__( self, *, - path: Optional[str] = None, + properties: Optional["_models.GremlinRoleDefinitionResourceProperties"] = None, ) -> None: ... @overload @@ -5419,26 +10349,79 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) -class FailoverPolicies(_Model): - """The list of new failover policies for the failover priority change. +class GremlinRoleDefinitionResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB Gremlin Role Definition resource object. - :ivar failover_policies: List of failover policies. Required. - :vartype failover_policies: list[~azure.mgmt.cosmosdb.models.FailoverPolicy] + :ivar id: The path id for the Role Definition. + :vartype 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: 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 Gremlin 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] """ - failover_policies: list["_models.FailoverPolicy"] = rest_field( - name="failoverPolicies", visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path id for the Role Definition.""" + role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) + """A user-friendly name for the Role Definition. Must be unique for the database account.""" + type: Optional[Union[str, "_models.RoleDefinitionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """List of failover policies. Required.""" + """Indicates whether the Role Definition was built-in or user created. Known values are: + \"BuiltInRole\" and \"CustomRole\".""" + assignable_scopes: Optional[list[str]] = rest_field( + name="assignableScopes", visibility=["read", "create", "update", "delete", "query"] + ) + """A set of fully qualified Scopes at or below which Gremlin 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.""" + permissions: Optional[list["_models.Permission"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of operations allowed through this Role Definition.""" @overload def __init__( self, *, - failover_policies: list["_models.FailoverPolicy"], + id: Optional[str] = None, # pylint: disable=redefined-builtin + role_name: Optional[str] = None, + type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, + assignable_scopes: Optional[list[str]] = None, + permissions: Optional[list["_models.Permission"]] = None, ) -> None: ... @overload @@ -5452,41 +10435,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FailoverPolicy(_Model): - """The failover policy for a given region of a database account. +class IncludedPath(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The paths that are included in indexing. - :ivar id: The unique identifier of the region in which the database account replicates to. - Example: <accountName>-<locationName>. - :vartype id: str - :ivar location_name: The name of the region in which the database account exists. - :vartype location_name: str - :ivar failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int + :ivar path: The path for which the indexing behavior applies to. Index paths typically start + with root and end with wildcard (/path/*). + :vartype path: str + :ivar indexes: List of indexes for this path. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] """ - id: Optional[str] = rest_field(visibility=["read"]) - """The unique identifier of the region in which the database account replicates to. Example: - <accountName>-<locationName>.""" - location_name: Optional[str] = rest_field( - name="locationName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the region in which the database account exists.""" - failover_priority: Optional[int] = rest_field( - name="failoverPriority", visibility=["read", "create", "update", "delete", "query"] - ) - """The failover priority of the region. A failover priority of 0 indicates a write region. The - maximum value for a failover priority = (total number of regions - 1). Failover priority values - must be unique for each of the regions in which the database account exists.""" + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path for which the indexing behavior applies to. Index paths typically start with root and + end with wildcard (/path/*).""" + indexes: Optional[list["_models.Indexes"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of indexes for this path.""" @overload def __init__( self, *, - location_name: Optional[str] = None, - failover_priority: Optional[int] = None, + path: Optional[str] = None, + indexes: Optional[list["_models.Indexes"]] = None, ) -> None: ... @overload @@ -5500,37 +10470,37 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TrackedResource(Resource): - """Tracked Resource. +class Indexes(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The indexes for the path. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar 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 + :ivar data_type: The datatype for which the indexing behavior is applied to. Known values are: + "String", "Number", "Point", "Polygon", "LineString", and "MultiPolygon". + :vartype data_type: str or ~azure.mgmt.cosmosdb.models.DataType + :ivar precision: The precision of the index. -1 is maximum precision. + :vartype precision: int + :ivar kind: Indicates the type of index. Known values are: "Hash", "Range", and "Spatial". + :vartype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind """ - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource tags.""" - location: str = rest_field(visibility=["read", "create"]) - """The geo-location where the resource lives. Required.""" + data_type: Optional[Union[str, "_models.DataType"]] = rest_field( + name="dataType", visibility=["read", "create", "update", "delete", "query"] + ) + """The datatype for which the indexing behavior is applied to. Known values are: \"String\", + \"Number\", \"Point\", \"Polygon\", \"LineString\", and \"MultiPolygon\".""" + precision: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The precision of the index. -1 is maximum precision.""" + kind: Optional[Union[str, "_models.IndexKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the type of index. Known values are: \"Hash\", \"Range\", and \"Spatial\".""" @overload def __init__( self, *, - location: str, - tags: Optional[dict[str, str]] = None, + data_type: Optional[Union[str, "_models.DataType"]] = None, + precision: Optional[int] = None, + kind: Optional[Union[str, "_models.IndexKind"]] = None, ) -> None: ... @overload @@ -5544,42 +10514,71 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FleetResource(TrackedResource): - """An Azure Cosmos DB FleetResource. +class IndexingPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB indexing policy. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar 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 - :ivar properties: Properties to update Azure Cosmos DB fleet resource. - :vartype properties: ~azure.mgmt.cosmosdb.models.FleetResourceProperties + :ivar automatic: Indicates if the indexing policy is automatic. + :vartype automatic: bool + :ivar indexing_mode: Indicates the indexing mode. Known values are: "consistent", "lazy", and + "none". + :vartype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode + :ivar included_paths: List of paths to include in the indexing. + :vartype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] + :ivar excluded_paths: List of paths to exclude from indexing. + :vartype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] + :ivar composite_indexes: List of composite path list. + :vartype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] + :ivar spatial_indexes: List of spatial specifics. + :vartype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] + :ivar vector_indexes: List of paths to include in the vector indexing. + :vartype vector_indexes: list[~azure.mgmt.cosmosdb.models.VectorIndex] + :ivar full_text_indexes: List of paths to include in the full text indexing. + :vartype full_text_indexes: list[~azure.mgmt.cosmosdb.models.FullTextIndexPath] """ - properties: Optional["_models.FleetResourceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + automatic: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates if the indexing policy is automatic.""" + indexing_mode: Optional[Union[str, "_models.IndexingMode"]] = rest_field( + name="indexingMode", visibility=["read", "create", "update", "delete", "query"] ) - """Properties to update Azure Cosmos DB fleet resource.""" - - __flattened_items = ["provisioning_state"] + """Indicates the indexing mode. Known values are: \"consistent\", \"lazy\", and \"none\".""" + included_paths: Optional[list["_models.IncludedPath"]] = rest_field( + name="includedPaths", visibility=["read", "create", "update", "delete", "query"] + ) + """List of paths to include in the indexing.""" + excluded_paths: Optional[list["_models.ExcludedPath"]] = rest_field( + name="excludedPaths", visibility=["read", "create", "update", "delete", "query"] + ) + """List of paths to exclude from indexing.""" + composite_indexes: Optional[list[list["_models.CompositePath"]]] = rest_field( + name="compositeIndexes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of composite path list.""" + spatial_indexes: Optional[list["_models.SpatialSpec"]] = rest_field( + name="spatialIndexes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of spatial specifics.""" + vector_indexes: Optional[list["_models.VectorIndex"]] = rest_field( + name="vectorIndexes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of paths to include in the vector indexing.""" + full_text_indexes: Optional[list["_models.FullTextIndexPath"]] = rest_field( + name="fullTextIndexes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of paths to include in the full text indexing.""" @overload def __init__( self, *, - location: str, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.FleetResourceProperties"] = None, + automatic: Optional[bool] = None, + indexing_mode: Optional[Union[str, "_models.IndexingMode"]] = None, + included_paths: Optional[list["_models.IncludedPath"]] = None, + excluded_paths: Optional[list["_models.ExcludedPath"]] = None, + composite_indexes: Optional[list[list["_models.CompositePath"]]] = None, + spatial_indexes: Optional[list["_models.SpatialSpec"]] = None, + vector_indexes: Optional[list["_models.VectorIndex"]] = None, + full_text_indexes: Optional[list["_models.FullTextIndexPath"]] = None, ) -> None: ... @overload @@ -5590,68 +10589,32 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) - - -class FleetResourceProperties(_Model): - """Properties to update Azure Cosmos DB fleet resource. - - :ivar provisioning_state: A provisioning state of the Fleet. Known values are: "Uninitialized", - "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", "Failed", "Canceled", - "Updating", and "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status - """ - - provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """A provisioning state of the Fleet. Known values are: \"Uninitialized\", \"Initializing\", - \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", - \"Updating\", and \"Creating\".""" -class FleetResourceUpdate(_Model): - """Represents a fleet resource for updates. +class IpAddressOrRange(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """IpAddressOrRange object. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Properties to update Azure Cosmos DB fleet resource. - :vartype properties: ~azure.mgmt.cosmosdb.models.FleetResourceProperties + :ivar ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. + Provided IPs must be well-formatted and cannot be contained in one of the following ranges: + 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by + the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. + :vartype ip_address_or_range: str """ - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource tags.""" - properties: Optional["_models.FleetResourceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + ip_address_or_range: Optional[str] = rest_field( + name="ipAddressOrRange", visibility=["read", "create", "update", "delete", "query"] ) - """Properties to update Azure Cosmos DB fleet resource.""" - - __flattened_items = ["provisioning_state"] + """A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be + well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, + 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address + filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”.""" @overload def __init__( self, *, - tags: Optional[dict[str, str]] = None, - properties: Optional["_models.FleetResourceProperties"] = None, + ip_address_or_range: Optional[str] = None, ) -> None: ... @overload @@ -5662,58 +10625,40 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class FleetspaceAccountProperties(_Model): - """An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account. +class KeyWrapMetadata(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client + encryption key. - :ivar provisioning_state: A provisioning state of the Fleetspace Account. Known values are: - "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", - "Failed", "Canceled", "Updating", and "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status - :ivar global_database_account_properties: Configuration for fleetspace Account in the - fleetspace. - :vartype global_database_account_properties: - ~azure.mgmt.cosmosdb.models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties + :ivar name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). + :vartype name: str + :ivar type: ProviderName of KeyStoreProvider. + :vartype type: str + :ivar value: Reference / link to the KeyEncryptionKey. + :vartype value: str + :ivar algorithm: Algorithm used in wrapping and unwrapping of the data encryption key. + :vartype algorithm: str """ - provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """A provisioning state of the Fleetspace Account. Known values are: \"Uninitialized\", - \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", - \"Canceled\", \"Updating\", and \"Creating\".""" - global_database_account_properties: Optional[ - "_models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties" - ] = rest_field(name="globalDatabaseAccountProperties", visibility=["read", "create", "update", "delete", "query"]) - """Configuration for fleetspace Account in the fleetspace.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of associated KeyEncryptionKey (aka CustomerManagedKey).""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """ProviderName of KeyStoreProvider.""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reference / link to the KeyEncryptionKey.""" + algorithm: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Algorithm used in wrapping and unwrapping of the data encryption key.""" @overload def __init__( self, *, - global_database_account_properties: Optional[ - "_models.FleetspaceAccountPropertiesGlobalDatabaseAccountProperties" - ] = None, + name: Optional[str] = None, + type: Optional[str] = None, + value: Optional[str] = None, + algorithm: Optional[str] = None, ) -> None: ... @overload @@ -5727,31 +10672,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FleetspaceAccountPropertiesGlobalDatabaseAccountProperties(_Model): # pylint: disable=name-too-long - """Configuration for fleetspace Account in the fleetspace. +class Location(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A region in which the Azure Cosmos DB database account is deployed. - :ivar resource_id: The resource identifier of global database account in the Fleetspace - Account. - :vartype resource_id: str - :ivar arm_location: The location of global database account in the Fleetspace Account. - :vartype arm_location: str + :ivar id: The unique identifier of the region within the database account. Example: + <accountName>-<locationName>. + :vartype id: str + :ivar location_name: The name of the region. + :vartype location_name: str + :ivar document_endpoint: The connection endpoint for the specific region. Example: + https://<accountName>-<locationName>.documents.azure.com:443/. + :vartype document_endpoint: str + :ivar provisioning_state: The 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 + - 1). Failover priority values must be unique for each of the regions in which the database + account exists. + :vartype failover_priority: int + :ivar is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone + region. + :vartype is_zone_redundant: bool """ - resource_id: Optional[str] = rest_field( - name="resourceId", visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read"]) + """The unique identifier of the region within the database account. Example: + <accountName>-<locationName>.""" + location_name: Optional[str] = rest_field( + name="locationName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the region.""" + document_endpoint: Optional[str] = rest_field(name="documentEndpoint", visibility=["read"]) + """The connection endpoint for the specific region. Example: + https://<accountName>-<locationName>.documents.azure.com:443/.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state of the resource.""" + failover_priority: Optional[int] = rest_field( + name="failoverPriority", visibility=["read", "create", "update", "delete", "query"] ) - """The resource identifier of global database account in the Fleetspace Account.""" - arm_location: Optional[str] = rest_field( - name="armLocation", visibility=["read", "create", "update", "delete", "query"] + """The failover priority of the region. A failover priority of 0 indicates a write region. The + maximum value for a failover priority = (total number of regions - 1). Failover priority values + must be unique for each of the regions in which the database account exists.""" + is_zone_redundant: Optional[bool] = rest_field( + name="isZoneRedundant", visibility=["read", "create", "update", "delete", "query"] ) - """The location of global database account in the Fleetspace Account.""" + """Flag to indicate whether or not this region is an AvailabilityZone region.""" @overload def __init__( self, *, - resource_id: Optional[str] = None, - arm_location: Optional[str] = None, + location_name: Optional[str] = None, + failover_priority: Optional[int] = None, + is_zone_redundant: Optional[bool] = None, ) -> None: ... @overload @@ -5765,8 +10738,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FleetspaceAccountResource(ProxyResource): - """An Azure Cosmos DB Fleetspace Account. +class LocationGetResult(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB location get result. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -5779,23 +10752,20 @@ class FleetspaceAccountResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: An Azure Cosmos DB Global Database Account which is part of a Fleetspace - Account. - :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceAccountProperties + :ivar properties: Cosmos DB location metadata. + :vartype properties: ~azure.mgmt.cosmosdb.models.LocationProperties """ - properties: Optional["_models.FleetspaceAccountProperties"] = rest_field( + properties: Optional["_models.LocationProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account.""" - - __flattened_items = ["provisioning_state", "global_database_account_properties"] + """Cosmos DB location metadata.""" @overload def __init__( self, *, - properties: Optional["_models.FleetspaceAccountProperties"] = None, + properties: Optional["_models.LocationProperties"] = None, ) -> None: ... @overload @@ -5806,82 +10776,79 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class FleetspaceProperties(_Model): - """Properties to update Azure Cosmos DB Fleetspace. +class LocationProperties(_Model): + """Cosmos DB location metadata. - :ivar provisioning_state: A provisioning state of the Fleetspace. Known values are: + :ivar supports_availability_zone: Flag indicating whether the location supports availability + zones or not. + :vartype supports_availability_zone: bool + :ivar is_residency_restricted: Flag indicating whether the location is residency sensitive. + :vartype is_residency_restricted: bool + :ivar backup_storage_redundancies: The properties of available backup storage redundancies. + :vartype backup_storage_redundancies: list[str or + ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy] + :ivar is_subscription_region_access_allowed_for_regular: Flag indicating whether the + subscription have access in region for Non-Availability Zones. + :vartype is_subscription_region_access_allowed_for_regular: bool + :ivar is_subscription_region_access_allowed_for_az: Flag indicating whether the subscription + 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", "Deleting", "Succeeded", "Failed", "Canceled", "Updating", and "Creating". - :vartype provisioning_state: str or ~azure.mgmt.cosmosdb.models.Status - :ivar fleetspace_api_kind: The kind of API this fleetspace belongs to. Acceptable values: - 'NoSQL'. "NoSQL" - :vartype fleetspace_api_kind: str or - ~azure.mgmt.cosmosdb.models.FleetspacePropertiesFleetspaceApiKind - :ivar service_tier: Service Tier for the fleetspace. GeneralPurpose types refers to single - write region accounts that can be added to this fleetspace, whereas BusinessCritical refers to - multi write region. Known values are: "GeneralPurpose" and "BusinessCritical". - :vartype service_tier: str or ~azure.mgmt.cosmosdb.models.FleetspacePropertiesServiceTier - :ivar data_regions: List of data regions assigned to the fleetspace. Eg [westus2]. - :vartype data_regions: list[str] - :ivar throughput_pool_configuration: Configuration for throughput pool in the fleetspace. - :vartype throughput_pool_configuration: - ~azure.mgmt.cosmosdb.models.FleetspacePropertiesThroughputPoolConfiguration + :vartype status: str or ~azure.mgmt.cosmosdb.models.Status """ - provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( - name="provisioningState", visibility=["read"] - ) - """A provisioning state of the Fleetspace. Known values are: \"Uninitialized\", \"Initializing\", - \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", \"Canceled\", - \"Updating\", and \"Creating\".""" - fleetspace_api_kind: Optional[Union[str, "_models.FleetspacePropertiesFleetspaceApiKind"]] = rest_field( - name="fleetspaceApiKind", visibility=["read", "create", "update", "delete", "query"] + supports_availability_zone: Optional[bool] = rest_field(name="supportsAvailabilityZone", visibility=["read"]) + """Flag indicating whether the location supports availability zones or not.""" + is_residency_restricted: Optional[bool] = rest_field(name="isResidencyRestricted", visibility=["read"]) + """Flag indicating whether the location is residency sensitive.""" + backup_storage_redundancies: Optional[list[Union[str, "_models.BackupStorageRedundancy"]]] = rest_field( + name="backupStorageRedundancies", visibility=["read"] ) - """The kind of API this fleetspace belongs to. Acceptable values: 'NoSQL'. \"NoSQL\"""" - service_tier: Optional[Union[str, "_models.FleetspacePropertiesServiceTier"]] = rest_field( - name="serviceTier", visibility=["read", "create", "update", "delete", "query"] + """The properties of available backup storage redundancies.""" + is_subscription_region_access_allowed_for_regular: Optional[bool] = rest_field( + name="isSubscriptionRegionAccessAllowedForRegular", visibility=["read"] ) - """Service Tier for the fleetspace. GeneralPurpose types refers to single write region accounts - that can be added to this fleetspace, whereas BusinessCritical refers to multi write region. - Known values are: \"GeneralPurpose\" and \"BusinessCritical\".""" - data_regions: Optional[list[str]] = rest_field( - name="dataRegions", visibility=["read", "create", "update", "delete", "query"] + """Flag indicating whether the subscription have access in region for Non-Availability Zones.""" + is_subscription_region_access_allowed_for_az: Optional[bool] = rest_field( + name="isSubscriptionRegionAccessAllowedForAz", visibility=["read"] ) - """List of data regions assigned to the fleetspace. Eg [westus2].""" - throughput_pool_configuration: Optional["_models.FleetspacePropertiesThroughputPoolConfiguration"] = rest_field( - name="throughputPoolConfiguration", visibility=["read", "create", "update", "delete", "query"] + """Flag indicating whether the subscription have access in region for Availability Zones(Az).""" + status: Optional[Union[str, "_models.Status"]] = rest_field(visibility=["read"]) + """Enum to indicate current buildout status of the region. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + + +class ManagedCassandraManagedServiceIdentity(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Identity for the resource. + + :ivar principal_id: The object id of the identity resource. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the resource. + :vartype tenant_id: str + :ivar type: The type of the resource. Known values are: "SystemAssigned" and "None". + :vartype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The object id of the identity resource.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id of the resource.""" + type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Configuration for throughput pool in the fleetspace.""" + """The type of the resource. Known values are: \"SystemAssigned\" and \"None\".""" @overload def __init__( self, *, - fleetspace_api_kind: Optional[Union[str, "_models.FleetspacePropertiesFleetspaceApiKind"]] = None, - service_tier: Optional[Union[str, "_models.FleetspacePropertiesServiceTier"]] = None, - data_regions: Optional[list[str]] = None, - throughput_pool_configuration: Optional["_models.FleetspacePropertiesThroughputPoolConfiguration"] = None, + type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = None, ) -> None: ... @overload @@ -5895,52 +10862,94 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FleetspacePropertiesThroughputPoolConfiguration(_Model): # pylint: disable=name-too-long - """Configuration for throughput pool in the fleetspace. +class ManagedCassandraReaperStatus(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """ManagedCassandraReaperStatus. - :ivar min_throughput: Minimum throughput for the pool. - :vartype min_throughput: int - :ivar max_throughput: Maximum throughput for the pool. - :vartype max_throughput: int - :ivar dedicated_r_us: Total dedicated throughput (RU/s) for fleetspace. Represents the sum of - all manual provisioned throughput and all autoscale max RU/s across all shared throughput - databases and dedicated throughput containers across all accounts in the fleetspace for 1 - region. - :vartype dedicated_r_us: int - :ivar max_consumable_r_us: Maximum consumable throughput (RU/s) for fleetspace. Represents the - maximum throughput that resources in the fleetspace can consume from the fleetspace's pool in 1 - region. - :vartype max_consumable_r_us: int + :ivar healthy: + :vartype healthy: bool + :ivar repair_run_ids: Dictionary of . + :vartype repair_run_ids: dict[str, str] + :ivar repair_schedules: Dictionary of . + :vartype repair_schedules: dict[str, str] """ - min_throughput: Optional[int] = rest_field( - name="minThroughput", visibility=["read", "create", "update", "delete", "query"] + healthy: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + repair_run_ids: Optional[dict[str, str]] = rest_field( + name="repairRunIds", visibility=["read", "create", "update", "delete", "query"] ) - """Minimum throughput for the pool.""" - max_throughput: Optional[int] = rest_field( - name="maxThroughput", visibility=["read", "create", "update", "delete", "query"] + """Dictionary of .""" + repair_schedules: Optional[dict[str, str]] = rest_field( + name="repairSchedules", visibility=["read", "create", "update", "delete", "query"] ) - """Maximum throughput for the pool.""" - dedicated_r_us: Optional[int] = rest_field( - name="dedicatedRUs", visibility=["read", "create", "update", "delete", "query"] + """Dictionary of .""" + + @overload + def __init__( + self, + *, + healthy: Optional[bool] = None, + repair_run_ids: Optional[dict[str, str]] = None, + repair_schedules: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ManagedServiceIdentity(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Identity for the resource. + + :ivar principal_id: The principal id of the system assigned identity. This property will only + be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the service. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with resource. The user + identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.cosmosdb.models.ManagedServiceIdentityUserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of the system assigned identity. This property will only be provided for a + system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Total dedicated throughput (RU/s) for fleetspace. Represents the sum of all manual provisioned - throughput and all autoscale max RU/s across all shared throughput databases and dedicated - throughput containers across all accounts in the fleetspace for 1 region.""" - max_consumable_r_us: Optional[int] = rest_field( - name="maxConsumableRUs", visibility=["read", "create", "update", "delete", "query"] + """The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the service. Known values are: \"SystemAssigned\", \"UserAssigned\", + \"SystemAssigned,UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.ManagedServiceIdentityUserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] ) - """Maximum consumable throughput (RU/s) for fleetspace. Represents the maximum throughput that - resources in the fleetspace can consume from the fleetspace's pool in 1 region.""" + """The list of user identities associated with resource. The user identity dictionary key + references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" @overload def __init__( self, *, - min_throughput: Optional[int] = None, - max_throughput: Optional[int] = None, - dedicated_r_us: Optional[int] = None, - max_consumable_r_us: Optional[int] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.ManagedServiceIdentityUserAssignedIdentity"]] = None, ) -> None: ... @overload @@ -5954,42 +10963,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FleetspaceResource(ProxyResource): - """An Azure Cosmos DB Fleetspace. +class ManagedServiceIdentityUserAssignedIdentity(_Model): # pylint: disable=name-too-long + """ManagedServiceIdentityUserAssignedIdentity. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties to update Azure Cosmos DB Fleetspace. - :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceProperties + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str """ - properties: Optional["_models.FleetspaceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties to update Azure Cosmos DB Fleetspace.""" + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of user assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client id of user assigned identity.""" - __flattened_items = [ - "provisioning_state", - "fleetspace_api_kind", - "service_tier", - "data_regions", - "throughput_pool_configuration", - ] + +class MaterializedViewDefinition(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Materialized View definition for the container. + + :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 + :ivar throughput_bucket_for_build: Throughput bucket assigned for the materialized view + operations on target container. + :vartype throughput_bucket_for_build: int + """ + + source_collection_rid: Optional[str] = rest_field(name="sourceCollectionRid", visibility=["read"]) + """An unique identifier for the source collection. This is a system generated property.""" + source_collection_id: str = rest_field( + name="sourceCollectionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the source container on which the Materialized View will be created. Required.""" + definition: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + throughput_bucket_for_build: Optional[int] = rest_field( + name="throughputBucketForBuild", visibility=["read", "create", "update", "delete", "query"] + ) + """Throughput bucket assigned for the materialized view operations on target container.""" @overload def __init__( self, *, - properties: Optional["_models.FleetspaceProperties"] = None, + source_collection_id: str, + definition: str, + throughput_bucket_for_build: Optional[int] = None, ) -> None: ... @overload @@ -6000,52 +11026,29 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class FleetspaceUpdate(_Model): - """Represents a fleetspace resource for updates. +class MaterializedViewDetails(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """MaterializedViewDetails, contains Id & _rid fields of materialized view. - :ivar properties: Properties of the fleetspace. - :vartype properties: ~azure.mgmt.cosmosdb.models.FleetspaceProperties + :ivar id: Id field of Materialized container. + :vartype id: str + :ivar rid: _rid field of Materialized container. + :vartype rid: str """ - properties: Optional["_models.FleetspaceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties of the fleetspace.""" - - __flattened_items = [ - "provisioning_state", - "fleetspace_api_kind", - "service_tier", - "data_regions", - "throughput_pool_configuration", - ] + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id field of Materialized container.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read", "create", "update", "delete", "query"]) + """_rid field of Materialized container.""" @overload def __init__( self, *, - properties: Optional["_models.FleetspaceProperties"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + rid: Optional[str] = None, ) -> None: ... @overload @@ -6056,42 +11059,45 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) +class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long + """Resource for a regional service location. + :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 + """ -class FullTextIndexPath(_Model): - """Represents the full text index path. - :ivar path: The path to the full text field in the document. Required. - :vartype path: str +class MaterializedViewsBuilderServiceResourceCreateUpdateProperties( + ServiceResourceCreateUpdateProperties, discriminator="MaterializedViewsBuilder" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Properties for Create or Update request for MaterializedViewsBuilderServiceResource. + + :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. MATERIALIZED_VIEWS_BUILDER. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.MATERIALIZED_VIEWS_BUILDER """ - path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path to the full text field in the document. Required.""" + service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" @overload def __init__( self, *, - path: str, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, ) -> None: ... @overload @@ -6103,28 +11109,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.service_type = ServiceType.MATERIALIZED_VIEWS_BUILDER # type: ignore -class FullTextPath(_Model): - """Represents the full text path specification. +class MaterializedViewsBuilderServiceResourceProperties( + ServiceResourceProperties, discriminator="MaterializedViewsBuilder" +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Properties for MaterializedViewsBuilderServiceResource. - :ivar path: The path to the full text field in the document. Required. - :vartype path: str - :ivar language: The language of the full text field in the document. - :vartype language: str + :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 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 locations: An array that contains all of the locations for the service. + :vartype locations: + list[~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource] + :ivar service_type: ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER. + :vartype service_type: str or ~azure.mgmt.cosmosdb.models.MATERIALIZED_VIEWS_BUILDER """ - path: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path to the full text field in the document. Required.""" - language: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The language of the full text field in the document.""" + locations: Optional[list["_models.MaterializedViewsBuilderRegionalServiceResource"]] = rest_field( + visibility=["read"] + ) + """An array that contains all of the locations for the service.""" + service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" @overload def __init__( self, *, - path: str, - language: Optional[str] = None, + instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, + instance_count: Optional[int] = None, ) -> None: ... @overload @@ -6136,32 +11158,27 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.service_type = ServiceType.MATERIALIZED_VIEWS_BUILDER # type: ignore -class FullTextPolicy(_Model): - """Cosmos DB FullText Policy. +class MaterializedViewsProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Materialized Views Properties for the source container. - :ivar default_language: The default language for a full text paths. - :vartype default_language: str - :ivar full_text_paths: List of FullText Paths. - :vartype full_text_paths: list[~azure.mgmt.cosmosdb.models.FullTextPath] + :ivar throughput_bucket_for_build: Throughput bucket assigned for the materialized view + operations on source container. + :vartype throughput_bucket_for_build: int """ - default_language: Optional[str] = rest_field( - name="defaultLanguage", visibility=["read", "create", "update", "delete", "query"] - ) - """The default language for a full text paths.""" - full_text_paths: Optional[list["_models.FullTextPath"]] = rest_field( - name="fullTextPaths", visibility=["read", "create", "update", "delete", "query"] + throughput_bucket_for_build: Optional[int] = rest_field( + name="throughputBucketForBuild", visibility=["read", "create", "update", "delete", "query"] ) - """List of FullText Paths.""" + """Throughput bucket assigned for the materialized view operations on source container.""" @overload def __init__( self, *, - default_language: Optional[str] = None, - full_text_paths: Optional[list["_models.FullTextPath"]] = None, + throughput_bucket_for_build: Optional[int] = None, ) -> None: ... @overload @@ -6175,47 +11192,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. - - :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 graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. - :vartype graph_api_compute_endpoint: str - """ - - graph_api_compute_endpoint: Optional[str] = rest_field(name="graphApiComputeEndpoint", visibility=["read"]) - """The regional endpoint for GraphAPICompute.""" - - -class GraphAPIComputeServiceResourceCreateUpdateProperties( - ServiceResourceCreateUpdateProperties, discriminator="GraphAPICompute" -): # pylint: disable=name-too-long - """Properties for Create or Update request for GraphAPIComputeServiceResource. +class MergeParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB merge operations. - :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. GRAPH_API_COMPUTE. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.GRAPH_API_COMPUTE + :ivar is_dry_run: Specifies whether the operation is a real merge operation or a simulation. + :vartype is_dry_run: bool """ - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" + is_dry_run: Optional[bool] = rest_field(name="isDryRun", visibility=["read", "create", "update", "delete", "query"]) + """Specifies whether the operation is a real merge operation or a simulation.""" @overload def __init__( self, *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + is_dry_run: Optional[bool] = None, ) -> None: ... @overload @@ -6225,64 +11216,143 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.service_type = ServiceType.GRAPH_API_COMPUTE # type: ignore + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Metric(_Model): + """Metric data. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] + """ + + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time for the metric (ISO-8601 format).""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time for the metric (ISO-8601 format).""" + time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) + """The time grain to be used to summarize the metric values.""" + unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) + """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", + \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" + name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) + """The name information for the metric.""" + metric_values: Optional[list["_models.MetricValue"]] = rest_field(name="metricValues", visibility=["read"]) + """The metric values for the specified time window and timestep.""" + + +class MetricAvailability(_Model): + """The availability of the metric. + + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar retention: The retention for the metric values. + :vartype retention: str + """ + + time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) + """The time grain to be used to summarize the metric values.""" + retention: Optional[str] = rest_field(visibility=["read"]) + """The retention for the metric values.""" -class GraphAPIComputeServiceResourceProperties(ServiceResourceProperties, discriminator="GraphAPICompute"): - """Properties for GraphAPIComputeServiceResource. +class MetricDefinition(_Model): + """The definition of a metric. - :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 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 graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :vartype graph_api_compute_endpoint: str - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list[~azure.mgmt.cosmosdb.models.GraphAPIComputeRegionalServiceResource] - :ivar service_type: ServiceType for the service. Required. GRAPH_API_COMPUTE. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.GRAPH_API_COMPUTE + :ivar metric_availabilities: The list of metric availabilities for the account. + :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] + :ivar primary_aggregation_type: The primary aggregation type of the metric. Known values are: + "None", "Average", "Total", "Minimum", "Maximum", and "Last". + :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar resource_uri: The resource uri of the database. + :vartype resource_uri: str + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName """ - graph_api_compute_endpoint: Optional[str] = rest_field( - name="graphApiComputeEndpoint", visibility=["read", "create", "update", "delete", "query"] + metric_availabilities: Optional[list["_models.MetricAvailability"]] = rest_field( + name="metricAvailabilities", visibility=["read"] ) - """GraphAPICompute endpoint for the service.""" - locations: Optional[list["_models.GraphAPIComputeRegionalServiceResource"]] = rest_field(visibility=["read"]) - """An array that contains all of the locations for the service.""" - service_type: Literal[ServiceType.GRAPH_API_COMPUTE] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" + """The list of metric availabilities for the account.""" + primary_aggregation_type: Optional[Union[str, "_models.PrimaryAggregationType"]] = rest_field( + name="primaryAggregationType", visibility=["read"] + ) + """The primary aggregation type of the metric. Known values are: \"None\", \"Average\", \"Total\", + \"Minimum\", \"Maximum\", and \"Last\".""" + unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) + """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", + \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" + resource_uri: Optional[str] = rest_field(name="resourceUri", visibility=["read"]) + """The resource uri of the database.""" + name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) + """The name information for the metric.""" - @overload - def __init__( - self, - *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, - graph_api_compute_endpoint: Optional[str] = None, - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ +class MetricName(_Model): + """A metric name. - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) - self.service_type = ServiceType.GRAPH_API_COMPUTE # type: ignore + :ivar value: The name of the metric. + :vartype value: str + :ivar localized_value: The friendly name of the metric. + :vartype localized_value: str + """ + + value: Optional[str] = rest_field(visibility=["read"]) + """The name of the metric.""" + localized_value: Optional[str] = rest_field(name="localizedValue", visibility=["read"]) + """The friendly name of the metric.""" -class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Gremlin database. +class MetricValue(_Model): + """Represents metrics values. + + :ivar count: The number of values for the metric. + :vartype count: int + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: ~datetime.datetime + :ivar total: The total value of the metric. + :vartype total: float + """ + + count: Optional[int] = rest_field(name="_count", visibility=["read"]) + """The number of values for the metric.""" + average: Optional[float] = rest_field(visibility=["read"]) + """The average value of the metric.""" + maximum: Optional[float] = rest_field(visibility=["read"]) + """The max value of the metric.""" + minimum: Optional[float] = rest_field(visibility=["read"]) + """The min value of the metric.""" + timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The metric timestamp (ISO-8601 format).""" + total: Optional[float] = rest_field(visibility=["read"]) + """The total value of the metric.""" + + +class MongoDBCollectionCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB MongoDB collection. :ivar id: The unique resource identifier of the ARM resource. :vartype id: str @@ -6301,14 +11371,14 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): :vartype tags: dict[str, str] :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar properties: Properties to create and update Azure Cosmos DB Gremlin database. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateProperties + :ivar properties: Properties to create and update Azure Cosmos DB MongoDB collection. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateProperties """ - properties: "_models.GremlinDatabaseCreateUpdateProperties" = rest_field( + properties: "_models.MongoDBCollectionCreateUpdateProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update Azure Cosmos DB Gremlin database. Required.""" + """Properties to create and update Azure Cosmos DB MongoDB collection. Required.""" __flattened_items = ["resource", "options"] @@ -6316,7 +11386,7 @@ class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - properties: "_models.GremlinDatabaseCreateUpdateProperties", + properties: "_models.MongoDBCollectionCreateUpdateProperties", location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, @@ -6351,18 +11421,20 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class GremlinDatabaseCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB Gremlin database. +class MongoDBCollectionCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB MongoDB collection. - :ivar resource: The standard JSON format of a Gremlin database. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseResource + :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 the headers sent with the request. :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - resource: "_models.GremlinDatabaseResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The standard JSON format of a Gremlin database. Required.""" + resource: "_models.MongoDBCollectionResource" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The standard JSON format of a MongoDB collection. Required.""" options: Optional["_models.CreateUpdateOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6373,7 +11445,7 @@ class GremlinDatabaseCreateUpdateProperties(_Model): def __init__( self, *, - resource: "_models.GremlinDatabaseResource", + resource: "_models.MongoDBCollectionResource", options: Optional["_models.CreateUpdateOptions"] = None, ) -> None: ... @@ -6388,19 +11460,19 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinDatabaseGetProperties(_Model): - """The properties of an Azure Cosmos DB SQL database. +class MongoDBCollectionGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB MongoDB collection. :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesResource + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetPropertiesOptions + :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions """ - resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = rest_field( + resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = rest_field( + options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6408,8 +11480,8 @@ class GremlinDatabaseGetProperties(_Model): def __init__( self, *, - resource: Optional["_models.GremlinDatabaseGetPropertiesResource"] = None, - options: Optional["_models.GremlinDatabaseGetPropertiesOptions"] = None, + resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = None, + options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = None, ) -> None: ... @overload @@ -6423,8 +11495,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinDatabaseGetPropertiesOptions(OptionsResource): - """GremlinDatabaseGetPropertiesOptions. +class MongoDBCollectionGetPropertiesOptions( + OptionsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoDBCollectionGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -6452,11 +11526,17 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinDatabaseResource(_Model): - """Cosmos DB Gremlin database resource object. +class MongoDBCollectionResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB MongoDB collection resource object. - :ivar id: Name of the Cosmos DB Gremlin database. Required. + :ivar id: Name of the Cosmos DB MongoDB collection. Required. :vartype id: str + :ivar shard_key: A key-value pair of shard keys to be applied for the request. + :vartype shard_key: dict[str, str] + :ivar indexes: List of index keys. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: int :ivar 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" @@ -6465,7 +11545,19 @@ class GremlinDatabaseResource(_Model): """ id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB Gremlin database. Required.""" + """Name of the Cosmos DB MongoDB collection. Required.""" + shard_key: Optional[dict[str, str]] = rest_field( + name="shardKey", visibility=["read", "create", "update", "delete", "query"] + ) + """A key-value pair of shard keys to be applied for the request.""" + indexes: Optional[list["_models.MongoIndex"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of index keys.""" + analytical_storage_ttl: Optional[int] = rest_field( + name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical TTL.""" restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -6480,6 +11572,9 @@ def __init__( self, *, id: str, # pylint: disable=redefined-builtin + shard_key: Optional[dict[str, str]] = None, + indexes: Optional[list["_models.MongoIndex"]] = None, + analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @@ -6495,11 +11590,19 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinDatabaseGetPropertiesResource(GremlinDatabaseResource): - """GremlinDatabaseGetPropertiesResource. +class MongoDBCollectionGetPropertiesResource( + MongoDBCollectionResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoDBCollectionGetPropertiesResource. - :ivar id: Name of the Cosmos DB Gremlin database. Required. + :ivar id: Name of the Cosmos DB MongoDB collection. Required. :vartype id: str + :ivar shard_key: A key-value pair of shard keys to be applied for the request. + :vartype shard_key: dict[str, str] + :ivar indexes: List of index keys. + :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] + :ivar analytical_storage_ttl: Analytical TTL. + :vartype analytical_storage_ttl: int :ivar 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" @@ -6527,6 +11630,9 @@ def __init__( self, *, id: str, # pylint: disable=redefined-builtin + shard_key: Optional[dict[str, str]] = None, + indexes: Optional[list["_models.MongoIndex"]] = None, + analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @@ -6542,8 +11648,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinDatabaseGetResults(ProxyResource): - """An Azure Cosmos DB Gremlin database. +class MongoDBCollectionGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB MongoDB collection. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -6556,8 +11662,8 @@ class GremlinDatabaseGetResults(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: The properties of an Azure Cosmos DB SQL database. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetProperties + :ivar properties: The properties of an Azure Cosmos DB MongoDB collection. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetProperties :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 @@ -6571,10 +11677,10 @@ class GremlinDatabaseGetResults(ProxyResource): :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ - properties: Optional["_models.GremlinDatabaseGetProperties"] = rest_field( + properties: Optional["_models.MongoDBCollectionGetProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of an Azure Cosmos DB SQL database.""" + """The properties of an Azure Cosmos DB MongoDB collection.""" location: Optional[str] = rest_field(visibility=["read", "create", "update"]) """The location of the resource group to which the resource belongs.""" tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -6595,7 +11701,7 @@ class GremlinDatabaseGetResults(ProxyResource): def __init__( self, *, - properties: Optional["_models.GremlinDatabaseGetProperties"] = None, + properties: Optional["_models.MongoDBCollectionGetProperties"] = None, location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, @@ -6624,51 +11730,16 @@ def __getattr__(self, name: str) -> Any: def __setattr__(self, key: str, value: Any) -> None: if key in self.__flattened_items: if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) - - -class GremlinDatabaseRestoreResource(_Model): - """Specific Gremlin Databases to restore. - - :ivar database_name: The name of the gremlin database available for restore. - :vartype database_name: str - :ivar graph_names: The names of the graphs available for restore. - :vartype graph_names: list[str] - """ - - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the gremlin database available for restore.""" - graph_names: Optional[list[str]] = rest_field( - name="graphNames", visibility=["read", "create", "update", "delete", "query"] - ) - """The names of the graphs available for restore.""" - - @overload - def __init__( - self, - *, - database_name: Optional[str] = None, - graph_names: Optional[list[str]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) -class GremlinGraphCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB Gremlin graph. +class MongoDBDatabaseCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update Cosmos DB MongoDB database. :ivar id: The unique resource identifier of the ARM resource. :vartype id: str @@ -6687,14 +11758,14 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): :vartype tags: dict[str, str] :ivar identity: Identity for the resource. :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity - :ivar properties: Properties to create and update Azure Cosmos DB Gremlin graph. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateProperties + :ivar properties: Properties to create and update Azure Cosmos DB MongoDB database. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateProperties """ - properties: "_models.GremlinGraphCreateUpdateProperties" = rest_field( + properties: "_models.MongoDBDatabaseCreateUpdateProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update Azure Cosmos DB Gremlin graph. Required.""" + """Properties to create and update Azure Cosmos DB MongoDB database. Required.""" __flattened_items = ["resource", "options"] @@ -6702,7 +11773,7 @@ class GremlinGraphCreateUpdateParameters(ARMResourceProperties): def __init__( self, *, - properties: "_models.GremlinGraphCreateUpdateProperties", + properties: "_models.MongoDBDatabaseCreateUpdateProperties", location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, @@ -6737,18 +11808,18 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class GremlinGraphCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB Gremlin graph. +class MongoDBDatabaseCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to create and update Azure Cosmos DB MongoDB database. - :ivar resource: The standard JSON format of a Gremlin graph. Required. - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphResource + :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 the headers sent with the request. :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions """ - resource: "_models.GremlinGraphResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The standard JSON format of a Gremlin graph. Required.""" + resource: "_models.MongoDBDatabaseResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The standard JSON format of a MongoDB database. Required.""" options: Optional["_models.CreateUpdateOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6759,7 +11830,7 @@ class GremlinGraphCreateUpdateProperties(_Model): def __init__( self, *, - resource: "_models.GremlinGraphResource", + resource: "_models.MongoDBDatabaseResource", options: Optional["_models.CreateUpdateOptions"] = None, ) -> None: ... @@ -6774,19 +11845,19 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinGraphGetProperties(_Model): - """The properties of an Azure Cosmos DB Gremlin graph. +class MongoDBDatabaseGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB MongoDB database. :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesResource + :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.GremlinGraphGetPropertiesOptions + :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions """ - resource: Optional["_models.GremlinGraphGetPropertiesResource"] = rest_field( + resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - options: Optional["_models.GremlinGraphGetPropertiesOptions"] = rest_field( + options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) @@ -6794,8 +11865,8 @@ class GremlinGraphGetProperties(_Model): def __init__( self, *, - resource: Optional["_models.GremlinGraphGetPropertiesResource"] = None, - options: Optional["_models.GremlinGraphGetPropertiesOptions"] = None, + resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = None, + options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = None, ) -> None: ... @overload @@ -6809,8 +11880,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinGraphGetPropertiesOptions(OptionsResource): - """GremlinGraphGetPropertiesOptions. +class MongoDBDatabaseGetPropertiesOptions( + OptionsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoDBDatabaseGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting resource when retrieving offer details. @@ -6838,62 +11911,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinGraphResource(_Model): - """Cosmos DB Gremlin graph resource object. +class MongoDBDatabaseResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB MongoDB database resource object. - :ivar id: Name of the Cosmos DB Gremlin graph. Required. + :ivar id: Name of the Cosmos DB MongoDB 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 graph. - :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: 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" + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB Gremlin graph. Required.""" - indexing_policy: Optional["_models.IndexingPolicy"] = rest_field( - name="indexingPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The configuration of the indexing policy. By default, the indexing is automatic for all - document paths within the graph.""" - partition_key: Optional["_models.ContainerPartitionKey"] = rest_field( - name="partitionKey", visibility=["read", "create", "update", "delete", "query"] - ) - """The configuration of the partition key to be used for partitioning data into multiple - partitions.""" - default_ttl: Optional[int] = rest_field( - name="defaultTtl", visibility=["read", "create", "update", "delete", "query"] - ) - """Default time to live.""" - unique_key_policy: Optional["_models.UniqueKeyPolicy"] = rest_field( - name="uniqueKeyPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The unique key policy configuration for specifying uniqueness constraints on documents in the - collection in the Azure Cosmos DB service.""" - conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = rest_field( - name="conflictResolutionPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The conflict resolution policy for the graph.""" - analytical_storage_ttl: Optional[int] = rest_field( - name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical TTL.""" + """Name of the Cosmos DB MongoDB database. Required.""" restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] ) @@ -6901,19 +11932,13 @@ class GremlinGraphResource(_Model): create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( name="createMode", visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" + """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" @overload 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, - analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @@ -6929,29 +11954,16 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinGraphGetPropertiesResource(GremlinGraphResource): - """GremlinGraphGetPropertiesResource. +class MongoDBDatabaseGetPropertiesResource( + MongoDBDatabaseResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoDBDatabaseGetPropertiesResource. - :ivar id: Name of the Cosmos DB Gremlin graph. Required. + :ivar id: Name of the Cosmos DB MongoDB 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 graph. - :vartype indexing_policy: ~azure.mgmt.cosmosdb.models.IndexingPolicy - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: ~azure.mgmt.cosmosdb.models.ContainerPartitionKey - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness - constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: ~azure.mgmt.cosmosdb.models.UniqueKeyPolicy - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: ~azure.mgmt.cosmosdb.models.ConflictResolutionPolicy - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: 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" + :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode :ivar rid: A system generated property. A unique identifier. @@ -6976,12 +11988,6 @@ 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, - analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @@ -6997,8 +12003,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinGraphGetResults(ProxyResource): - """An Azure Cosmos DB Gremlin graph. +class MongoDBDatabaseGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB MongoDB database. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -7011,8 +12017,8 @@ class GremlinGraphGetResults(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: The properties of an Azure Cosmos DB Gremlin graph. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinGraphGetProperties + :ivar properties: The properties of an Azure Cosmos DB MongoDB database. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetProperties :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 @@ -7026,10 +12032,10 @@ class GremlinGraphGetResults(ProxyResource): :vartype identity: ~azure.mgmt.cosmosdb.models.ManagedServiceIdentity """ - properties: Optional["_models.GremlinGraphGetProperties"] = rest_field( + properties: Optional["_models.MongoDBDatabaseGetProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of an Azure Cosmos DB Gremlin graph.""" + """The properties of an Azure Cosmos DB MongoDB database.""" location: Optional[str] = rest_field(visibility=["read", "create", "update"]) """The location of the resource group to which the resource belongs.""" tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -7050,7 +12056,7 @@ class GremlinGraphGetResults(ProxyResource): def __init__( self, *, - properties: Optional["_models.GremlinGraphGetProperties"] = None, + properties: Optional["_models.MongoDBDatabaseGetProperties"] = None, location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, @@ -7085,8 +12091,128 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class GremlinRoleAssignmentResource(ProxyResource): - """Parameters to create and update an Azure Cosmos DB Gremlin Role Assignment. +class MongoIndex(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB MongoDB collection index key. + + :ivar key: Cosmos DB MongoDB collection index keys. + :vartype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys + :ivar options: Cosmos DB MongoDB collection index key options. + :vartype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + """ + + key: Optional["_models.MongoIndexKeys"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Cosmos DB MongoDB collection index keys.""" + options: Optional["_models.MongoIndexOptions"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Cosmos DB MongoDB collection index key options.""" + + __flattened_items = ["keys_property"] + + @overload + def __init__( + self, + *, + key: Optional["_models.MongoIndexKeys"] = None, + options: Optional["_models.MongoIndexOptions"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.key is None: + return None + return getattr(self.key, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.key is None: + self.key = self._attr_to_rest_field["key"]._class_type() + setattr(self.key, key, value) + else: + super().__setattr__(key, value) + + +class MongoIndexKeys(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB MongoDB collection resource object. + + :ivar keys_property: List of keys for each MongoDB collection in the Azure Cosmos DB service. + :vartype keys_property: list[str] + """ + + keys_property: Optional[list[str]] = rest_field( + name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" + ) + """List of keys for each MongoDB collection in the Azure Cosmos DB service.""" + + @overload + def __init__( + self, + *, + keys_property: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MongoIndexOptions(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB MongoDB collection index options. + + :ivar expire_after_seconds: Expire after seconds. + :vartype expire_after_seconds: int + :ivar unique: Is unique or not. + :vartype unique: bool + """ + + expire_after_seconds: Optional[int] = rest_field( + name="expireAfterSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """Expire after seconds.""" + unique: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Is unique or not.""" + + @overload + def __init__( + self, + *, + expire_after_seconds: Optional[int] = None, + unique: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MongoMIRoleAssignmentResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB MongoMI Role Assignment. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -7099,14 +12225,14 @@ class GremlinRoleAssignmentResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Assignment. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResourceProperties + :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Assignment. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoMIRoleAssignmentResourceProperties """ - properties: Optional["_models.GremlinRoleAssignmentResourceProperties"] = rest_field( + properties: Optional["_models.MongoMIRoleAssignmentResourceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update an Azure Cosmos DB Gremlin Role Assignment.""" + """Properties to create and update an Azure Cosmos DB MongoMI Role Assignment.""" __flattened_items = ["role_definition_id", "scope", "principal_id", "provisioning_state"] @@ -7114,7 +12240,7 @@ class GremlinRoleAssignmentResource(ProxyResource): def __init__( self, *, - properties: Optional["_models.GremlinRoleAssignmentResourceProperties"] = None, + properties: Optional["_models.MongoMIRoleAssignmentResourceProperties"] = None, ) -> None: ... @overload @@ -7146,16 +12272,16 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class GremlinRoleAssignmentResourceProperties(_Model): - """Azure Cosmos DB Gremlin Role Assignment resource object. +class MongoMIRoleAssignmentResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB MongoMI Role Assignment resource object. :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 - Gremlin Role Assignment. + MongoMI 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 Gremlin Role Assignment. Tenant ID for the principal + which access is being granted through this MongoMI 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. @@ -7167,13 +12293,13 @@ class GremlinRoleAssignmentResourceProperties(_Model): ) """The unique identifier for the associated Role Definition.""" scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The data plane resource path for which access is being granted through this Gremlin Role + """The data plane resource path for which access is being granted through this MongoMI Role Assignment.""" principal_id: Optional[str] = rest_field( name="principalId", visibility=["read", "create", "update", "delete", "query"] ) """The unique identifier for the associated AAD principal in the AAD graph to which access is - being granted through this Gremlin Role Assignment. Tenant ID for the principal is inferred + being granted through this MongoMI Role Assignment. Tenant ID for the principal is inferred using the tenant associated with the subscription.""" provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) """Provisioning state of the resource.""" @@ -7198,8 +12324,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GremlinRoleDefinitionResource(ProxyResource): - """Parameters to create and update an Azure Cosmos DB Gremlin Role Definition. +class MongoMIRoleDefinitionResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB MongoMI Role Definition. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -7212,14 +12338,14 @@ class GremlinRoleDefinitionResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResourceProperties + :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoMIRoleDefinitionResourceProperties """ - properties: Optional["_models.GremlinRoleDefinitionResourceProperties"] = rest_field( + properties: Optional["_models.MongoMIRoleDefinitionResourceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update an Azure Cosmos DB Gremlin Role Definition.""" + """Properties to create and update an Azure Cosmos DB MongoMI Role Definition.""" __flattened_items = ["id", "role_name", "type", "assignable_scopes", "permissions"] @@ -7227,7 +12353,7 @@ class GremlinRoleDefinitionResource(ProxyResource): def __init__( self, *, - properties: Optional["_models.GremlinRoleDefinitionResourceProperties"] = None, + properties: Optional["_models.MongoMIRoleDefinitionResourceProperties"] = None, ) -> None: ... @overload @@ -7259,8 +12385,8 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class GremlinRoleDefinitionResourceProperties(_Model): - """Azure Cosmos DB Gremlin Role Definition resource object. +class MongoMIRoleDefinitionResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB MongoMI Role Definition resource object. :ivar id: The path id for the Role Definition. :vartype id: str @@ -7270,7 +12396,7 @@ class GremlinRoleDefinitionResourceProperties(_Model): :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 Gremlin Role + :ivar assignable_scopes: A set of fully qualified Scopes at or below which MongoMI 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 @@ -7280,37 +12406,262 @@ class GremlinRoleDefinitionResourceProperties(_Model): :vartype permissions: list[~azure.mgmt.cosmosdb.models.Permission] """ - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path id for the Role Definition.""" - role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) - """A user-friendly name for the Role Definition. Must be unique for the database account.""" - type: Optional[Union[str, "_models.RoleDefinitionType"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path id for the Role Definition.""" + role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) + """A user-friendly name for the Role Definition. Must be unique for the database account.""" + type: Optional[Union[str, "_models.RoleDefinitionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the Role Definition was built-in or user created. Known values are: + \"BuiltInRole\" and \"CustomRole\".""" + assignable_scopes: Optional[list[str]] = rest_field( + name="assignableScopes", visibility=["read", "create", "update", "delete", "query"] + ) + """A set of fully qualified Scopes at or below which MongoMI 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.""" + permissions: Optional[list["_models.Permission"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of operations allowed through this Role Definition.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + role_name: Optional[str] = None, + type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, + assignable_scopes: Optional[list[str]] = None, + permissions: Optional[list["_models.Permission"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MongoRoleDefinitionCreateUpdateParameters( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB Mongo Role Definition. + + :ivar properties: Properties to create and update an Azure Cosmos DB Mongo Role Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionResource + """ + + properties: Optional["_models.MongoRoleDefinitionResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to create and update an Azure Cosmos DB Mongo Role Definition.""" + + __flattened_items = ["role_name", "type", "database_name", "privileges", "roles"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.MongoRoleDefinitionResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MongoRoleDefinitionGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Mongo Role Definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties related to the Mongo Role Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionResource + """ + + properties: Optional["_models.MongoRoleDefinitionResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties related to the Mongo Role Definition.""" + + __flattened_items = ["role_name", "type", "database_name", "privileges", "roles"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.MongoRoleDefinitionResource"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class MongoRoleDefinitionResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB Mongo Role Definition resource object. + + :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.MongoRoleDefinitionType + :ivar database_name: The database name for which access is being granted for this Role + Definition. + :vartype database_name: str + :ivar privileges: A set of privileges contained by the Role Definition. This will allow + application of this Role Definition on the entire database account or any underlying Database / + Collection. Scopes higher than Database are not enforceable as privilege. + :vartype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] + :ivar roles: The set of roles inherited by this Role Definition. + :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] + """ + + role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) + """A user-friendly name for the Role Definition. Must be unique for the database account.""" + type: Optional[Union[str, "_models.MongoRoleDefinitionType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the Role Definition was built-in or user created. Known values are: + \"BuiltInRole\" and \"CustomRole\".""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] + ) + """The database name for which access is being granted for this Role Definition.""" + privileges: Optional[list["_models.Privilege"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A set of privileges contained by the Role Definition. This will allow application of this Role + Definition on the entire database account or any underlying Database / Collection. Scopes + higher than Database are not enforceable as privilege.""" + roles: Optional[list["_models.Role"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The set of roles inherited by this Role Definition.""" + + @overload + def __init__( + self, + *, + role_name: Optional[str] = None, + type: Optional[Union[str, "_models.MongoRoleDefinitionType"]] = None, + database_name: Optional[str] = None, + privileges: Optional[list["_models.Privilege"]] = None, + roles: Optional[list["_models.Role"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MongoRUToMongoRUCopyJobProperties( + BaseCopyJobProperties, discriminator="MongoRUToMongoRU" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Source Mongo to Destination Mongo copy job properties. + + :ivar source_details: Source Mongo DataStore details. + :vartype source_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar destination_details: Destination Mongo DataStore details. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.MongoRUToMongoRUCopyJobTask] + :ivar job_type: Copy Job Type. Required. MONGO_RU_TO_MONGO_RU. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.MONGO_RU_TO_MONGO_RU + """ + + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] ) - """Indicates whether the Role Definition was built-in or user created. Known values are: - \"BuiltInRole\" and \"CustomRole\".""" - assignable_scopes: Optional[list[str]] = rest_field( - name="assignableScopes", visibility=["read", "create", "update", "delete", "query"] + """Source Mongo DataStore details.""" + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] ) - """A set of fully qualified Scopes at or below which Gremlin 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.""" - permissions: Optional[list["_models.Permission"]] = rest_field( + """Destination Mongo DataStore details.""" + tasks: list["_models.MongoRUToMongoRUCopyJobTask"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The set of operations allowed through this Role Definition.""" + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.MONGO_RU_TO_MONGO_RU] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. MONGO_RU_TO_MONGO_RU.""" @overload def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - role_name: Optional[str] = None, - type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, - assignable_scopes: Optional[list[str]] = None, - permissions: Optional[list["_models.Permission"]] = None, + tasks: list["_models.MongoRUToMongoRUCopyJobTask"], + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, ) -> None: ... @overload @@ -7322,30 +12673,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.job_type = CopyJobType.MONGO_RU_TO_MONGO_RU # type: ignore -class IncludedPath(_Model): - """The paths that are included in indexing. +class MongoRUToMongoRUCopyJobTask(BaseCopyJobTask): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoRUToMongoRUCopyJobTask. - :ivar path: The path for which the indexing behavior applies to. Index paths typically start - with root and end with wildcard (/path/*). - :vartype path: str - :ivar indexes: List of indexes for this path. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.Indexes] + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source Mongo (RU) collection. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.CosmosDBMongoCollection + :ivar destination: Destination Mongo (RU) collection. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.CosmosDBMongoCollection """ - path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path for which the indexing behavior applies to. Index paths typically start with root and - end with wildcard (/path/*).""" - indexes: Optional[list["_models.Indexes"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """List of indexes for this path.""" + source: "_models.CosmosDBMongoCollection" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source Mongo (RU) collection. Required.""" + destination: "_models.CosmosDBMongoCollection" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Mongo (RU) collection. Required.""" @overload def __init__( self, *, - path: Optional[str] = None, - indexes: Optional[list["_models.Indexes"]] = None, + source: "_models.CosmosDBMongoCollection", + destination: "_models.CosmosDBMongoCollection", ) -> None: ... @overload @@ -7359,37 +12715,43 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Indexes(_Model): - """The indexes for the path. +class MongoRUToMongoVCoreCopyJobProperties( + BaseCopyJobProperties, discriminator="MongoRUToMongoVCore" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Source Mongo to Destination Mongo vCore copy job properties. - :ivar data_type: The datatype for which the indexing behavior is applied to. Known values are: - "String", "Number", "Point", "Polygon", "LineString", and "MultiPolygon". - :vartype data_type: str or ~azure.mgmt.cosmosdb.models.DataType - :ivar precision: The precision of the index. -1 is maximum precision. - :vartype precision: int - :ivar kind: Indicates the type of index. Known values are: "Hash", "Range", and "Spatial". - :vartype kind: str or ~azure.mgmt.cosmosdb.models.IndexKind + :ivar source_details: Source Mongo (RU) DataStore details. + :vartype source_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar destination_details: Destination Mongo (vCore) DataStore details. Required. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.MongoVCoreSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.MongoRUToMongoVCoreCopyJobTask] + :ivar job_type: Copy Job Type. Required. MONGO_RU_TO_MONGO_V_CORE. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.MONGO_RU_TO_MONGO_V_CORE """ - data_type: Optional[Union[str, "_models.DataType"]] = rest_field( - name="dataType", visibility=["read", "create", "update", "delete", "query"] + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] ) - """The datatype for which the indexing behavior is applied to. Known values are: \"String\", - \"Number\", \"Point\", \"Polygon\", \"LineString\", and \"MultiPolygon\".""" - precision: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The precision of the index. -1 is maximum precision.""" - kind: Optional[Union[str, "_models.IndexKind"]] = rest_field( + """Source Mongo (RU) DataStore details.""" + destination_details: "_models.MongoVCoreSourceSinkDetails" = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination Mongo (vCore) DataStore details. Required.""" + tasks: list["_models.MongoRUToMongoVCoreCopyJobTask"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Indicates the type of index. Known values are: \"Hash\", \"Range\", and \"Spatial\".""" + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. MONGO_RU_TO_MONGO_V_CORE.""" @overload def __init__( self, *, - data_type: Optional[Union[str, "_models.DataType"]] = None, - precision: Optional[int] = None, - kind: Optional[Union[str, "_models.IndexKind"]] = None, + destination_details: "_models.MongoVCoreSourceSinkDetails", + tasks: list["_models.MongoRUToMongoVCoreCopyJobTask"], + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, ) -> None: ... @overload @@ -7401,73 +12763,35 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + self.job_type = CopyJobType.MONGO_RU_TO_MONGO_V_CORE # type: ignore -class IndexingPolicy(_Model): - """Cosmos DB indexing policy. +class MongoRUToMongoVCoreCopyJobTask(BaseCopyJobTask): # pylint: disable=docstring-keyword-should-match-keyword-only + """MongoRUToMongoVCoreCopyJobTask. - :ivar automatic: Indicates if the indexing policy is automatic. - :vartype automatic: bool - :ivar indexing_mode: Indicates the indexing mode. Known values are: "consistent", "lazy", and - "none". - :vartype indexing_mode: str or ~azure.mgmt.cosmosdb.models.IndexingMode - :ivar included_paths: List of paths to include in the indexing. - :vartype included_paths: list[~azure.mgmt.cosmosdb.models.IncludedPath] - :ivar excluded_paths: List of paths to exclude from indexing. - :vartype excluded_paths: list[~azure.mgmt.cosmosdb.models.ExcludedPath] - :ivar composite_indexes: List of composite path list. - :vartype composite_indexes: list[list[~azure.mgmt.cosmosdb.models.CompositePath]] - :ivar spatial_indexes: List of spatial specifics. - :vartype spatial_indexes: list[~azure.mgmt.cosmosdb.models.SpatialSpec] - :ivar vector_indexes: List of paths to include in the vector indexing. - :vartype vector_indexes: list[~azure.mgmt.cosmosdb.models.VectorIndex] - :ivar full_text_indexes: List of paths to include in the full text indexing. - :vartype full_text_indexes: list[~azure.mgmt.cosmosdb.models.FullTextIndexPath] + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source Mongo (RU) collection. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.CosmosDBMongoCollection + :ivar destination: Destination Mongo (vCore) collection. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.CosmosDBMongoVCoreCollection """ - automatic: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Indicates if the indexing policy is automatic.""" - indexing_mode: Optional[Union[str, "_models.IndexingMode"]] = rest_field( - name="indexingMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates the indexing mode. Known values are: \"consistent\", \"lazy\", and \"none\".""" - included_paths: Optional[list["_models.IncludedPath"]] = rest_field( - name="includedPaths", visibility=["read", "create", "update", "delete", "query"] - ) - """List of paths to include in the indexing.""" - excluded_paths: Optional[list["_models.ExcludedPath"]] = rest_field( - name="excludedPaths", visibility=["read", "create", "update", "delete", "query"] - ) - """List of paths to exclude from indexing.""" - composite_indexes: Optional[list[list["_models.CompositePath"]]] = rest_field( - name="compositeIndexes", visibility=["read", "create", "update", "delete", "query"] - ) - """List of composite path list.""" - spatial_indexes: Optional[list["_models.SpatialSpec"]] = rest_field( - name="spatialIndexes", visibility=["read", "create", "update", "delete", "query"] - ) - """List of spatial specifics.""" - vector_indexes: Optional[list["_models.VectorIndex"]] = rest_field( - name="vectorIndexes", visibility=["read", "create", "update", "delete", "query"] - ) - """List of paths to include in the vector indexing.""" - full_text_indexes: Optional[list["_models.FullTextIndexPath"]] = rest_field( - name="fullTextIndexes", visibility=["read", "create", "update", "delete", "query"] + source: "_models.CosmosDBMongoCollection" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source Mongo (RU) collection. Required.""" + destination: "_models.CosmosDBMongoVCoreCollection" = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """List of paths to include in the full text indexing.""" + """Destination Mongo (vCore) collection. Required.""" @overload def __init__( self, *, - automatic: Optional[bool] = None, - indexing_mode: Optional[Union[str, "_models.IndexingMode"]] = None, - included_paths: Optional[list["_models.IncludedPath"]] = None, - excluded_paths: Optional[list["_models.ExcludedPath"]] = None, - composite_indexes: Optional[list[list["_models.CompositePath"]]] = None, - spatial_indexes: Optional[list["_models.SpatialSpec"]] = None, - vector_indexes: Optional[list["_models.VectorIndex"]] = None, - full_text_indexes: Optional[list["_models.FullTextIndexPath"]] = None, + source: "_models.CosmosDBMongoCollection", + destination: "_models.CosmosDBMongoVCoreCollection", ) -> None: ... @overload @@ -7481,29 +12805,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class IpAddressOrRange(_Model): - """IpAddressOrRange object. +class MongoUserDefinitionCreateUpdateParameters( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Parameters to create and update an Azure Cosmos DB Mongo User Definition. - :ivar ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. - Provided IPs must be well-formatted and cannot be contained in one of the following ranges: - 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by - the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - :vartype ip_address_or_range: str + :ivar properties: Properties to create and update an Azure Cosmos DB Mongo User Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionResource """ - ip_address_or_range: Optional[str] = rest_field( - name="ipAddressOrRange", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.MongoUserDefinitionResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be - well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, - 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address - filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”.""" + """Properties to create and update an Azure Cosmos DB Mongo User Definition.""" + + __flattened_items = ["user_name", "password", "database_name", "custom_data", "roles", "mechanisms"] @overload def __init__( self, *, - ip_address_or_range: Optional[str] = None, + properties: Optional["_models.MongoUserDefinitionResource"] = None, ) -> None: ... @overload @@ -7514,40 +12836,57 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) -class KeyWrapMetadata(_Model): - """Represents key wrap metadata that a key wrapping provider can use to wrap/unwrap a client - encryption key. +class MongoUserDefinitionGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB User Definition. - :ivar name: The name of associated KeyEncryptionKey (aka CustomerManagedKey). + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar type: ProviderName of KeyStoreProvider. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar value: Reference / link to the KeyEncryptionKey. - :vartype value: str - :ivar algorithm: Algorithm used in wrapping and unwrapping of the data encryption key. - :vartype algorithm: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Properties related to the User Definition. + :vartype properties: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionResource """ - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The name of associated KeyEncryptionKey (aka CustomerManagedKey).""" - type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """ProviderName of KeyStoreProvider.""" - value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Reference / link to the KeyEncryptionKey.""" - algorithm: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Algorithm used in wrapping and unwrapping of the data encryption key.""" + properties: Optional["_models.MongoUserDefinitionResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties related to the User Definition.""" + + __flattened_items = ["user_name", "password", "database_name", "custom_data", "roles", "mechanisms"] @overload def __init__( self, *, - name: Optional[str] = None, - type: Optional[str] = None, - value: Optional[str] = None, - algorithm: Optional[str] = None, + properties: Optional["_models.MongoUserDefinitionResource"] = None, ) -> None: ... @overload @@ -7558,62 +12897,73 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class Location(_Model): - """A region in which the Azure Cosmos DB database account is deployed. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar id: The unique identifier of the region within the database account. Example: - <accountName>-<locationName>. - :vartype id: str - :ivar location_name: The name of the region. - :vartype location_name: str - :ivar document_endpoint: The connection endpoint for the specific region. Example: - https://<accountName>-<locationName>.documents.azure.com:443/. - :vartype document_endpoint: str - :ivar provisioning_state: The 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 - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int - :ivar is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone - region. - :vartype is_zone_redundant: bool - """ - id: Optional[str] = rest_field(visibility=["read"]) - """The unique identifier of the region within the database account. Example: - <accountName>-<locationName>.""" - location_name: Optional[str] = rest_field( - name="locationName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the region.""" - document_endpoint: Optional[str] = rest_field(name="documentEndpoint", visibility=["read"]) - """The connection endpoint for the specific region. Example: - https://<accountName>-<locationName>.documents.azure.com:443/.""" - provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) - """The provisioning state of the resource.""" - failover_priority: Optional[int] = rest_field( - name="failoverPriority", visibility=["read", "create", "update", "delete", "query"] +class MongoUserDefinitionResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Azure Cosmos DB Mongo User Definition resource object. + + :ivar user_name: The user name for User Definition. + :vartype user_name: str + :ivar password: The password for User Definition. Response does not contain user password. + :vartype password: str + :ivar database_name: The database name for which access is being granted for this User + Definition. + :vartype database_name: str + :ivar custom_data: A custom definition for the USer Definition. + :vartype custom_data: str + :ivar roles: The set of roles inherited by the User Definition. + :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] + :ivar mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism + SCRAM-SHA-256. + :vartype mechanisms: str + """ + + user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) + """The user name for User Definition.""" + password: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password for User Definition. Response does not contain user password.""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] ) - """The failover priority of the region. A failover priority of 0 indicates a write region. The - maximum value for a failover priority = (total number of regions - 1). Failover priority values - must be unique for each of the regions in which the database account exists.""" - is_zone_redundant: Optional[bool] = rest_field( - name="isZoneRedundant", visibility=["read", "create", "update", "delete", "query"] + """The database name for which access is being granted for this User Definition.""" + custom_data: Optional[str] = rest_field( + name="customData", visibility=["read", "create", "update", "delete", "query"] ) - """Flag to indicate whether or not this region is an AvailabilityZone region.""" + """A custom definition for the USer Definition.""" + roles: Optional[list["_models.Role"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The set of roles inherited by the User Definition.""" + mechanisms: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.""" @overload def __init__( self, *, - location_name: Optional[str] = None, - failover_priority: Optional[int] = None, - is_zone_redundant: Optional[bool] = None, + 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, ) -> None: ... @overload @@ -7627,34 +12977,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class LocationGetResult(ProxyResource): - """Cosmos DB location get result. +class MongoVCoreSourceSinkDetails(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """A CosmosDB Mongo vCore data source/sink details. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Cosmos DB location metadata. - :vartype properties: ~azure.mgmt.cosmosdb.models.LocationProperties + :ivar host_name: + :vartype host_name: str + :ivar connection_string_key_vault_uri: URI of Azure KeyVault secret containing connection + string. + :vartype connection_string_key_vault_uri: str """ - properties: Optional["_models.LocationProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + host_name: Optional[str] = rest_field(name="hostName", visibility=["read", "create", "update", "delete", "query"]) + connection_string_key_vault_uri: Optional[str] = rest_field( + name="connectionStringKeyVaultUri", visibility=["read", "create", "update", "delete", "query"] ) - """Cosmos DB location metadata.""" + """URI of Azure KeyVault secret containing connection string.""" @overload def __init__( self, *, - properties: Optional["_models.LocationProperties"] = None, + host_name: Optional[str] = None, + connection_string_key_vault_uri: Optional[str] = None, ) -> None: ... @overload @@ -7668,76 +13012,33 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class LocationProperties(_Model): - """Cosmos DB location metadata. - - :ivar supports_availability_zone: Flag indicating whether the location supports availability - zones or not. - :vartype supports_availability_zone: bool - :ivar is_residency_restricted: Flag indicating whether the location is residency sensitive. - :vartype is_residency_restricted: bool - :ivar backup_storage_redundancies: The properties of available backup storage redundancies. - :vartype backup_storage_redundancies: list[str or - ~azure.mgmt.cosmosdb.models.BackupStorageRedundancy] - :ivar is_subscription_region_access_allowed_for_regular: Flag indicating whether the - subscription have access in region for Non-Availability Zones. - :vartype is_subscription_region_access_allowed_for_regular: bool - :ivar is_subscription_region_access_allowed_for_az: Flag indicating whether the subscription - 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", "Deleting", "Succeeded", - "Failed", "Canceled", "Updating", and "Creating". - :vartype status: str or ~azure.mgmt.cosmosdb.models.Status - """ - - supports_availability_zone: Optional[bool] = rest_field(name="supportsAvailabilityZone", visibility=["read"]) - """Flag indicating whether the location supports availability zones or not.""" - is_residency_restricted: Optional[bool] = rest_field(name="isResidencyRestricted", visibility=["read"]) - """Flag indicating whether the location is residency sensitive.""" - backup_storage_redundancies: Optional[list[Union[str, "_models.BackupStorageRedundancy"]]] = rest_field( - name="backupStorageRedundancies", visibility=["read"] - ) - """The properties of available backup storage redundancies.""" - is_subscription_region_access_allowed_for_regular: Optional[bool] = rest_field( - name="isSubscriptionRegionAccessAllowedForRegular", visibility=["read"] - ) - """Flag indicating whether the subscription have access in region for Non-Availability Zones.""" - is_subscription_region_access_allowed_for_az: Optional[bool] = rest_field( - name="isSubscriptionRegionAccessAllowedForAz", visibility=["read"] - ) - """Flag indicating whether the subscription have access in region for Availability Zones(Az).""" - status: Optional[Union[str, "_models.Status"]] = rest_field(visibility=["read"]) - """Enum to indicate current buildout status of the region. Known values are: \"Uninitialized\", - \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", - \"Canceled\", \"Updating\", and \"Creating\".""" - - -class ManagedCassandraManagedServiceIdentity(_Model): - """Identity for the resource. +class NetworkSecurityPerimeter(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Information about a network security perimeter (NSP). - :ivar principal_id: The object id of the identity resource. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the resource. - :vartype tenant_id: str - :ivar type: The type of the resource. Known values are: "SystemAssigned" and "None". - :vartype type: str or ~azure.mgmt.cosmosdb.models.ManagedCassandraResourceIdentityType + :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 """ - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The object id of the identity resource.""" - tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) - """The tenant id of the resource.""" - type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fully qualified Azure resource ID of the NSP resource.""" + perimeter_guid: Optional[str] = rest_field( + name="perimeterGuid", visibility=["read", "create", "update", "delete", "query"] ) - """The type of the resource. Known values are: \"SystemAssigned\" and \"None\".""" + """Universal unique ID (UUID) of the network security perimeter.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """Location of the network security perimeter.""" @overload def __init__( self, *, - type: Optional[Union[str, "_models.ManagedCassandraResourceIdentityType"]] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + perimeter_guid: Optional[str] = None, + location: Optional[str] = None, ) -> None: ... @overload @@ -7751,34 +13052,37 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedCassandraReaperStatus(_Model): - """ManagedCassandraReaperStatus. +class NetworkSecurityPerimeterConfiguration( + ProxyResource +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Network security perimeter (NSP) configuration resource. - :ivar healthy: - :vartype healthy: bool - :ivar repair_run_ids: Dictionary of . - :vartype repair_run_ids: dict[str, str] - :ivar repair_schedules: Dictionary of . - :vartype repair_schedules: dict[str, str] + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :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 """ - healthy: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - repair_run_ids: Optional[dict[str, str]] = rest_field( - name="repairRunIds", visibility=["read", "create", "update", "delete", "query"] - ) - """Dictionary of .""" - repair_schedules: Optional[dict[str, str]] = rest_field( - name="repairSchedules", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Dictionary of .""" + """Network security configuration properties.""" @overload def __init__( self, *, - healthy: Optional[bool] = None, - repair_run_ids: Optional[dict[str, str]] = None, - repair_schedules: Optional[dict[str, str]] = None, + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = None, ) -> None: ... @overload @@ -7792,53 +13096,56 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedServiceIdentity(_Model): - """Identity for the resource. - - :ivar principal_id: The principal id of the system assigned identity. This property will only - be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' - includes both an implicitly created identity and a set of user assigned identities. The type - 'None' will remove any identities from the service. Known values are: "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.cosmosdb.models.ResourceIdentityType - :ivar user_assigned_identities: The list of user identities associated with resource. The user - identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.cosmosdb.models.ManagedServiceIdentityUserAssignedIdentity] - """ +class NetworkSecurityPerimeterConfigurationProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Network security configuration properties. - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The principal id of the system assigned identity. This property will only be provided for a - system assigned identity.""" - tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) - """The tenant id of the system assigned identity. This property will only be provided for a system - assigned identity.""" - type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + :ivar provisioning_state: Provisioning state of the network security perimeter configuration. + 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 the network security perimeter (NSP). + :vartype network_security_perimeter: ~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeter + :ivar resource_association: Information about the resource association. + :vartype resource_association: ~azure.mgmt.cosmosdb.models.ResourceAssociation + :ivar profile: Network security perimeter configuration profile. + :vartype profile: ~azure.mgmt.cosmosdb.models.NetworkSecurityProfile + """ + + provisioning_state: Optional[Union[str, "_models.NetworkSecurityPerimeterConfigurationProvisioningState"]] = ( + rest_field(name="provisioningState", visibility=["read"]) + ) + """Provisioning state of the network security perimeter configuration. Known values are: + \"Succeeded\", \"Creating\", \"Updating\", \"Deleting\", \"Accepted\", \"Failed\", and + \"Canceled\".""" + provisioning_issues: Optional[list["_models.ProvisioningIssue"]] = rest_field( + name="provisioningIssues", visibility=["read"] + ) + """List of provisioning issues, if any.""" + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = rest_field( + name="networkSecurityPerimeter", visibility=["read", "create", "update", "delete", "query"] + ) + """Information about the network security perimeter (NSP).""" + resource_association: Optional["_models.ResourceAssociation"] = rest_field( + name="resourceAssociation", visibility=["read", "create", "update", "delete", "query"] + ) + """Information about the resource association.""" + profile: Optional["_models.NetworkSecurityProfile"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes - both an implicitly created identity and a set of user assigned identities. The type 'None' will - remove any identities from the service. Known values are: \"SystemAssigned\", \"UserAssigned\", - \"SystemAssigned,UserAssigned\", and \"None\".""" - user_assigned_identities: Optional[dict[str, "_models.ManagedServiceIdentityUserAssignedIdentity"]] = rest_field( - name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] - ) - """The list of user identities associated with resource. The user identity dictionary key - references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + """Network security perimeter configuration profile.""" @overload def __init__( self, *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.ManagedServiceIdentityUserAssignedIdentity"]] = None, + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, + resource_association: Optional["_models.ResourceAssociation"] = None, + profile: Optional["_models.NetworkSecurityProfile"] = None, ) -> None: ... @overload @@ -7852,57 +13159,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ManagedServiceIdentityUserAssignedIdentity(_Model): # pylint: disable=name-too-long - """ManagedServiceIdentityUserAssignedIdentity. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) - """The principal id of user assigned identity.""" - client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) - """The client id of user assigned identity.""" - - -class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long - """Resource for a regional service location. +class NetworkSecurityProfile(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Network security perimeter configuration profile. - :ivar name: The regional service name. + :ivar name: Name of the profile. :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 - """ - - -class MaterializedViewsBuilderServiceResourceCreateUpdateProperties( - ServiceResourceCreateUpdateProperties, discriminator="MaterializedViewsBuilder" -): # pylint: disable=name-too-long - """Properties for Create or Update request for MaterializedViewsBuilderServiceResource. - - :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. MATERIALIZED_VIEWS_BUILDER. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.MATERIALIZED_VIEWS_BUILDER + :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] """ - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the profile.""" + access_rules_version: Optional[int] = rest_field( + name="accessRulesVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current access rules version.""" + access_rules: Optional[list["_models.AccessRule"]] = rest_field( + name="accessRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Access Rules.""" + diagnostic_settings_version: Optional[int] = rest_field( + name="diagnosticSettingsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current diagnostic settings version.""" + enabled_log_categories: Optional[list[str]] = rest_field( + name="enabledLogCategories", visibility=["read", "create", "update", "delete", "query"] + ) + """List of log categories that are enabled.""" @overload def __init__( self, *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + 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, ) -> None: ... @overload @@ -7914,44 +13213,45 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.service_type = ServiceType.MATERIALIZED_VIEWS_BUILDER # type: ignore -class MaterializedViewsBuilderServiceResourceProperties( - ServiceResourceProperties, discriminator="MaterializedViewsBuilder" -): # pylint: disable=name-too-long - """Properties for MaterializedViewsBuilderServiceResource. +class NoSqlRUToNoSqlRUCopyJobProperties( + BaseCopyJobProperties, discriminator="NoSqlRUToNoSqlRU" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Source SQL to Destination SQL copy job properties. - :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 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 locations: An array that contains all of the locations for the service. - :vartype locations: - list[~azure.mgmt.cosmosdb.models.MaterializedViewsBuilderRegionalServiceResource] - :ivar service_type: ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER. - :vartype service_type: str or ~azure.mgmt.cosmosdb.models.MATERIALIZED_VIEWS_BUILDER + :ivar source_details: Source SQL DataStore details. + :vartype source_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar destination_details: Destination SQL DataStore details. + :vartype destination_details: ~azure.mgmt.cosmosdb.models.CosmosDBSourceSinkDetails + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list[~azure.mgmt.cosmosdb.models.NoSqlRUToNoSqlRUCopyJobTask] + :ivar job_type: Copy Job Type. Required. NO_SQL_RU_TO_NO_SQL_RU. + :vartype job_type: str or ~azure.mgmt.cosmosdb.models.NO_SQL_RU_TO_NO_SQL_RU """ - locations: Optional[list["_models.MaterializedViewsBuilderRegionalServiceResource"]] = rest_field( - visibility=["read"] + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="sourceDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Source SQL DataStore details.""" + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = rest_field( + name="destinationDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Destination SQL DataStore details.""" + tasks: list["_models.NoSqlRUToNoSqlRUCopyJobTask"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """An array that contains all of the locations for the service.""" - service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] = rest_discriminator(name="serviceType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" + """Copy Job tasks. Required.""" + job_type: Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU] = rest_discriminator(name="jobType", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Copy Job Type. Required. NO_SQL_RU_TO_NO_SQL_RU.""" @overload def __init__( self, *, - instance_size: Optional[Union[str, "_models.ServiceSize"]] = None, - instance_count: Optional[int] = None, + tasks: list["_models.NoSqlRUToNoSqlRUCopyJobTask"], + source_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, + destination_details: Optional["_models.CosmosDBSourceSinkDetails"] = None, ) -> None: ... @overload @@ -7963,177 +13263,78 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - self.service_type = ServiceType.MATERIALIZED_VIEWS_BUILDER # type: ignore - - -class Metric(_Model): - """Metric data. - - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] - """ - - start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") - """The start time for the metric (ISO-8601 format).""" - end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") - """The end time for the metric (ISO-8601 format).""" - time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) - """The time grain to be used to summarize the metric values.""" - unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) - """The name information for the metric.""" - metric_values: Optional[list["_models.MetricValue"]] = rest_field(name="metricValues", visibility=["read"]) - """The metric values for the specified time window and timestep.""" - - -class MetricAvailability(_Model): - """The availability of the metric. - - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar retention: The retention for the metric values. - :vartype retention: str - """ - - time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) - """The time grain to be used to summarize the metric values.""" - retention: Optional[str] = rest_field(visibility=["read"]) - """The retention for the metric values.""" + self.job_type = CopyJobType.NO_SQL_RU_TO_NO_SQL_RU # type: ignore -class MetricDefinition(_Model): - """The definition of a metric. +class NoSqlRUToNoSqlRUCopyJobTask(BaseCopyJobTask): # pylint: disable=docstring-keyword-should-match-keyword-only + """NoSqlRUToNoSqlRUCopyJobTask. - :ivar metric_availabilities: The list of metric availabilities for the account. - :vartype metric_availabilities: list[~azure.mgmt.cosmosdb.models.MetricAvailability] - :ivar primary_aggregation_type: The primary aggregation type of the metric. Known values are: - "None", "Average", "Total", "Minimum", "Maximum", and "Last". - :vartype primary_aggregation_type: str or ~azure.mgmt.cosmosdb.models.PrimaryAggregationType - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar resource_uri: The resource uri of the database. - :vartype resource_uri: str - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar total_count: Task level Total Count. + :vartype total_count: int + :ivar processed_count: Task level Processed Count. + :vartype processed_count: int + :ivar source: Source SQL container. Required. + :vartype source: ~azure.mgmt.cosmosdb.models.CosmosDBNoSqlContainer + :ivar destination: Destination SQL container. Required. + :vartype destination: ~azure.mgmt.cosmosdb.models.CosmosDBNoSqlContainer """ - metric_availabilities: Optional[list["_models.MetricAvailability"]] = rest_field( - name="metricAvailabilities", visibility=["read"] - ) - """The list of metric availabilities for the account.""" - primary_aggregation_type: Optional[Union[str, "_models.PrimaryAggregationType"]] = rest_field( - name="primaryAggregationType", visibility=["read"] + source: "_models.CosmosDBNoSqlContainer" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Source SQL container. Required.""" + destination: "_models.CosmosDBNoSqlContainer" = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The primary aggregation type of the metric. Known values are: \"None\", \"Average\", \"Total\", - \"Minimum\", \"Maximum\", and \"Last\".""" - unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - resource_uri: Optional[str] = rest_field(name="resourceUri", visibility=["read"]) - """The resource uri of the database.""" - name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) - """The name information for the metric.""" - - -class MetricName(_Model): - """A metric name. - - :ivar value: The name of the metric. - :vartype value: str - :ivar localized_value: The friendly name of the metric. - :vartype localized_value: str - """ - - value: Optional[str] = rest_field(visibility=["read"]) - """The name of the metric.""" - localized_value: Optional[str] = rest_field(name="localizedValue", visibility=["read"]) - """The friendly name of the metric.""" + """Destination SQL container. Required.""" + @overload + def __init__( + self, + *, + source: "_models.CosmosDBNoSqlContainer", + destination: "_models.CosmosDBNoSqlContainer", + ) -> None: ... -class MetricValue(_Model): - """Represents metrics values. - - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: ~datetime.datetime - :ivar total: The total value of the metric. - :vartype total: float - """ + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - count: Optional[int] = rest_field(name="_count", visibility=["read"]) - """The number of values for the metric.""" - average: Optional[float] = rest_field(visibility=["read"]) - """The average value of the metric.""" - maximum: Optional[float] = rest_field(visibility=["read"]) - """The max value of the metric.""" - minimum: Optional[float] = rest_field(visibility=["read"]) - """The min value of the metric.""" - timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") - """The metric timestamp (ISO-8601 format).""" - total: Optional[float] = rest_field(visibility=["read"]) - """The total value of the metric.""" + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB MongoDB collection. +class NotebookWorkspace(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A notebook workspace resource. - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of Azure resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar 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 properties: Properties to create and update Azure Cosmos DB MongoDB collection. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateProperties + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceProperties """ - properties: "_models.MongoDBCollectionCreateUpdateProperties" = rest_field( + properties: Optional["_models.NotebookWorkspaceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update Azure Cosmos DB MongoDB collection. Required.""" + """Resource properties.""" - __flattened_items = ["resource", "options"] + __flattened_items = ["notebook_server_endpoint", "status"] @overload def __init__( self, *, - properties: "_models.MongoDBCollectionCreateUpdateProperties", - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.NotebookWorkspaceProperties"] = None, ) -> None: ... @overload @@ -8165,67 +13366,73 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class MongoDBCollectionCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB MongoDB collection. +class NotebookWorkspaceConnectionInfoResult(_Model): + """The connection info for the given notebook workspace. - :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 - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :ivar auth_token: Specifies auth token used for connecting to Notebook server (uses token-based + auth). + :vartype auth_token: str + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str """ - resource: "_models.MongoDBCollectionResource" = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The standard JSON format of a MongoDB collection. Required.""" - options: Optional["_models.CreateUpdateOptions"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """A key-value pair of options to be applied for the request. This corresponds to the headers sent - with the request.""" + auth_token: Optional[str] = rest_field(name="authToken", visibility=["read"]) + """Specifies auth token used for connecting to Notebook server (uses token-based auth).""" + notebook_server_endpoint: Optional[str] = rest_field(name="notebookServerEndpoint", visibility=["read"]) + """Specifies the endpoint of Notebook server.""" - @overload - def __init__( - self, - *, - resource: "_models.MongoDBCollectionResource", - options: Optional["_models.CreateUpdateOptions"] = None, - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ +class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): + """Parameters to create a notebook workspace resource. - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + :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 + """ -class MongoDBCollectionGetProperties(_Model): - """The properties of an Azure Cosmos DB MongoDB collection. +class NotebookWorkspaceProperties(_Model): + """Properties of a notebook workspace resource. - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetPropertiesOptions + :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. + :vartype notebook_server_endpoint: str + :ivar status: Status of the notebook workspace. Possible values are: Creating, Online, + Deleting, Failed, Updating. + :vartype status: str + """ + + notebook_server_endpoint: Optional[str] = rest_field(name="notebookServerEndpoint", visibility=["read"]) + """Specifies the endpoint of Notebook server.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, + Updating.""" + + +class Operation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """REST API operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.cosmosdb.models.OperationDisplay """ - resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = rest_field( + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplay"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) + """The object that represents the operation.""" @overload def __init__( self, *, - resource: Optional["_models.MongoDBCollectionGetPropertiesResource"] = None, - options: Optional["_models.MongoDBCollectionGetPropertiesOptions"] = None, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, ) -> None: ... @overload @@ -8239,22 +13446,38 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBCollectionGetPropertiesOptions(OptionsResource): - """MongoDBCollectionGetPropertiesOptions. +class OperationDisplay(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The object that represents the operation. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :ivar provider: Service provider: Microsoft.ResourceProvider. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ + provider: Optional[str] = rest_field(name="Provider", visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft.ResourceProvider.""" + resource: Optional[str] = rest_field(name="Resource", visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed: Profile, endpoint, etc.""" + operation: Optional[str] = rest_field(name="Operation", visibility=["read", "create", "update", "delete", "query"]) + """Operation type: Read, write, delete, etc.""" + description: Optional[str] = rest_field( + name="Description", visibility=["read", "create", "update", "delete", "query"] + ) + """Description of operation.""" + @overload def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, ) -> None: ... @overload @@ -8268,253 +13491,199 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBCollectionResource(_Model): - """Cosmos DB MongoDB collection resource object. +class PartitionMetric(Metric): + """The metric values for a single partition. - :ivar id: Name of the Cosmos DB MongoDB collection. Required. - :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] - :ivar indexes: List of index keys. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int - :ivar 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 start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] + :ivar partition_id: The partition id (GUID identifier) of the metric values. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer identifier) of the metric + values. + :vartype partition_key_range_id: str """ - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB MongoDB collection. Required.""" - shard_key: Optional[dict[str, str]] = rest_field( - name="shardKey", visibility=["read", "create", "update", "delete", "query"] - ) - """A key-value pair of shard keys to be applied for the request.""" - indexes: Optional[list["_models.MongoIndex"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """List of index keys.""" - analytical_storage_ttl: Optional[int] = rest_field( - name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical TTL.""" - restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Parameters to indicate the information about the restore.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" - - @overload - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - shard_key: Optional[dict[str, str]] = None, - indexes: Optional[list["_models.MongoIndex"]] = None, - analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + partition_id: Optional[str] = rest_field(name="partitionId", visibility=["read"]) + """The partition id (GUID identifier) of the metric values.""" + partition_key_range_id: Optional[str] = rest_field(name="partitionKeyRangeId", visibility=["read"]) + """The partition key range id (integer identifier) of the metric values.""" -class MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource): - """MongoDBCollectionGetPropertiesResource. +class Usage(_Model): + """The usage data for a usage request. - :ivar id: Name of the Cosmos DB MongoDB collection. Required. - :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] - :ivar indexes: List of index keys. - :vartype indexes: list[~azure.mgmt.cosmosdb.models.MongoIndex] - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int - :ivar 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 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 unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric. + :vartype limit: int + :ivar current_value: Current value for this metric. + :vartype current_value: int """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) - """A system generated property that denotes the last updated timestamp of the resource.""" - etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) - """A system generated property representing the resource etag required for optimistic concurrency - control.""" + unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) + """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", + \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" + name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) + """The name information for the metric.""" + quota_period: Optional[str] = rest_field(name="quotaPeriod", visibility=["read"]) + """The quota period used to summarize the usage values.""" + limit: Optional[int] = rest_field(visibility=["read"]) + """Maximum value for this metric.""" + current_value: Optional[int] = rest_field(name="currentValue", visibility=["read"]) + """Current value for this metric.""" - @overload - def __init__( - self, - *, - id: str, # pylint: disable=redefined-builtin - shard_key: Optional[dict[str, str]] = None, - indexes: Optional[list["_models.MongoIndex"]] = None, - analytical_storage_ttl: Optional[int] = None, - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, - ) -> None: ... - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ +class PartitionUsage(Usage): + """The partition level usage data for a usage request. - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar quota_period: The quota period used to summarize the usage values. + :vartype quota_period: str + :ivar limit: Maximum value for this metric. + :vartype limit: int + :ivar current_value: Current value for this metric. + :vartype current_value: int + :ivar partition_id: The partition id (GUID identifier) of the usages. + :vartype partition_id: str + :ivar partition_key_range_id: The partition key range id (integer identifier) of the usages. + :vartype partition_key_range_id: str + """ + partition_id: Optional[str] = rest_field(name="partitionId", visibility=["read"]) + """The partition id (GUID identifier) of the usages.""" + partition_key_range_id: Optional[str] = rest_field(name="partitionKeyRangeId", visibility=["read"]) + """The partition key range id (integer identifier) of the usages.""" -class MongoDBCollectionGetResults(ProxyResource): - """An Azure Cosmos DB MongoDB collection. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: The properties of an Azure Cosmos DB MongoDB collection. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetProperties - :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 +class PercentileMetric(_Model): + """Percentile Metric data. + + :ivar start_time: The start time for the metric (ISO-8601 format). + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time for the metric (ISO-8601 format). + :vartype end_time: ~datetime.datetime + :ivar time_grain: The time grain to be used to summarize the metric values. + :vartype time_grain: str + :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond", and "Milliseconds". + :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType + :ivar name: The name information for the metric. + :vartype name: ~azure.mgmt.cosmosdb.models.MetricName + :ivar metric_values: The percentile metric values for the specified time window and timestep. + :vartype metric_values: list[~azure.mgmt.cosmosdb.models.PercentileMetricValue] """ - properties: Optional["_models.MongoDBCollectionGetProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The properties of an Azure Cosmos DB MongoDB collection.""" - location: Optional[str] = rest_field(visibility=["read", "create", "update"]) - """The location of the resource group to which the resource belongs.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """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\\".""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """The start time for the metric (ISO-8601 format).""" + end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") + """The end time for the metric (ISO-8601 format).""" + time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) + """The time grain to be used to summarize the metric values.""" + unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) + """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", + \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" + name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) + """The name information for the metric.""" + metric_values: Optional[list["_models.PercentileMetricValue"]] = rest_field( + name="metricValues", visibility=["read"] ) - """Identity for the resource.""" - - __flattened_items = ["resource", "options"] - - @overload - def __init__( - self, - *, - properties: Optional["_models.MongoDBCollectionGetProperties"] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - ) -> None: ... + """The percentile metric values for the specified time window and timestep.""" - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} - super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) +class PercentileMetricValue(MetricValue): + """Represents percentile metrics values. - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + :ivar count: The number of values for the metric. + :vartype count: int + :ivar average: The average value of the metric. + :vartype average: float + :ivar maximum: The max value of the metric. + :vartype maximum: float + :ivar minimum: The min value of the metric. + :vartype minimum: float + :ivar timestamp: The metric timestamp (ISO-8601 format). + :vartype timestamp: ~datetime.datetime + :ivar total: The total value of the metric. + :vartype total: float + :ivar p10: The 10th percentile value for the metric. + :vartype p10: float + :ivar p25: The 25th percentile value for the metric. + :vartype p25: float + :ivar p50: The 50th percentile value for the metric. + :vartype p50: float + :ivar p75: The 75th percentile value for the metric. + :vartype p75: float + :ivar p90: The 90th percentile value for the metric. + :vartype p90: float + :ivar p95: The 95th percentile value for the metric. + :vartype p95: float + :ivar p99: The 99th percentile value for the metric. + :vartype p99: float + """ - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) + p10: Optional[float] = rest_field(name="P10", visibility=["read"]) + """The 10th percentile value for the metric.""" + p25: Optional[float] = rest_field(name="P25", visibility=["read"]) + """The 25th percentile value for the metric.""" + p50: Optional[float] = rest_field(name="P50", visibility=["read"]) + """The 50th percentile value for the metric.""" + p75: Optional[float] = rest_field(name="P75", visibility=["read"]) + """The 75th percentile value for the metric.""" + p90: Optional[float] = rest_field(name="P90", visibility=["read"]) + """The 90th percentile value for the metric.""" + p95: Optional[float] = rest_field(name="P95", visibility=["read"]) + """The 95th percentile value for the metric.""" + p99: Optional[float] = rest_field(name="P99", visibility=["read"]) + """The 99th percentile value for the metric.""" -class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB MongoDB database. +class PeriodicModeBackupPolicy( + BackupPolicy, discriminator="Periodic" +): # pylint: disable=docstring-keyword-should-match-keyword-only + """The object representing periodic mode backup policy. - :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 properties: Properties to create and update Azure Cosmos DB MongoDB database. Required. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateProperties + :ivar migration_state: The object representing the state of the migration between the backup + policies. + :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState + :ivar periodic_mode_properties: Configuration values for periodic mode backup. + :vartype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties + :ivar type: Describes the mode of backups. Required. PERIODIC. + :vartype type: str or ~azure.mgmt.cosmosdb.models.PERIODIC """ - properties: "_models.MongoDBDatabaseCreateUpdateProperties" = rest_field( - visibility=["read", "create", "update", "delete", "query"] + periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = rest_field( + name="periodicModeProperties", visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update Azure Cosmos DB MongoDB database. Required.""" - - __flattened_items = ["resource", "options"] + """Configuration values for periodic mode backup.""" + type: Literal[BackupPolicyType.PERIODIC] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Describes the mode of backups. Required. PERIODIC.""" @overload def __init__( self, *, - properties: "_models.MongoDBDatabaseCreateUpdateProperties", - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, + migration_state: Optional["_models.BackupPolicyMigrationState"] = None, + periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, ) -> None: ... @overload @@ -8525,51 +13694,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) + self.type = BackupPolicyType.PERIODIC # type: ignore -class MongoDBDatabaseCreateUpdateProperties(_Model): - """Properties to create and update Azure Cosmos DB MongoDB database. +class PeriodicModeProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Configuration values for periodic mode backup. - :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 - the headers sent with the request. - :vartype options: ~azure.mgmt.cosmosdb.models.CreateUpdateOptions + :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 """ - resource: "_models.MongoDBDatabaseResource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The standard JSON format of a MongoDB database. Required.""" - options: Optional["_models.CreateUpdateOptions"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + backup_interval_in_minutes: Optional[int] = rest_field( + name="backupIntervalInMinutes", visibility=["read", "create", "update", "delete", "query"] ) - """A key-value pair of options to be applied for the request. This corresponds to the headers sent - with the request.""" + """An integer representing the interval in minutes between two backups.""" + backup_retention_interval_in_hours: Optional[int] = rest_field( + name="backupRetentionIntervalInHours", visibility=["read", "create", "update", "delete", "query"] + ) + """An integer representing the time (in hours) that each backup is retained.""" + backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field( + name="backupStorageRedundancy", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate type of backup residency. Known values are: \"Geo\", \"Local\", and \"Zone\".""" @overload def __init__( self, *, - resource: "_models.MongoDBDatabaseResource", - options: Optional["_models.CreateUpdateOptions"] = None, + backup_interval_in_minutes: Optional[int] = None, + backup_retention_interval_in_hours: Optional[int] = None, + backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = None, ) -> None: ... @overload @@ -8583,28 +13745,35 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBDatabaseGetProperties(_Model): - """The properties of an Azure Cosmos DB MongoDB database. +class Permission(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The set of data plane operations permitted through this Role Definition. - :ivar resource: - :vartype resource: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesResource - :ivar options: - :vartype options: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetPropertiesOptions + :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] """ - resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The id for the permission.""" + data_actions: Optional[list[str]] = rest_field( + name="dataActions", visibility=["read", "create", "update", "delete", "query"] ) - options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + """An array of data actions that are allowed.""" + not_data_actions: Optional[list[str]] = rest_field( + name="notDataActions", visibility=["read", "create", "update", "delete", "query"] ) + """An array of data actions that are denied.""" @overload def __init__( self, *, - resource: Optional["_models.MongoDBDatabaseGetPropertiesResource"] = None, - options: Optional["_models.MongoDBDatabaseGetPropertiesOptions"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + data_actions: Optional[list[str]] = None, + not_data_actions: Optional[list[str]] = None, ) -> None: ... @overload @@ -8618,22 +13787,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBDatabaseGetPropertiesOptions(OptionsResource): - """MongoDBDatabaseGetPropertiesOptions. +class PhysicalPartitionId(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """PhysicalPartitionId object. - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: ~azure.mgmt.cosmosdb.models.AutoscaleSettings + :ivar id: Id of a physical partition. Required. + :vartype id: str """ + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of a physical partition. Required.""" + @overload def __init__( self, *, - throughput: Optional[int] = None, - autoscale_settings: Optional["_models.AutoscaleSettings"] = None, + id: str, # pylint: disable=redefined-builtin ) -> None: ... @overload @@ -8647,36 +13815,56 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBDatabaseResource(_Model): - """Cosmos DB MongoDB database resource object. +class PhysicalPartitionStorageInfo(_Model): + """The storage of a physical partition. - :ivar id: Name of the Cosmos DB MongoDB database. Required. + :ivar id: The unique identifier of the partition. :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 account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar storage_in_kb: The storage in KB for the physical partition. + :vartype storage_in_kb: float """ - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB MongoDB database. Required.""" - restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read"]) + """The unique identifier of the partition.""" + storage_in_kb: Optional[float] = rest_field(name="storageInKB", visibility=["read"]) + """The storage in KB for the physical partition.""" + + +class PhysicalPartitionStorageInfoCollection(_Model): + """List of physical partitions and their properties returned by a merge operation. + + :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] + """ + + physical_partition_storage_info_collection: Optional[list["_models.PhysicalPartitionStorageInfo"]] = rest_field( + name="physicalPartitionStorageInfoCollection", visibility=["read"] ) - """Parameters to indicate the information about the restore.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] + """List of physical partitions and their properties.""" + + +class PhysicalPartitionThroughputInfoProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoProperties object. + + :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. + :vartype physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] + """ + + physical_partition_throughput_info: Optional[list["_models.PhysicalPartitionThroughputInfoResource"]] = rest_field( + name="physicalPartitionThroughputInfo", visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + """Array of physical partition throughput info objects.""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + physical_partition_throughput_info: Optional[list["_models.PhysicalPartitionThroughputInfoResource"]] = None, ) -> None: ... @overload @@ -8690,40 +13878,33 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource): - """MongoDBDatabaseGetPropertiesResource. +class PhysicalPartitionThroughputInfoResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """PhysicalPartitionThroughputInfo object. - :ivar id: Name of the Cosmos DB MongoDB database. Required. + :ivar id: Id of a physical partition. 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 account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :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 throughput: Throughput of a physical partition. + :vartype throughput: float + :ivar target_throughput: Target throughput of a physical partition. + :vartype target_throughput: float """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) - """A system generated property that denotes the last updated timestamp of the resource.""" - etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) - """A system generated property representing the resource etag required for optimistic concurrency - control.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Id of a physical partition. Required.""" + throughput: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Throughput of a physical partition.""" + target_throughput: Optional[float] = rest_field( + name="targetThroughput", visibility=["read", "create", "update", "delete", "query"] + ) + """Target throughput of a physical partition.""" @overload def __init__( self, *, id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + throughput: Optional[float] = None, + target_throughput: Optional[float] = None, ) -> None: ... @overload @@ -8737,63 +13918,49 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoDBDatabaseGetResults(ProxyResource): - """An Azure Cosmos DB MongoDB database. +class PhysicalPartitionThroughputInfoResult( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: The properties of an Azure Cosmos DB MongoDB database. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetProperties :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\\". + 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 properties: The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoResult + object. + :vartype properties: + ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultProperties """ - properties: Optional["_models.MongoDBDatabaseGetProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The properties of an Azure Cosmos DB MongoDB database.""" - location: Optional[str] = rest_field(visibility=["read", "create", "update"]) - """The location of the resource group to which the resource belongs.""" - tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """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\\".""" - identity: Optional["_models.ManagedServiceIdentity"] = rest_field( + properties: Optional["_models.PhysicalPartitionThroughputInfoResultProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Identity for the resource.""" + """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoResult object.""" - __flattened_items = ["resource", "options"] + __flattened_items = ["resource"] @overload def __init__( self, *, - properties: Optional["_models.MongoDBDatabaseGetProperties"] = None, location: Optional[str] = None, tags: Optional[dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + properties: Optional["_models.PhysicalPartitionThroughputInfoResultProperties"] = None, ) -> None: ... @overload @@ -8825,78 +13992,26 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class MongoIndex(_Model): - """Cosmos DB MongoDB collection index key. +class PhysicalPartitionThroughputInfoResultProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB PhysicalPartitionThroughputInfoResult object. - :ivar key: Cosmos DB MongoDB collection index keys. - :vartype key: ~azure.mgmt.cosmosdb.models.MongoIndexKeys - :ivar options: Cosmos DB MongoDB collection index key options. - :vartype options: ~azure.mgmt.cosmosdb.models.MongoIndexOptions + :ivar resource: properties of physical partition throughput info. + :vartype resource: + ~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResultPropertiesResource """ - key: Optional["_models.MongoIndexKeys"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Cosmos DB MongoDB collection index keys.""" - options: Optional["_models.MongoIndexOptions"] = rest_field( + resource: Optional["_models.PhysicalPartitionThroughputInfoResultPropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Cosmos DB MongoDB collection index key options.""" - - __flattened_items = ["keys_property"] - - @overload - def __init__( - self, - *, - key: Optional["_models.MongoIndexKeys"] = None, - options: Optional["_models.MongoIndexOptions"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} - super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.key is None: - return None - return getattr(self.key, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.key is None: - self.key = self._attr_to_rest_field["key"]._class_type() - setattr(self.key, key, value) - else: - super().__setattr__(key, value) - - -class MongoIndexKeys(_Model): - """Cosmos DB MongoDB collection resource object. - - :ivar keys_property: List of keys for each MongoDB collection in the Azure Cosmos DB service. - :vartype keys_property: list[str] - """ - - keys_property: Optional[list[str]] = rest_field( - name="keys", visibility=["read", "create", "update", "delete", "query"], original_tsp_name="keys" - ) - """List of keys for each MongoDB collection in the Azure Cosmos DB service.""" + """properties of physical partition throughput info.""" @overload def __init__( self, *, - keys_property: Optional[list[str]] = None, + resource: Optional["_models.PhysicalPartitionThroughputInfoResultPropertiesResource"] = None, ) -> None: ... @overload @@ -8910,28 +14025,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoIndexOptions(_Model): - """Cosmos DB MongoDB collection index options. +class PhysicalPartitionThroughputInfoResultPropertiesResource( + PhysicalPartitionThroughputInfoProperties +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """properties of physical partition throughput info. - :ivar expire_after_seconds: Expire after seconds. - :vartype expire_after_seconds: int - :ivar unique: Is unique or not. - :vartype unique: bool + :ivar physical_partition_throughput_info: Array of physical partition throughput info objects. + :vartype physical_partition_throughput_info: + list[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResource] """ - expire_after_seconds: Optional[int] = rest_field( - name="expireAfterSeconds", visibility=["read", "create", "update", "delete", "query"] - ) - """Expire after seconds.""" - unique: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Is unique or not.""" - @overload def __init__( self, *, - expire_after_seconds: Optional[int] = None, - unique: Optional[bool] = None, + physical_partition_throughput_info: Optional[list["_models.PhysicalPartitionThroughputInfoResource"]] = None, ) -> None: ... @overload @@ -8945,8 +14053,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoMIRoleAssignmentResource(ProxyResource): - """Parameters to create and update an Azure Cosmos DB MongoMI Role Assignment. +class PrivateEndpointConnection(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A private endpoint connection. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -8959,22 +14067,22 @@ class MongoMIRoleAssignmentResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Assignment. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoMIRoleAssignmentResourceProperties + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionProperties """ - properties: Optional["_models.MongoMIRoleAssignmentResourceProperties"] = rest_field( + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update an Azure Cosmos DB MongoMI Role Assignment.""" + """Resource properties.""" - __flattened_items = ["role_definition_id", "scope", "principal_id", "provisioning_state"] + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "group_id", "provisioning_state"] @overload def __init__( self, *, - properties: Optional["_models.MongoMIRoleAssignmentResourceProperties"] = None, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, ) -> None: ... @overload @@ -9006,45 +14114,72 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class MongoMIRoleAssignmentResourceProperties(_Model): - """Azure Cosmos DB MongoMI Role Assignment resource object. +class PrivateEndpointConnectionProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties of a private endpoint connection. - :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 - MongoMI 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 MongoMI 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. + :ivar private_endpoint: Private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty + :ivar private_link_service_connection_state: Connection State of the Private Endpoint + Connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty + :ivar group_id: Group id of the private endpoint. + :vartype group_id: str + :ivar provisioning_state: Provisioning state of the private endpoint. :vartype provisioning_state: str """ - role_definition_id: Optional[str] = rest_field( - name="roleDefinitionId", visibility=["read", "create", "update", "delete", "query"] + private_endpoint: Optional["_models.PrivateEndpointProperty"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] ) - """The unique identifier for the associated Role Definition.""" - scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The data plane resource path for which access is being granted through this MongoMI Role - Assignment.""" - principal_id: Optional[str] = rest_field( - name="principalId", visibility=["read", "create", "update", "delete", "query"] + """Private endpoint which the connection belongs to.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] ) - """The unique identifier for the associated AAD principal in the AAD graph to which access is - being granted through this MongoMI Role Assignment. Tenant ID for the principal is inferred - using the tenant associated with the subscription.""" - provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) - """Provisioning state of the resource.""" + """Connection State of the Private Endpoint Connection.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """Group id of the private endpoint.""" + provisioning_state: Optional[str] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """Provisioning state of the private endpoint.""" @overload def __init__( self, *, - role_definition_id: Optional[str] = None, - scope: Optional[str] = None, - principal_id: Optional[str] = None, + private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, + group_id: Optional[str] = None, + provisioning_state: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointProperty(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Private endpoint which the connection belongs to. + + :ivar id: Resource id of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource id of the private endpoint.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin ) -> None: ... @overload @@ -9058,8 +14193,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoMIRoleDefinitionResource(ProxyResource): - """Parameters to create and update an Azure Cosmos DB MongoMI Role Definition. +class PrivateLinkResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A private link resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -9072,22 +14207,22 @@ class MongoMIRoleDefinitionResource(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoMIRoleDefinitionResourceProperties + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.cosmosdb.models.PrivateLinkResourceProperties """ - properties: Optional["_models.MongoMIRoleDefinitionResourceProperties"] = rest_field( + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update an Azure Cosmos DB MongoMI Role Definition.""" + """Resource properties.""" - __flattened_items = ["id", "role_name", "type", "assignable_scopes", "permissions"] + __flattened_items = ["group_id", "required_members", "required_zone_names"] @overload def __init__( self, *, - properties: Optional["_models.MongoMIRoleDefinitionResourceProperties"] = None, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, ) -> None: ... @overload @@ -9119,58 +14254,52 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class MongoMIRoleDefinitionResourceProperties(_Model): - """Azure Cosmos DB MongoMI Role Definition resource object. +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. - :ivar id: The path id for the Role Definition. - :vartype 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: 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 MongoMI 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 group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource required zone names. + :vartype required_zone_names: list[str] """ - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The path id for the Role Definition.""" - role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) - """A user-friendly name for the Role Definition. Must be unique for the database account.""" - type: Optional[Union[str, "_models.RoleDefinitionType"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Indicates whether the Role Definition was built-in or user created. Known values are: - \"BuiltInRole\" and \"CustomRole\".""" - assignable_scopes: Optional[list[str]] = rest_field( - name="assignableScopes", visibility=["read", "create", "update", "delete", "query"] - ) - """A set of fully qualified Scopes at or below which MongoMI 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.""" - permissions: Optional[list["_models.Permission"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The set of operations allowed through this Role Definition.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"]) + """The private link resource required zone names.""" + + +class PrivateLinkServiceConnectionStateProperty( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Connection State of the Private Endpoint Connection. + + :ivar status: The private link service connection status. + :vartype status: str + :ivar description: The private link service connection description. + :vartype description: str + :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ + disconnect). + :vartype actions_required: str + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection status.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection description.""" + actions_required: Optional[str] = rest_field(name="actionsRequired", visibility=["read"]) + """Any action that is required beyond basic workflow (approve/ reject/ disconnect).""" @overload def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - role_name: Optional[str] = None, - type: Optional[Union[str, "_models.RoleDefinitionType"]] = None, - assignable_scopes: Optional[list[str]] = None, - permissions: Optional[list["_models.Permission"]] = None, + status: Optional[str] = None, + description: Optional[str] = None, ) -> None: ... @overload @@ -9184,25 +14313,61 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoRoleDefinitionCreateUpdateParameters(_Model): # pylint: disable=name-too-long - """Parameters to create and update an Azure Cosmos DB Mongo Role Definition. +class Privilege(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The set of data plane operations permitted through this Role Definition. - :ivar properties: Properties to create and update an Azure Cosmos DB Mongo Role Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionResource + :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] """ - properties: Optional["_models.MongoRoleDefinitionResource"] = rest_field( + resource: Optional["_models.PrivilegeResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties to create and update an Azure Cosmos DB Mongo Role Definition.""" + """An Azure Cosmos DB Mongo DB Resource.""" + actions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An array of actions that are allowed.""" - __flattened_items = ["role_name", "type", "database_name", "privileges", "roles"] + @overload + def __init__( + self, + *, + resource: Optional["_models.PrivilegeResource"] = None, + actions: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivilegeResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """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 + """ + + db: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The database name the role is applied.""" + collection: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The collection name the role is applied.""" @overload def __init__( self, *, - properties: Optional["_models.MongoRoleDefinitionResource"] = None, + db: Optional[str] = None, + collection: Optional[str] = None, ) -> None: ... @overload @@ -9213,57 +14378,103 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) +class ProvisioningIssue(_Model): + """Describes a provisioning issue for a network security perimeter configuration. + + :ivar name: Name of the issue. + :vartype name: str + :ivar properties: Details of the provisioning issue. + :vartype properties: ~azure.mgmt.cosmosdb.models.ProvisioningIssueProperties + """ + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the issue.""" + properties: Optional["_models.ProvisioningIssueProperties"] = rest_field(visibility=["read"]) + """Details of the provisioning issue.""" + + +class ProvisioningIssueProperties(_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. + + :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] + """ + + issue_type: Optional[Union[str, "_models.IssueType"]] = rest_field(name="issueType", visibility=["read"]) + """Type of issue. Known values are: \"Unknown\", \"ConfigurationPropagationFailure\", + \"MissingPerimeterConfiguration\", and \"MissingIdentityConfiguration\".""" + severity: Optional[Union[str, "_models.Severity"]] = rest_field(visibility=["read"]) + """Severity of the issue. Known values are: \"Warning\" and \"Error\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the issue.""" + suggested_resource_ids: Optional[list[str]] = rest_field(name="suggestedResourceIds", visibility=["read"]) + """Fully qualified resource IDs of suggested resources that can be associated to the network + security perimeter (NSP) to remediate the issue.""" + suggested_access_rules: Optional[list["_models.AccessRule"]] = rest_field( + name="suggestedAccessRules", visibility=["read"] + ) + """Access rules that can be added to the network security profile (NSP) to remediate the issue.""" -class MongoRoleDefinitionGetResults(ProxyResource): - """An Azure Cosmos DB Mongo Role Definition. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. +class RedistributeThroughputParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB redistribute throughput parameters object. + + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Properties related to the Mongo Role Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionResource + :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 properties: Properties to redistribute throughput parameters object. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.RedistributeThroughputProperties """ - properties: Optional["_models.MongoRoleDefinitionResource"] = rest_field( + properties: "_models.RedistributeThroughputProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Properties related to the Mongo Role Definition.""" + """Properties to redistribute throughput parameters object. Required.""" - __flattened_items = ["role_name", "type", "database_name", "privileges", "roles"] + __flattened_items = ["resource"] @overload def __init__( self, *, - properties: Optional["_models.MongoRoleDefinitionResource"] = None, + properties: "_models.RedistributeThroughputProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -9295,55 +14506,73 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class MongoRoleDefinitionResource(_Model): - """Azure Cosmos DB Mongo Role Definition resource object. +class RedistributeThroughputProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to redistribute throughput for Azure Cosmos DB resource. - :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.MongoRoleDefinitionType - :ivar database_name: The database name for which access is being granted for this Role - Definition. - :vartype database_name: str - :ivar privileges: A set of privileges contained by the Role Definition. This will allow - application of this Role Definition on the entire database account or any underlying Database / - Collection. Scopes higher than Database are not enforceable as privilege. - :vartype privileges: list[~azure.mgmt.cosmosdb.models.Privilege] - :ivar roles: The set of roles inherited by this Role Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] + :ivar resource: The standard JSON format of a resource throughput. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.RedistributeThroughputPropertiesResource """ - role_name: Optional[str] = rest_field(name="roleName", visibility=["read", "create", "update", "delete", "query"]) - """A user-friendly name for the Role Definition. Must be unique for the database account.""" - type: Optional[Union[str, "_models.MongoRoleDefinitionType"]] = rest_field( + resource: "_models.RedistributeThroughputPropertiesResource" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Indicates whether the Role Definition was built-in or user created. Known values are: - \"BuiltInRole\" and \"CustomRole\".""" - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] + """The standard JSON format of a resource throughput. Required.""" + + @overload + def __init__( + self, + *, + resource: "_models.RedistributeThroughputPropertiesResource", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RedistributeThroughputPropertiesResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Resource to redistribute throughput for Azure Cosmos DB resource. + + :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] + """ + + throughput_policy: Union[str, "_models.ThroughputPolicyType"] = rest_field( + name="throughputPolicy", visibility=["read", "create", "update", "delete", "query"] ) - """The database name for which access is being granted for this Role Definition.""" - privileges: Optional[list["_models.Privilege"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + """ThroughputPolicy to apply for throughput redistribution. Required. Known values are: \"none\", + \"equal\", and \"custom\".""" + target_physical_partition_throughput_info: list["_models.PhysicalPartitionThroughputInfoResource"] = rest_field( + name="targetPhysicalPartitionThroughputInfo", visibility=["read", "create", "update", "delete", "query"] ) - """A set of privileges contained by the Role Definition. This will allow application of this Role - Definition on the entire database account or any underlying Database / Collection. Scopes - higher than Database are not enforceable as privilege.""" - roles: Optional[list["_models.Role"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The set of roles inherited by this Role Definition.""" + """Array of PhysicalPartitionThroughputInfoResource objects. Required.""" + source_physical_partition_throughput_info: list["_models.PhysicalPartitionThroughputInfoResource"] = rest_field( + name="sourcePhysicalPartitionThroughputInfo", visibility=["read", "create", "update", "delete", "query"] + ) + """Array of PhysicalPartitionThroughputInfoResource objects. Required.""" @overload def __init__( self, *, - role_name: Optional[str] = None, - type: Optional[Union[str, "_models.MongoRoleDefinitionType"]] = None, - database_name: Optional[str] = None, - privileges: Optional[list["_models.Privilege"]] = None, - roles: Optional[list["_models.Role"]] = None, + throughput_policy: Union[str, "_models.ThroughputPolicyType"], + target_physical_partition_throughput_info: list["_models.PhysicalPartitionThroughputInfoResource"], + source_physical_partition_throughput_info: list["_models.PhysicalPartitionThroughputInfoResource"], ) -> None: ... @overload @@ -9357,25 +14586,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MongoUserDefinitionCreateUpdateParameters(_Model): # pylint: disable=name-too-long - """Parameters to create and update an Azure Cosmos DB Mongo User Definition. +class RegionForOnlineOffline(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB region to online or offline. - :ivar properties: Properties to create and update an Azure Cosmos DB Mongo User Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionResource + :ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :vartype region: str """ - properties: Optional["_models.MongoUserDefinitionResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Properties to create and update an Azure Cosmos DB Mongo User Definition.""" - - __flattened_items = ["user_name", "password", "database_name", "custom_data", "roles", "mechanisms"] + region: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Cosmos DB region, with spaces between words and each word capitalized. Required.""" @overload def __init__( self, *, - properties: Optional["_models.MongoUserDefinitionResource"] = None, + region: str, ) -> None: ... @overload @@ -9386,57 +14611,33 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class MongoUserDefinitionGetResults(ProxyResource): - """An Azure Cosmos DB User Definition. +class ResourceAssociation(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Information about resource association. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. + :ivar name: Name of the resource association. :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: Properties related to the User Definition. - :vartype properties: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionResource + :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 """ - properties: Optional["_models.MongoUserDefinitionResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the resource association.""" + access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = rest_field( + name="accessMode", visibility=["read", "create", "update", "delete", "query"] ) - """Properties related to the User Definition.""" - - __flattened_items = ["user_name", "password", "database_name", "custom_data", "roles", "mechanisms"] + """Access mode of the resource association. Known values are: \"Enforced\", \"Learning\", and + \"Audit\".""" @overload def __init__( self, *, - properties: Optional["_models.MongoUserDefinitionResource"] = None, + name: Optional[str] = None, + access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None, ) -> None: ... @overload @@ -9447,73 +14648,46 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class MongoUserDefinitionResource(_Model): - """Azure Cosmos DB Mongo User Definition resource object. +class RestoreParametersBase(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to indicate the information about the restore. - :ivar user_name: The user name for User Definition. - :vartype user_name: str - :ivar password: The password for User Definition. Response does not contain user password. - :vartype password: str - :ivar database_name: The database name for which access is being granted for this User - Definition. - :vartype database_name: str - :ivar custom_data: A custom definition for the USer Definition. - :vartype custom_data: str - :ivar roles: The set of roles inherited by the User Definition. - :vartype roles: list[~azure.mgmt.cosmosdb.models.Role] - :ivar mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism - SCRAM-SHA-256. - :vartype mechanisms: str + :ivar 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}. + :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 """ - user_name: Optional[str] = rest_field(name="userName", visibility=["read", "create", "update", "delete", "query"]) - """The user name for User Definition.""" - password: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The password for User Definition. Response does not contain user password.""" - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] + restore_source: Optional[str] = rest_field( + name="restoreSource", visibility=["read", "create", "update", "delete", "query"] ) - """The database name for which access is being granted for this User Definition.""" - custom_data: Optional[str] = rest_field( - name="customData", visibility=["read", "create", "update", "delete", "query"] + """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}.""" + restore_timestamp_in_utc: Optional[datetime.datetime] = rest_field( + name="restoreTimestampInUtc", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" ) - """A custom definition for the USer Definition.""" - roles: Optional[list["_models.Role"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The set of roles inherited by the User Definition.""" - mechanisms: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.""" + """Time to which the account has to be restored (ISO-8601 format).""" + restore_with_ttl_disabled: Optional[bool] = rest_field( + name="restoreWithTtlDisabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the restored account will have Time-To-Live disabled upon the successful + restore.""" @overload 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, + restore_source: Optional[str] = None, + restore_timestamp_in_utc: Optional[datetime.datetime] = None, + restore_with_ttl_disabled: Optional[bool] = None, ) -> None: ... @overload @@ -9527,36 +14701,27 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class NotebookWorkspace(ProxyResource): - """A notebook workspace resource. +class ResourceRestoreParameters(RestoreParametersBase): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to indicate the information about the restore. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceProperties + :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}. + :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 """ - properties: Optional["_models.NotebookWorkspaceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Resource properties.""" - - __flattened_items = ["notebook_server_endpoint", "status"] - @overload def __init__( self, *, - properties: Optional["_models.NotebookWorkspaceProperties"] = None, + restore_source: Optional[str] = None, + restore_timestamp_in_utc: Optional[datetime.datetime] = None, + restore_with_ttl_disabled: Optional[bool] = None, ) -> None: ... @overload @@ -9567,94 +14732,51 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class NotebookWorkspaceConnectionInfoResult(_Model): - """The connection info for the given notebook workspace. - - :ivar auth_token: Specifies auth token used for connecting to Notebook server (uses token-based - auth). - :vartype auth_token: str - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str - """ - - auth_token: Optional[str] = rest_field(name="authToken", visibility=["read"]) - """Specifies auth token used for connecting to Notebook server (uses token-based auth).""" - notebook_server_endpoint: Optional[str] = rest_field(name="notebookServerEndpoint", visibility=["read"]) - """Specifies the endpoint of Notebook server.""" - - -class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): - """Parameters to create a notebook workspace resource. +class RestorableDatabaseAccountGetResult(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A Azure Cosmos DB restorable database account. - :ivar id: The unique resource identifier of the database account. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the database account. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The properties of a restorable database account. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountProperties + :ivar location: The location of the resource group to which the resource belongs. + :vartype location: str """ - - -class NotebookWorkspaceProperties(_Model): - """Properties of a notebook workspace resource. - - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str - :ivar status: Status of the notebook workspace. Possible values are: Creating, Online, - Deleting, Failed, Updating. - :vartype status: str - """ - - notebook_server_endpoint: Optional[str] = rest_field(name="notebookServerEndpoint", visibility=["read"]) - """Specifies the endpoint of Notebook server.""" - status: Optional[str] = rest_field(visibility=["read"]) - """Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, - Updating.""" - - -class Operation(_Model): - """REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.cosmosdb.models.OperationDisplay - """ - - name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Operation name: {provider}/{resource}/{operation}.""" - display: Optional["_models.OperationDisplay"] = rest_field( + + properties: Optional["_models.RestorableDatabaseAccountProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The object that represents the operation.""" + """The properties of a restorable database account.""" + location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The location of the resource group to which the resource belongs.""" + + __flattened_items = [ + "account_name", + "creation_time", + "oldest_restorable_time", + "deletion_time", + "api_type", + "restorable_locations", + ] @overload def __init__( self, *, - name: Optional[str] = None, - display: Optional["_models.OperationDisplay"] = None, + properties: Optional["_models.RestorableDatabaseAccountProperties"] = None, + location: Optional[str] = None, ) -> None: ... @overload @@ -9665,41 +14787,80 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class OperationDisplay(_Model): - """The object that represents the operation. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar provider: Service provider: Microsoft.ResourceProvider. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - :ivar description: Description of operation. - :vartype description: str + +class RestorableDatabaseAccountProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a restorable database account. + + :ivar account_name: The name of the global database account. + :vartype account_name: str + :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). + :vartype creation_time: ~datetime.datetime + :ivar oldest_restorable_time: The least recent time at which the database account can be + restored to (ISO-8601 format). + :vartype oldest_restorable_time: ~datetime.datetime + :ivar deletion_time: The time at which the restorable database account has been deleted + (ISO-8601 format). + :vartype deletion_time: ~datetime.datetime + :ivar api_type: The API type of the restorable database account. Known values are: "MongoDB", + "Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2". + :vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType + :ivar restorable_locations: List of regions where the of the database account can be restored + from. + :vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource] """ - provider: Optional[str] = rest_field(name="Provider", visibility=["read", "create", "update", "delete", "query"]) - """Service provider: Microsoft.ResourceProvider.""" - resource: Optional[str] = rest_field(name="Resource", visibility=["read", "create", "update", "delete", "query"]) - """Resource on which the operation is performed: Profile, endpoint, etc.""" - operation: Optional[str] = rest_field(name="Operation", visibility=["read", "create", "update", "delete", "query"]) - """Operation type: Read, write, delete, etc.""" - description: Optional[str] = rest_field( - name="Description", visibility=["read", "create", "update", "delete", "query"] + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] ) - """Description of operation.""" + """The name of the global database account.""" + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The creation time of the restorable database account (ISO-8601 format).""" + oldest_restorable_time: Optional[datetime.datetime] = rest_field( + name="oldestRestorableTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The least recent time at which the database account can be restored to (ISO-8601 format).""" + deletion_time: Optional[datetime.datetime] = rest_field( + name="deletionTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the restorable database account has been deleted (ISO-8601 format).""" + api_type: Optional[Union[str, "_models.ApiType"]] = rest_field(name="apiType", visibility=["read"]) + """The API type of the restorable database account. Known values are: \"MongoDB\", \"Gremlin\", + \"Cassandra\", \"Table\", \"Sql\", and \"GremlinV2\".""" + restorable_locations: Optional[list["_models.RestorableLocationResource"]] = rest_field( + name="restorableLocations", visibility=["read"] + ) + """List of regions where the of the database account can be restored from.""" @overload def __init__( self, *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, + account_name: Optional[str] = None, + creation_time: Optional[datetime.datetime] = None, + oldest_restorable_time: Optional[datetime.datetime] = None, + deletion_time: Optional[datetime.datetime] = None, ) -> None: ... @overload @@ -9713,197 +14874,169 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PartitionMetric(Metric): - """The metric values for a single partition. - - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.MetricValue] - :ivar partition_id: The partition id (GUID identifier) of the metric values. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the metric - values. - :vartype partition_key_range_id: str - """ - - partition_id: Optional[str] = rest_field(name="partitionId", visibility=["read"]) - """The partition id (GUID identifier) of the metric values.""" - partition_key_range_id: Optional[str] = rest_field(name="partitionKeyRangeId", visibility=["read"]) - """The partition key range id (integer identifier) of the metric values.""" - - -class Usage(_Model): - """The usage data for a usage request. +class RestorableGremlinDatabaseGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Gremlin database event. - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: int - :ivar current_value: Current value for this metric. - :vartype current_value: int + :ivar properties: The properties of a Gremlin database event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseProperties + :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 """ - unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) - """The name information for the metric.""" - quota_period: Optional[str] = rest_field(name="quotaPeriod", visibility=["read"]) - """The quota period used to summarize the usage values.""" - limit: Optional[int] = rest_field(visibility=["read"]) - """Maximum value for this metric.""" - current_value: Optional[int] = rest_field(name="currentValue", visibility=["read"]) - """Current value for this metric.""" + properties: Optional["_models.RestorableGremlinDatabaseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a Gremlin database event.""" + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource Identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + __flattened_items = ["resource"] -class PartitionUsage(Usage): - """The partition level usage data for a usage request. + @overload + def __init__( + self, + *, + properties: Optional["_models.RestorableGremlinDatabaseProperties"] = None, + ) -> None: ... - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: int - :ivar current_value: Current value for this metric. - :vartype current_value: int - :ivar partition_id: The partition id (GUID identifier) of the usages. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the usages. - :vartype partition_key_range_id: str - """ + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - partition_id: Optional[str] = rest_field(name="partitionId", visibility=["read"]) - """The partition id (GUID identifier) of the usages.""" - partition_key_range_id: Optional[str] = rest_field(name="partitionKeyRangeId", visibility=["read"]) - """The partition key range id (integer identifier) of the usages.""" + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class PercentileMetric(_Model): - """Percentile Metric data. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: ~datetime.datetime - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: str or ~azure.mgmt.cosmosdb.models.UnitType - :ivar name: The name information for the metric. - :vartype name: ~azure.mgmt.cosmosdb.models.MetricName - :ivar metric_values: The percentile metric values for the specified time window and timestep. - :vartype metric_values: list[~azure.mgmt.cosmosdb.models.PercentileMetricValue] - """ - start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") - """The start time for the metric (ISO-8601 format).""" - end_time: Optional[datetime.datetime] = rest_field(name="endTime", visibility=["read"], format="rfc3339") - """The end time for the metric (ISO-8601 format).""" - time_grain: Optional[str] = rest_field(name="timeGrain", visibility=["read"]) - """The time grain to be used to summarize the metric values.""" - unit: Optional[Union[str, "_models.UnitType"]] = rest_field(visibility=["read"]) - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: Optional["_models.MetricName"] = rest_field(visibility=["read"]) - """The name information for the metric.""" - metric_values: Optional[list["_models.PercentileMetricValue"]] = rest_field( - name="metricValues", visibility=["read"] +class RestorableGremlinDatabaseProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Gremlin database event. + + :ivar resource: The resource of an Azure Cosmos DB Gremlin database event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource + """ + + resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The percentile metric values for the specified time window and timestep.""" + """The resource of an Azure Cosmos DB Gremlin database event.""" + @overload + def __init__( + self, + *, + resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, + ) -> None: ... -class PercentileMetricValue(MetricValue): - """Represents percentile metrics values. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: ~datetime.datetime - :ivar total: The total value of the metric. - :vartype total: float - :ivar p10: The 10th percentile value for the metric. - :vartype p10: float - :ivar p25: The 25th percentile value for the metric. - :vartype p25: float - :ivar p50: The 50th percentile value for the metric. - :vartype p50: float - :ivar p75: The 75th percentile value for the metric. - :vartype p75: float - :ivar p90: The 90th percentile value for the metric. - :vartype p90: float - :ivar p95: The 95th percentile value for the metric. - :vartype p95: float - :ivar p99: The 99th percentile value for the metric. - :vartype p99: float + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RestorableGremlinDatabasePropertiesResource(_Model): # pylint: disable=name-too-long + """The resource of an Azure Cosmos DB Gremlin database event. + + :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", + "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. + :vartype can_undelete: str + :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 database event happened. + :vartype event_timestamp: str + :ivar owner_id: The name of this Gremlin database. + :vartype owner_id: str + :ivar owner_resource_id: The resource ID of this Gremlin database. + :vartype owner_resource_id: str """ - p10: Optional[float] = rest_field(name="P10", visibility=["read"]) - """The 10th percentile value for the metric.""" - p25: Optional[float] = rest_field(name="P25", visibility=["read"]) - """The 25th percentile value for the metric.""" - p50: Optional[float] = rest_field(name="P50", visibility=["read"]) - """The 50th percentile value for the metric.""" - p75: Optional[float] = rest_field(name="P75", visibility=["read"]) - """The 75th percentile value for the metric.""" - p90: Optional[float] = rest_field(name="P90", visibility=["read"]) - """The 90th percentile value for the metric.""" - p95: Optional[float] = rest_field(name="P95", visibility=["read"]) - """The 95th percentile value for the metric.""" - p99: Optional[float] = rest_field(name="P99", visibility=["read"]) - """The 99th percentile value for the metric.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( + name="operationType", visibility=["read"] + ) + """The operation type of this database event. Known values are: \"Create\", \"Replace\", + \"Delete\", \"Recreate\", and \"SystemOperation\".""" + can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) + """A state of this database to identify if this database is restorable in same account.""" + can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) + """The reason why this database can not be restored in same account.""" + event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) + """The time when this database event happened.""" + owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) + """The name of this Gremlin database.""" + owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) + """The resource ID of this Gremlin database.""" -class PeriodicModeBackupPolicy(BackupPolicy, discriminator="Periodic"): - """The object representing periodic mode backup policy. +class RestorableGremlinGraphGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Gremlin graph event. - :ivar migration_state: The object representing the state of the migration between the backup - policies. - :vartype migration_state: ~azure.mgmt.cosmosdb.models.BackupPolicyMigrationState - :ivar periodic_mode_properties: Configuration values for periodic mode backup. - :vartype periodic_mode_properties: ~azure.mgmt.cosmosdb.models.PeriodicModeProperties - :ivar type: Describes the mode of backups. Required. PERIODIC. - :vartype type: str or ~azure.mgmt.cosmosdb.models.PERIODIC + :ivar properties: The properties of a Gremlin graph event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphProperties + :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 """ - periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = rest_field( - name="periodicModeProperties", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.RestorableGremlinGraphProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Configuration values for periodic mode backup.""" - type: Literal[BackupPolicyType.PERIODIC] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore - """Describes the mode of backups. Required. PERIODIC.""" + """The properties of a Gremlin graph event.""" + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource Identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + + __flattened_items = ["resource"] @overload def __init__( self, *, - migration_state: Optional["_models.BackupPolicyMigrationState"] = None, - periodic_mode_properties: Optional["_models.PeriodicModeProperties"] = None, + properties: Optional["_models.RestorableGremlinGraphProperties"] = None, ) -> None: ... @overload @@ -9914,44 +15047,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - self.type = BackupPolicyType.PERIODIC # type: ignore + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class PeriodicModeProperties(_Model): - """Configuration values for periodic mode backup. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :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 + +class RestorableGremlinGraphProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Gremlin graph event. + + :ivar resource: The resource of an Azure Cosmos DB Gremlin graph event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource """ - backup_interval_in_minutes: Optional[int] = rest_field( - name="backupIntervalInMinutes", visibility=["read", "create", "update", "delete", "query"] - ) - """An integer representing the interval in minutes between two backups.""" - backup_retention_interval_in_hours: Optional[int] = rest_field( - name="backupRetentionIntervalInHours", visibility=["read", "create", "update", "delete", "query"] - ) - """An integer representing the time (in hours) that each backup is retained.""" - backup_storage_redundancy: Optional[Union[str, "_models.BackupStorageRedundancy"]] = rest_field( - name="backupStorageRedundancy", visibility=["read", "create", "update", "delete", "query"] + resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate type of backup residency. Known values are: \"Geo\", \"Local\", and \"Zone\".""" + """The resource of an Azure Cosmos DB Gremlin graph event.""" @overload 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, + resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, ) -> None: ... @overload @@ -9965,35 +15098,82 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Permission(_Model): - """The set of data plane operations permitted through this Role Definition. +class RestorableGremlinGraphPropertiesResource(_Model): + """The resource of an Azure Cosmos DB Gremlin graph event. - :ivar id: The id for the permission. + :ivar rid: A system generated property. A unique identifier. + :vartype rid: str + :ivar operation_type: The operation type of this graph 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 graph to identify if this graph is restorable in same + account. + :vartype can_undelete: str + :ivar can_undelete_reason: The reason why this graph can not be restored in same account. + :vartype can_undelete_reason: str + :ivar event_timestamp: The time when this graph event happened. + :vartype event_timestamp: str + :ivar owner_id: The name of this Gremlin graph. + :vartype owner_id: str + :ivar owner_resource_id: The resource ID of this Gremlin graph. + :vartype owner_resource_id: str + """ + + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( + name="operationType", visibility=["read"] + ) + """The operation type of this graph event. Known values are: \"Create\", \"Replace\", \"Delete\", + \"Recreate\", and \"SystemOperation\".""" + can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) + """A state of this graph to identify if this graph is restorable in same account.""" + can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) + """The reason why this graph can not be restored in same account.""" + event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) + """The time when this graph event happened.""" + owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) + """The name of this Gremlin graph.""" + owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) + """The resource ID of this Gremlin graph.""" + + +class RestorableGremlinResourcesGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specific Databases to restore. + + :ivar id: The unique resource identifier of the ARM resource. :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] + :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 gremlin database available for restore. + :vartype database_name: str + :ivar graph_names: The names of the graphs available for restore. + :vartype graph_names: list[str] """ - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The id for the permission.""" - data_actions: Optional[list[str]] = rest_field( - name="dataActions", visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] ) - """An array of data actions that are allowed.""" - not_data_actions: Optional[list[str]] = rest_field( - name="notDataActions", visibility=["read", "create", "update", "delete", "query"] + """The name of the gremlin database available for restore.""" + graph_names: Optional[list[str]] = rest_field( + name="graphNames", visibility=["read", "create", "update", "delete", "query"] ) - """An array of data actions that are denied.""" + """The names of the graphs available for restore.""" @overload def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - data_actions: Optional[list[str]] = None, - not_data_actions: Optional[list[str]] = None, + database_name: Optional[str] = None, + graph_names: Optional[list[str]] = None, ) -> None: ... @overload @@ -10007,36 +15187,65 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. +class RestorableLocationResource(_Model): + """Properties of the regional restorable account. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar location_name: The location of the regional restorable account. + :vartype location_name: str + :ivar regional_database_account_instance_id: The instance id of the regional restorable + account. + :vartype regional_database_account_instance_id: str + :ivar creation_time: The creation time of the regional restorable database account (ISO-8601 + format). + :vartype creation_time: ~datetime.datetime + :ivar deletion_time: The time at which the regional restorable database account has been + deleted (ISO-8601 format). + :vartype deletion_time: ~datetime.datetime + """ + + location_name: Optional[str] = rest_field(name="locationName", visibility=["read"]) + """The location of the regional restorable account.""" + regional_database_account_instance_id: Optional[str] = rest_field( + name="regionalDatabaseAccountInstanceId", visibility=["read"] + ) + """The instance id of the regional restorable account.""" + creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") + """The creation time of the regional restorable database account (ISO-8601 format).""" + deletion_time: Optional[datetime.datetime] = rest_field(name="deletionTime", visibility=["read"], format="rfc3339") + """The time at which the regional restorable database account has been deleted (ISO-8601 format).""" + + +class RestorableMongodbCollectionGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB MongoDB collection event. + + :ivar properties: The properties of a MongoDB collection event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionProperties + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnectionProperties """ - properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + properties: Optional["_models.RestorableMongodbCollectionProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Resource properties.""" + """The properties of a MongoDB collection event.""" + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource Identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" - __flattened_items = ["private_endpoint", "private_link_service_connection_state", "group_id", "provisioning_state"] + __flattened_items = ["resource"] @overload def __init__( self, *, - properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + properties: Optional["_models.RestorableMongodbCollectionProperties"] = None, ) -> None: ... @overload @@ -10068,44 +15277,23 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class PrivateEndpointConnectionProperties(_Model): - """Properties of a private endpoint connection. +class RestorableMongodbCollectionProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB MongoDB collection event. - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~azure.mgmt.cosmosdb.models.PrivateEndpointProperty - :ivar private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.cosmosdb.models.PrivateLinkServiceConnectionStateProperty - :ivar group_id: Group id of the private endpoint. - :vartype group_id: str - :ivar provisioning_state: Provisioning state of the private endpoint. - :vartype provisioning_state: str + :ivar resource: The resource of an Azure Cosmos DB MongoDB collection event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource """ - private_endpoint: Optional["_models.PrivateEndpointProperty"] = rest_field( - name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] - ) - """Private endpoint which the connection belongs to.""" - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = rest_field( - name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] - ) - """Connection State of the Private Endpoint Connection.""" - group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) - """Group id of the private endpoint.""" - provisioning_state: Optional[str] = rest_field( - name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Provisioning state of the private endpoint.""" + """The resource of an Azure Cosmos DB MongoDB collection event.""" @overload def __init__( self, *, - private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - group_id: Optional[str] = None, - provisioning_state: Optional[str] = None, + resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, ) -> None: ... @overload @@ -10119,139 +15307,77 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PrivateEndpointProperty(_Model): - """Private endpoint which the connection belongs to. +class RestorableMongodbCollectionPropertiesResource(_Model): # pylint: disable=name-too-long + """The resource of an Azure Cosmos DB MongoDB collection event. - :ivar id: Resource id of the private endpoint. - :vartype id: str + :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 """ - id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Resource id of the private endpoint.""" - - @overload - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( + name="operationType", visibility=["read"] + ) + """The operation type of this collection event. Known values are: \"Create\", \"Replace\", + \"Delete\", \"Recreate\", and \"SystemOperation\".""" + can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) + """A state of this collection to identify if this container is restorable in same account.""" + can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) + """The reason why this collection can not be restored in same account.""" + event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) + """The time when this collection event happened.""" + owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) + """The name of this MongoDB collection.""" + owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) + """The resource ID of this MongoDB collection.""" -class PrivateLinkResource(ProxyResource): - """A private link resource. +class RestorableMongodbDatabaseGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB MongoDB database event. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar properties: The properties of a MongoDB database event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseProperties + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.cosmosdb.models.PrivateLinkResourceProperties - """ - - properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Resource properties.""" - - __flattened_items = ["group_id", "required_members", "required_zone_names"] - - @overload - def __init__( - self, - *, - properties: Optional["_models.PrivateLinkResourceProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} - super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) - - -class PrivateLinkResourceProperties(_Model): - """Properties of a private link resource. - - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource required zone names. - :vartype required_zone_names: list[str] """ - group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) - """The private link resource group id.""" - required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) - """The private link resource required member names.""" - required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"]) - """The private link resource required zone names.""" - - -class PrivateLinkServiceConnectionStateProperty(_Model): # pylint: disable=name-too-long - """Connection State of the Private Endpoint Connection. - - :ivar status: The private link service connection status. - :vartype status: str - :ivar description: The private link service connection description. - :vartype description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str - """ + properties: Optional["_models.RestorableMongodbDatabaseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a MongoDB database event.""" + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource Identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" - status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The private link service connection status.""" - description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The private link service connection description.""" - actions_required: Optional[str] = rest_field(name="actionsRequired", visibility=["read"]) - """Any action that is required beyond basic workflow (approve/ reject/ disconnect).""" + __flattened_items = ["resource"] @overload def __init__( self, *, - status: Optional[str] = None, - description: Optional[str] = None, + properties: Optional["_models.RestorableMongodbDatabaseProperties"] = None, ) -> None: ... @overload @@ -10262,31 +15388,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class Privilege(_Model): - """The set of data plane operations permitted through this Role Definition. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :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] + +class RestorableMongodbDatabaseProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB MongoDB database event. + + :ivar resource: The resource of an Azure Cosmos DB MongoDB database event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabasePropertiesResource """ - resource: Optional["_models.PrivilegeResource"] = rest_field( + resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """An Azure Cosmos DB Mongo DB Resource.""" - actions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """An array of actions that are allowed.""" + """The resource of an Azure Cosmos DB MongoDB database event.""" @overload def __init__( self, *, - resource: Optional["_models.PrivilegeResource"] = None, - actions: Optional[list[str]] = None, + resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, ) -> None: ... @overload @@ -10300,26 +15439,82 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PrivilegeResource(_Model): - """An Azure Cosmos DB Mongo DB Resource. +class RestorableMongodbDatabasePropertiesResource(_Model): # pylint: disable=name-too-long + """The resource of an Azure Cosmos DB MongoDB database event. - :ivar db: The database name the role is applied. - :vartype db: str - :ivar collection: The collection name the role is applied. - :vartype collection: str + :ivar 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", + "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. + :vartype can_undelete: str + :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 database event happened. + :vartype event_timestamp: str + :ivar owner_id: The name of this MongoDB database. + :vartype owner_id: str + :ivar owner_resource_id: The resource ID of this MongoDB database. + :vartype owner_resource_id: str """ - db: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The database name the role is applied.""" - collection: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The collection name the role is applied.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( + name="operationType", visibility=["read"] + ) + """The operation type of this database event. Known values are: \"Create\", \"Replace\", + \"Delete\", \"Recreate\", and \"SystemOperation\".""" + can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) + """A state of this database to identify if this database is restorable in same account.""" + can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) + """The reason why this database can not be restored in same account.""" + event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) + """The time when this database event happened.""" + owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) + """The name of this MongoDB database.""" + owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) + """The resource ID of this MongoDB database.""" + + +class RestorableMongodbResourcesGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specific Databases to restore. + + :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] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the database available for restore.""" + collection_names: Optional[list[str]] = rest_field( + name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The names of the collections available for restore.""" @overload def __init__( self, *, - db: Optional[str] = None, - collection: Optional[str] = None, + database_name: Optional[str] = None, + collection_names: Optional[list[str]] = None, ) -> None: ... @overload @@ -10333,21 +15528,37 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RegionForOnlineOffline(_Model): - """Cosmos DB region to online or offline. +class RestorableSqlContainerGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB SQL container event. - :ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :vartype region: str + :ivar properties: The properties of a SQL container event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerProperties + :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 """ - region: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Cosmos DB region, with spaces between words and each word capitalized. Required.""" + properties: Optional["_models.RestorableSqlContainerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a SQL container event.""" + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource Identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + + __flattened_items = ["resource"] @overload def __init__( self, *, - region: str, + properties: Optional["_models.RestorableSqlContainerProperties"] = None, ) -> None: ... @overload @@ -10358,46 +15569,44 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") -class RestoreParametersBase(_Model): - """Parameters to indicate the information about the restore. + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) - :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}. - :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 + +class RestorableSqlContainerProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB SQL container event. + + :ivar resource: The resource of an Azure Cosmos DB SQL container event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource """ - restore_source: Optional[str] = rest_field( - name="restoreSource", visibility=["read", "create", "update", "delete", "query"] - ) - """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}.""" - restore_timestamp_in_utc: Optional[datetime.datetime] = rest_field( - name="restoreTimestampInUtc", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """Time to which the account has to be restored (ISO-8601 format).""" - restore_with_ttl_disabled: Optional[bool] = rest_field( - name="restoreWithTtlDisabled", visibility=["read", "create", "update", "delete", "query"] + resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Specifies whether the restored account will have Time-To-Live disabled upon the successful - restore.""" + """The resource of an Azure Cosmos DB SQL container event.""" @overload def __init__( self, *, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - restore_with_ttl_disabled: Optional[bool] = None, + resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, ) -> None: ... @overload @@ -10411,27 +15620,57 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ResourceRestoreParameters(RestoreParametersBase): - """Parameters to indicate the information about the restore. +class RestorableSqlContainerPropertiesResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The resource of an Azure Cosmos DB SQL container event. - :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}. - :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 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", + "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. + :vartype can_undelete: str + :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 when this container event happened. + :vartype event_timestamp: str + :ivar owner_id: The name of this SQL container. + :vartype owner_id: str + :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 """ + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( + name="operationType", visibility=["read"] + ) + """The operation type of this container event. Known values are: \"Create\", \"Replace\", + \"Delete\", \"Recreate\", and \"SystemOperation\".""" + can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) + """A state of this container to identify if this container is restorable in same account.""" + can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) + """The reason why this container can not be restored in same account.""" + event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) + """The when this container event happened.""" + owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) + """The name of this SQL container.""" + owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) + """The resource ID of this SQL container.""" + container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Cosmos DB SQL container resource object.""" + @overload def __init__( self, *, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - restore_with_ttl_disabled: Optional[bool] = None, + container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, ) -> None: ... @overload @@ -10445,48 +15684,143 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableDatabaseAccountGetResult(ProxyResource): - """A Azure Cosmos DB restorable database account. +class SqlContainerResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB SQL container resource object. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Name of the Cosmos DB SQL container. Required. :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: The properties of a restorable database account. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountProperties - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: 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 account 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 materialized_views: Materialized Views defined on the container. + :vartype materialized_views: list[~azure.mgmt.cosmosdb.models.MaterializedViewDetails] + :ivar materialized_views_properties: Materialized Views Properties defined for source + container. + :vartype materialized_views_properties: ~azure.mgmt.cosmosdb.models.MaterializedViewsProperties + :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 full_text_policy: The FullText policy for the container. + :vartype full_text_policy: ~azure.mgmt.cosmosdb.models.FullTextPolicy + :ivar data_masking_policy: The Data Masking policy for the container. + :vartype data_masking_policy: ~azure.mgmt.cosmosdb.models.DataMaskingPolicy """ - properties: Optional["_models.RestorableDatabaseAccountProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB SQL container. Required.""" + indexing_policy: Optional["_models.IndexingPolicy"] = rest_field( + name="indexingPolicy", visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a restorable database account.""" - location: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The location of the resource group to which the resource belongs.""" - - __flattened_items = [ - "account_name", - "creation_time", - "oldest_restorable_time", - "deletion_time", - "api_type", - "restorable_locations", - ] + """The configuration of the indexing policy. By default, the indexing is automatic for all + document paths within the container.""" + partition_key: Optional["_models.ContainerPartitionKey"] = rest_field( + name="partitionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration of the partition key to be used for partitioning data into multiple + partitions.""" + default_ttl: Optional[int] = rest_field( + name="defaultTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Default time to live.""" + unique_key_policy: Optional["_models.UniqueKeyPolicy"] = rest_field( + name="uniqueKeyPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique key policy configuration for specifying uniqueness constraints on documents in the + collection in the Azure Cosmos DB service.""" + conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = rest_field( + name="conflictResolutionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The conflict resolution policy for the container.""" + client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = rest_field( + name="clientEncryptionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The client encryption policy for the container.""" + analytical_storage_ttl: Optional[int] = rest_field( + name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Analytical TTL.""" + restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters to indicate the information about the restore.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = rest_field( + name="materializedViewDefinition", visibility=["read", "create", "update", "delete", "query"] + ) + """The configuration for defining Materialized Views. This must be specified only for creating a + Materialized View container.""" + materialized_views: Optional[list["_models.MaterializedViewDetails"]] = rest_field( + name="materializedViews", visibility=["read", "create", "update", "delete", "query"] + ) + """Materialized Views defined on the container.""" + materialized_views_properties: Optional["_models.MaterializedViewsProperties"] = rest_field( + name="materializedViewsProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Materialized Views Properties defined for source container.""" + computed_properties: Optional[list["_models.ComputedProperty"]] = rest_field( + name="computedProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """List of computed properties.""" + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = rest_field( + name="vectorEmbeddingPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The vector embedding policy for the container.""" + full_text_policy: Optional["_models.FullTextPolicy"] = rest_field( + name="fullTextPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The FullText policy for the container.""" + data_masking_policy: Optional["_models.DataMaskingPolicy"] = rest_field( + name="dataMaskingPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The Data Masking policy for the container.""" @overload def __init__( self, *, - properties: Optional["_models.RestorableDatabaseAccountProperties"] = None, - location: Optional[str] = None, + 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: Optional[Union[str, "_models.CreateMode"]] = None, + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + materialized_views: Optional[list["_models.MaterializedViewDetails"]] = None, + materialized_views_properties: Optional["_models.MaterializedViewsProperties"] = None, + computed_properties: Optional[list["_models.ComputedProperty"]] = None, + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + full_text_policy: Optional["_models.FullTextPolicy"] = None, + data_masking_policy: Optional["_models.DataMaskingPolicy"] = None, ) -> None: ... @overload @@ -10497,80 +15831,97 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class RestorableDatabaseAccountProperties(_Model): - """The properties of a restorable database account. +class RestorableSqlContainerPropertiesResourceContainer( + SqlContainerResource +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Cosmos DB SQL container resource object. - :ivar account_name: The name of the global database account. - :vartype account_name: str - :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). - :vartype creation_time: ~datetime.datetime - :ivar oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :vartype oldest_restorable_time: ~datetime.datetime - :ivar deletion_time: The time at which the restorable database account has been deleted - (ISO-8601 format). - :vartype deletion_time: ~datetime.datetime - :ivar api_type: The API type of the restorable database account. Known values are: "MongoDB", - "Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2". - :vartype api_type: str or ~azure.mgmt.cosmosdb.models.ApiType - :ivar restorable_locations: List of regions where the of the database account can be restored - from. - :vartype restorable_locations: list[~azure.mgmt.cosmosdb.models.RestorableLocationResource] + :ivar 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 account 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 materialized_views: Materialized Views defined on the container. + :vartype materialized_views: list[~azure.mgmt.cosmosdb.models.MaterializedViewDetails] + :ivar materialized_views_properties: Materialized Views Properties defined for source + container. + :vartype materialized_views_properties: ~azure.mgmt.cosmosdb.models.MaterializedViewsProperties + :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 full_text_policy: The FullText policy for the container. + :vartype full_text_policy: ~azure.mgmt.cosmosdb.models.FullTextPolicy + :ivar data_masking_policy: The Data Masking policy for the container. + :vartype data_masking_policy: ~azure.mgmt.cosmosdb.models.DataMaskingPolicy + :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 self_property: A system generated property that specifies the addressable path of the + container resource. + :vartype self_property: str """ - account_name: Optional[str] = rest_field( - name="accountName", visibility=["read", "create", "update", "delete", "query"] - ) - """The name of the global database account.""" - creation_time: Optional[datetime.datetime] = rest_field( - name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The creation time of the restorable database account (ISO-8601 format).""" - oldest_restorable_time: Optional[datetime.datetime] = rest_field( - name="oldestRestorableTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The least recent time at which the database account can be restored to (ISO-8601 format).""" - deletion_time: Optional[datetime.datetime] = rest_field( - name="deletionTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" - ) - """The time at which the restorable database account has been deleted (ISO-8601 format).""" - api_type: Optional[Union[str, "_models.ApiType"]] = rest_field(name="apiType", visibility=["read"]) - """The API type of the restorable database account. Known values are: \"MongoDB\", \"Gremlin\", - \"Cassandra\", \"Table\", \"Sql\", and \"GremlinV2\".""" - restorable_locations: Optional[list["_models.RestorableLocationResource"]] = rest_field( - name="restorableLocations", visibility=["read"] - ) - """List of regions where the of the database account can be restored from.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) + """A system generated property that denotes the last updated timestamp of the resource.""" + etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) + """A system generated property representing the resource etag required for optimistic concurrency + control.""" + self_property: Optional[str] = rest_field(name="_self", visibility=["read"]) + """A system generated property that specifies the addressable path of the container resource.""" @overload def __init__( - self, - *, - account_name: Optional[str] = None, - creation_time: Optional[datetime.datetime] = None, - oldest_restorable_time: Optional[datetime.datetime] = None, - deletion_time: Optional[datetime.datetime] = None, + 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: Optional[Union[str, "_models.CreateMode"]] = None, + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + materialized_views: Optional[list["_models.MaterializedViewDetails"]] = None, + materialized_views_properties: Optional["_models.MaterializedViewsProperties"] = None, + computed_properties: Optional[list["_models.ComputedProperty"]] = None, + vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, + full_text_policy: Optional["_models.FullTextPolicy"] = None, + data_masking_policy: Optional["_models.DataMaskingPolicy"] = None, ) -> None: ... @overload @@ -10584,11 +15935,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableGremlinDatabaseGetResult(_Model): - """An Azure Cosmos DB Gremlin database event. +class RestorableSqlDatabaseGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB SQL database event. - :ivar properties: The properties of a Gremlin database event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseProperties + :ivar properties: The properties of a SQL database event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseProperties :ivar id: The unique resource Identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -10597,10 +15948,10 @@ class RestorableGremlinDatabaseGetResult(_Model): :vartype type: str """ - properties: Optional["_models.RestorableGremlinDatabaseProperties"] = rest_field( + properties: Optional["_models.RestorableSqlDatabaseProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a Gremlin database event.""" + """The properties of a SQL database event.""" id: Optional[str] = rest_field(visibility=["read"]) """The unique resource Identifier of the ARM resource.""" name: Optional[str] = rest_field(visibility=["read"]) @@ -10614,7 +15965,7 @@ class RestorableGremlinDatabaseGetResult(_Model): def __init__( self, *, - properties: Optional["_models.RestorableGremlinDatabaseProperties"] = None, + properties: Optional["_models.RestorableSqlDatabaseProperties"] = None, ) -> None: ... @overload @@ -10646,23 +15997,23 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class RestorableGremlinDatabaseProperties(_Model): - """The properties of an Azure Cosmos DB Gremlin database event. +class RestorableSqlDatabaseProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB SQL database event. - :ivar resource: The resource of an Azure Cosmos DB Gremlin database event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinDatabasePropertiesResource + :ivar resource: The resource of an Azure Cosmos DB SQL database event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource """ - resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = rest_field( + resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB Gremlin database event.""" + """The resource of an Azure Cosmos DB SQL database event.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableGremlinDatabasePropertiesResource"] = None, + resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, ) -> None: ... @overload @@ -10676,8 +16027,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableGremlinDatabasePropertiesResource(_Model): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB Gremlin database event. +class RestorableSqlDatabasePropertiesResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The resource of an Azure Cosmos DB SQL database event. :ivar rid: A system generated property. A unique identifier. :vartype rid: str @@ -10691,10 +16042,12 @@ class RestorableGremlinDatabasePropertiesResource(_Model): # pylint: disable=na :vartype can_undelete_reason: str :ivar event_timestamp: The time when this database event happened. :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin database. + :ivar owner_id: The name of the SQL database. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin database. + :ivar owner_resource_id: The resource ID of the SQL database. :vartype owner_resource_id: str + :ivar database: Cosmos DB SQL database resource object. + :vartype database: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase """ rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) @@ -10711,90 +16064,19 @@ class RestorableGremlinDatabasePropertiesResource(_Model): # pylint: disable=na event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) """The time when this database event happened.""" owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this Gremlin database.""" + """The name of the SQL database.""" owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this Gremlin database.""" - - -class RestorableGremlinGraphGetResult(_Model): - """An Azure Cosmos DB Gremlin graph event. - - :ivar properties: The properties of a Gremlin graph event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphProperties - :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 - """ - - properties: Optional["_models.RestorableGremlinGraphProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The properties of a Gremlin graph event.""" - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource Identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - - __flattened_items = ["resource"] - - @overload - def __init__( - self, - *, - properties: Optional["_models.RestorableGremlinGraphProperties"] = None, - ) -> None: ... - - @overload - def __init__(self, mapping: Mapping[str, Any]) -> None: - """ - :param mapping: raw JSON to initialize the model. - :type mapping: Mapping[str, Any] - """ - - def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} - super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) - - -class RestorableGremlinGraphProperties(_Model): - """The properties of an Azure Cosmos DB Gremlin graph event. - - :ivar resource: The resource of an Azure Cosmos DB Gremlin graph event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableGremlinGraphPropertiesResource - """ - - resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = rest_field( + """The resource ID of the SQL database.""" + database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB Gremlin graph event.""" + """Cosmos DB SQL database resource object.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableGremlinGraphPropertiesResource"] = None, + database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, ) -> None: ... @overload @@ -10808,82 +16090,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableGremlinGraphPropertiesResource(_Model): - """The resource of an Azure Cosmos DB Gremlin graph event. - - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar operation_type: The operation type of this graph 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 graph to identify if this graph is restorable in same - account. - :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this graph can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this graph event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin graph. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin graph. - :vartype owner_resource_id: str - """ - - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( - name="operationType", visibility=["read"] - ) - """The operation type of this graph event. Known values are: \"Create\", \"Replace\", \"Delete\", - \"Recreate\", and \"SystemOperation\".""" - can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this graph to identify if this graph is restorable in same account.""" - can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this graph can not be restored in same account.""" - event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The time when this graph event happened.""" - owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this Gremlin graph.""" - owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this Gremlin graph.""" - - -class RestorableGremlinResourcesGetResult(_Model): - """Specific Databases to restore. +class SqlDatabaseResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB SQL database resource object. - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: Name of the Cosmos DB SQL database. 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 gremlin database available for restore. - :vartype database_name: str - :ivar graph_names: The names of the graphs available for restore. - :vartype graph_names: list[str] + :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 account creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode """ - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB SQL database. Required.""" + restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( + name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] ) - """The name of the gremlin database available for restore.""" - graph_names: Optional[list[str]] = rest_field( - name="graphNames", visibility=["read", "create", "update", "delete", "query"] + """Parameters to indicate the information about the restore.""" + create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( + name="createMode", visibility=["read", "create", "update", "delete", "query"] ) - """The names of the graphs available for restore.""" + """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" @overload def __init__( self, *, - database_name: Optional[str] = None, - graph_names: Optional[list[str]] = None, + id: str, # pylint: disable=redefined-builtin + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @overload @@ -10897,65 +16133,57 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableLocationResource(_Model): - """Properties of the regional restorable account. - - :ivar location_name: The location of the regional restorable account. - :vartype location_name: str - :ivar regional_database_account_instance_id: The instance id of the regional restorable - account. - :vartype regional_database_account_instance_id: str - :ivar creation_time: The creation time of the regional restorable database account (ISO-8601 - format). - :vartype creation_time: ~datetime.datetime - :ivar deletion_time: The time at which the regional restorable database account has been - deleted (ISO-8601 format). - :vartype deletion_time: ~datetime.datetime - """ - - location_name: Optional[str] = rest_field(name="locationName", visibility=["read"]) - """The location of the regional restorable account.""" - regional_database_account_instance_id: Optional[str] = rest_field( - name="regionalDatabaseAccountInstanceId", visibility=["read"] - ) - """The instance id of the regional restorable account.""" - creation_time: Optional[datetime.datetime] = rest_field(name="creationTime", visibility=["read"], format="rfc3339") - """The creation time of the regional restorable database account (ISO-8601 format).""" - deletion_time: Optional[datetime.datetime] = rest_field(name="deletionTime", visibility=["read"], format="rfc3339") - """The time at which the regional restorable database account has been deleted (ISO-8601 format).""" - - -class RestorableMongodbCollectionGetResult(_Model): - """An Azure Cosmos DB MongoDB collection event. +class RestorableSqlDatabasePropertiesResourceDatabase( + SqlDatabaseResource +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only + """Cosmos DB SQL database resource object. - :ivar properties: The properties of a MongoDB collection event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionProperties - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: Name of the Cosmos DB SQL database. 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 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 account creation. Known values are: "Default" + and "Restore". + :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :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 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 """ - properties: Optional["_models.RestorableMongodbCollectionProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """The properties of a MongoDB collection event.""" - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource Identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - - __flattened_items = ["resource"] + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) + """A system generated property that denotes the last updated timestamp of the resource.""" + etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) + """A system generated property representing the resource etag required for optimistic concurrency + control.""" + colls: Optional[str] = rest_field(name="_colls", visibility=["read"]) + """A system generated property that specified the addressable path of the collections resource.""" + users: Optional[str] = rest_field(name="_users", visibility=["read"]) + """A system generated property that specifies the addressable path of the users resource.""" + self_property: Optional[str] = rest_field(name="_self", visibility=["read"]) + """A system generated property that specifies the addressable path of the database resource.""" @overload def __init__( self, *, - properties: Optional["_models.RestorableMongodbCollectionProperties"] = None, + id: str, # pylint: disable=redefined-builtin + restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, ) -> None: ... @overload @@ -10966,44 +16194,45 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class RestorableMongodbCollectionProperties(_Model): - """The properties of an Azure Cosmos DB MongoDB collection event. +class RestorableSqlResourcesGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Specific Databases to restore. - :ivar resource: The resource of an Azure Cosmos DB MongoDB collection event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionPropertiesResource + :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] """ - resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: Optional[str] = rest_field(visibility=["read"]) + """The unique resource identifier of the ARM resource.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the ARM resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of Azure resource.""" + database_name: Optional[str] = rest_field( + name="databaseName", visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB MongoDB collection event.""" + """The name of the database available for restore.""" + collection_names: Optional[list[str]] = rest_field( + name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The names of the collections available for restore.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableMongodbCollectionPropertiesResource"] = None, + database_name: Optional[str] = None, + collection_names: Optional[list[str]] = None, ) -> None: ... @overload @@ -11017,51 +16246,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableMongodbCollectionPropertiesResource(_Model): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB collection event. - - :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 - """ - - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( - name="operationType", visibility=["read"] - ) - """The operation type of this collection event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this collection to identify if this container is restorable in same account.""" - can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this collection can not be restored in same account.""" - event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The time when this collection event happened.""" - owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this MongoDB collection.""" - owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this MongoDB collection.""" - - -class RestorableMongodbDatabaseGetResult(_Model): - """An Azure Cosmos DB MongoDB database event. +class RestorableTableGetResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Table event. - :ivar properties: The properties of a MongoDB database event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseProperties + :ivar properties: The properties of a Table event. + :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableTableProperties :ivar id: The unique resource Identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. @@ -11070,10 +16259,10 @@ class RestorableMongodbDatabaseGetResult(_Model): :vartype type: str """ - properties: Optional["_models.RestorableMongodbDatabaseProperties"] = rest_field( + properties: Optional["_models.RestorableTableProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a MongoDB database event.""" + """The properties of a Table event.""" id: Optional[str] = rest_field(visibility=["read"]) """The unique resource Identifier of the ARM resource.""" name: Optional[str] = rest_field(visibility=["read"]) @@ -11087,7 +16276,7 @@ class RestorableMongodbDatabaseGetResult(_Model): def __init__( self, *, - properties: Optional["_models.RestorableMongodbDatabaseProperties"] = None, + properties: Optional["_models.RestorableTableProperties"] = None, ) -> None: ... @overload @@ -11119,23 +16308,23 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class RestorableMongodbDatabaseProperties(_Model): - """The properties of an Azure Cosmos DB MongoDB database event. +class RestorableTableProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of an Azure Cosmos DB Table event. - :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 Table event. + :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource """ - resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = rest_field( + resource: Optional["_models.RestorableTablePropertiesResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB MongoDB database event.""" + """The resource of an Azure Cosmos DB Table event.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableMongodbDatabasePropertiesResource"] = None, + resource: Optional["_models.RestorableTablePropertiesResource"] = None, ) -> None: ... @overload @@ -11149,24 +16338,24 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableMongodbDatabasePropertiesResource(_Model): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB database event. +class RestorableTablePropertiesResource(_Model): + """The resource of an Azure Cosmos DB Table event. :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 this MongoDB database. + :ivar owner_id: The name of this Table. :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this MongoDB database. + :ivar owner_resource_id: The resource ID of this Table. :vartype owner_resource_id: str """ @@ -11175,56 +16364,97 @@ class RestorableMongodbDatabasePropertiesResource(_Model): # pylint: disable=na operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( name="operationType", visibility=["read"] ) - """The operation type of this database event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" + """The operation type of this table event. Known values are: \"Create\", \"Replace\", \"Delete\", + \"Recreate\", and \"SystemOperation\".""" can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this database to identify if this database is restorable in same account.""" + """A state of this table to identify if this table is restorable in same account.""" can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this database can not be restored in same account.""" + """The reason why this table can not be restored in same account.""" event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The time when this database event happened.""" + """The time when this table event happened.""" owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this MongoDB database.""" + """The name of this Table.""" owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this MongoDB database.""" + """The resource ID of this Table.""" -class RestorableMongodbResourcesGetResult(_Model): +class RestorableTableResourcesGetResult(_Model): """Specific Databases to restore. :ivar id: The unique resource identifier of the ARM resource. :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The name of the Table. :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] """ id: Optional[str] = rest_field(visibility=["read"]) """The unique resource identifier of the ARM resource.""" name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" + """The name of the Table.""" type: Optional[str] = rest_field(visibility=["read"]) """The type of Azure resource.""" - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] + + +class RestoreParameters(RestoreParametersBase): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters to indicate the information about the restore. + + :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 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}. + :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 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 + """ + + restore_mode: Optional[Union[str, "_models.RestoreMode"]] = rest_field( + name="restoreMode", visibility=["read", "create", "update", "delete", "query"] ) - """The name of the database available for restore.""" - collection_names: Optional[list[str]] = rest_field( - name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + """Describes the mode of the restore. \"PointInTime\"""" + databases_to_restore: Optional[list["_models.DatabaseRestoreResource"]] = rest_field( + name="databasesToRestore", visibility=["read", "create", "update", "delete", "query"] ) - """The names of the collections available for restore.""" + """List of specific databases available for restore.""" + gremlin_databases_to_restore: Optional[list["_models.GremlinDatabaseRestoreResource"]] = rest_field( + name="gremlinDatabasesToRestore", visibility=["read", "create", "update", "delete", "query"] + ) + """List of specific gremlin databases available for restore.""" + tables_to_restore: Optional[list[str]] = rest_field( + name="tablesToRestore", visibility=["read", "create", "update", "delete", "query"] + ) + """List of specific tables available for restore.""" + source_backup_location: Optional[str] = rest_field( + name="sourceBackupLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The source backup location for restore.""" @overload def __init__( self, *, - database_name: Optional[str] = None, - collection_names: Optional[list[str]] = None, + restore_with_ttl_disabled: Optional[bool] = None, + restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, + restore_source: Optional[str] = None, + restore_timestamp_in_utc: Optional[datetime.datetime] = None, + databases_to_restore: Optional[list["_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, ) -> None: ... @overload @@ -11238,29 +16468,36 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlContainerGetResult(_Model): - """An Azure Cosmos DB SQL container event. +class RetrieveThroughputParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB retrieve throughput parameters object. - :ivar properties: The properties of a SQL container event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerProperties - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str + :ivar 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 properties: Properties to retrieve throughput parameters object. Required. + :vartype properties: ~azure.mgmt.cosmosdb.models.RetrieveThroughputProperties """ - properties: Optional["_models.RestorableSqlContainerProperties"] = rest_field( + properties: "_models.RetrieveThroughputProperties" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a SQL container event.""" - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource Identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" + """Properties to retrieve throughput parameters object. Required.""" __flattened_items = ["resource"] @@ -11268,7 +16505,10 @@ class RestorableSqlContainerGetResult(_Model): def __init__( self, *, - properties: Optional["_models.RestorableSqlContainerProperties"] = None, + properties: "_models.RetrieveThroughputProperties", + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, ) -> None: ... @overload @@ -11300,23 +16540,23 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class RestorableSqlContainerProperties(_Model): - """The properties of an Azure Cosmos DB SQL container event. +class RetrieveThroughputProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to retrieve throughput for Azure Cosmos DB resource. - :ivar resource: The resource of an Azure Cosmos DB SQL container event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlContainerPropertiesResource + :ivar resource: The standard JSON format of a resource throughput. Required. + :vartype resource: ~azure.mgmt.cosmosdb.models.RetrieveThroughputPropertiesResource """ - resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = rest_field( + resource: "_models.RetrieveThroughputPropertiesResource" = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB SQL container event.""" + """The standard JSON format of a resource throughput. Required.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableSqlContainerPropertiesResource"] = None, + resource: "_models.RetrieveThroughputPropertiesResource", ) -> None: ... @overload @@ -11330,57 +16570,23 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlContainerPropertiesResource(_Model): - """The resource of an Azure Cosmos DB SQL container event. +class RetrieveThroughputPropertiesResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Resource to retrieve throughput information for Cosmos DB resource. - :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", - "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. - :vartype can_undelete: str - :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 when this container event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this SQL container. - :vartype owner_id: str - :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 + :ivar physical_partition_ids: Array of PhysicalPartitionId objects. Required. + :vartype physical_partition_ids: list[~azure.mgmt.cosmosdb.models.PhysicalPartitionId] """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( - name="operationType", visibility=["read"] - ) - """The operation type of this container event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this container to identify if this container is restorable in same account.""" - can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this container can not be restored in same account.""" - event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The when this container event happened.""" - owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this SQL container.""" - owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this SQL container.""" - container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + physical_partition_ids: list["_models.PhysicalPartitionId"] = rest_field( + name="physicalPartitionIds", visibility=["read", "create", "update", "delete", "query"] ) - """Cosmos DB SQL container resource object.""" + """Array of PhysicalPartitionId objects. Required.""" @overload def __init__( self, *, - container: Optional["_models.RestorableSqlContainerPropertiesResourceContainer"] = None, + physical_partition_ids: list["_models.PhysicalPartitionId"], ) -> None: ... @overload @@ -11394,112 +16600,125 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerResource(_Model): - """Cosmos DB SQL container resource object. +class Role(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The set of roles permitted through this Role Definition. - :ivar id: Name of the Cosmos DB SQL container. Required. + :ivar db: The database name the role is applied. + :vartype db: str + :ivar role: The role name. + :vartype role: str + """ + + db: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The database name the role is applied.""" + role: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The role name.""" + + @overload + def __init__( + self, + *, + db: Optional[str] = None, + role: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SeedNode(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """SeedNode. + + :ivar ip_address: IP address of this seed node. + :vartype ip_address: str + """ + + ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) + """IP address of this seed node.""" + + @overload + def __init__( + self, + *, + ip_address: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties for the database account. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :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 account 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 full_text_policy: The FullText policy for the container. - :vartype full_text_policy: ~azure.mgmt.cosmosdb.models.FullTextPolicy + :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: Services response resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties """ - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB SQL container. Required.""" - indexing_policy: Optional["_models.IndexingPolicy"] = rest_field( - name="indexingPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The configuration of the indexing policy. By default, the indexing is automatic for all - document paths within the container.""" - partition_key: Optional["_models.ContainerPartitionKey"] = rest_field( - name="partitionKey", visibility=["read", "create", "update", "delete", "query"] - ) - """The configuration of the partition key to be used for partitioning data into multiple - partitions.""" - default_ttl: Optional[int] = rest_field( - name="defaultTtl", visibility=["read", "create", "update", "delete", "query"] - ) - """Default time to live.""" - unique_key_policy: Optional["_models.UniqueKeyPolicy"] = rest_field( - name="uniqueKeyPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The unique key policy configuration for specifying uniqueness constraints on documents in the - collection in the Azure Cosmos DB service.""" - conflict_resolution_policy: Optional["_models.ConflictResolutionPolicy"] = rest_field( - name="conflictResolutionPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The conflict resolution policy for the container.""" - client_encryption_policy: Optional["_models.ClientEncryptionPolicy"] = rest_field( - name="clientEncryptionPolicy", visibility=["read", "create", "update", "delete", "query"] - ) - """The client encryption policy for the container.""" - analytical_storage_ttl: Optional[int] = rest_field( - name="analyticalStorageTtl", visibility=["read", "create", "update", "delete", "query"] - ) - """Analytical TTL.""" - restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Parameters to indicate the information about the restore.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" - computed_properties: Optional[list["_models.ComputedProperty"]] = rest_field( - name="computedProperties", visibility=["read", "create", "update", "delete", "query"] - ) - """List of computed properties.""" - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = rest_field( - name="vectorEmbeddingPolicy", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.ServiceResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The vector embedding policy for the container.""" - full_text_policy: Optional["_models.FullTextPolicy"] = rest_field( - name="fullTextPolicy", visibility=["read", "create", "update", "delete", "query"] + """Services response resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServiceResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceResourceCreateUpdateParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Parameters for Create or Update request for ServiceResource. + + :ivar properties: Properties in ServiceResourceCreateUpdateParameters. + :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties + """ + + properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The FullText policy for the container.""" + """Properties in ServiceResourceCreateUpdateParameters.""" @overload 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: Optional[Union[str, "_models.CreateMode"]] = None, - computed_properties: Optional[list["_models.ComputedProperty"]] = None, - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, - full_text_policy: Optional["_models.FullTextPolicy"] = None, + properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = None, ) -> None: ... @overload @@ -11513,78 +16732,39 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlContainerPropertiesResourceContainer(SqlContainerResource): # pylint: disable=name-too-long - """Cosmos DB SQL container resource object. +class SoftDeleteConfiguration(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Configuration for soft delete on the Cosmos DB account. - :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 account 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 full_text_policy: The FullText policy for the container. - :vartype full_text_policy: ~azure.mgmt.cosmosdb.models.FullTextPolicy - :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 self_property: A system generated property that specifies the addressable path of the - container resource. - :vartype self_property: str + :ivar soft_deletion_enabled: Flag to indicate whether soft delete is enabled on the account. + :vartype soft_deletion_enabled: bool + :ivar min_minutes_before_permanent_deletion_allowed: Minimum number of minutes before a soft + deleted resource can be permanently deleted. + :vartype min_minutes_before_permanent_deletion_allowed: int + :ivar soft_delete_retention_period_in_minutes: Soft delete retention period in minutes for + resources. + :vartype soft_delete_retention_period_in_minutes: int """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) - """A system generated property that denotes the last updated timestamp of the resource.""" - etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - self_property: Optional[str] = rest_field(name="_self", visibility=["read"]) - """A system generated property that specifies the addressable path of the container resource.""" + soft_deletion_enabled: Optional[bool] = rest_field( + name="softDeletionEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag to indicate whether soft delete is enabled on the account.""" + min_minutes_before_permanent_deletion_allowed: Optional[int] = rest_field( + name="minMinutesBeforePermanentDeletionAllowed", visibility=["read", "create", "update", "delete", "query"] + ) + """Minimum number of minutes before a soft deleted resource can be permanently deleted.""" + soft_delete_retention_period_in_minutes: Optional[int] = rest_field( + name="softDeleteRetentionPeriodInMinutes", visibility=["read", "create", "update", "delete", "query"] + ) + """Soft delete retention period in minutes for resources.""" @overload 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: Optional[Union[str, "_models.CreateMode"]] = None, - computed_properties: Optional[list["_models.ComputedProperty"]] = None, - vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, - full_text_policy: Optional["_models.FullTextPolicy"] = None, + soft_deletion_enabled: Optional[bool] = None, + min_minutes_before_permanent_deletion_allowed: Optional[int] = None, + soft_delete_retention_period_in_minutes: Optional[int] = None, ) -> None: ... @overload @@ -11598,37 +16778,34 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlDatabaseGetResult(_Model): - """An Azure Cosmos DB SQL database event. +class SoftDeletedDatabaseAccountGetResult(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """A Azure Cosmos DB soft-deleted database account. - :ivar properties: The properties of a SQL database event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseProperties - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the ARM resource. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of Azure resource. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountProperties """ - properties: Optional["_models.RestorableSqlDatabaseProperties"] = rest_field( + properties: Optional["_models.SoftDeletedDatabaseAccountProperties"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a SQL database event.""" - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource Identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - - __flattened_items = ["resource"] + """The resource-specific properties for this resource.""" @overload def __init__( self, *, - properties: Optional["_models.RestorableSqlDatabaseProperties"] = None, + properties: Optional["_models.SoftDeletedDatabaseAccountProperties"] = None, ) -> None: ... @overload @@ -11639,44 +16816,47 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) +class SoftDeletedDatabaseAccountProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a soft-deleted database account. -class RestorableSqlDatabaseProperties(_Model): - """The properties of an Azure Cosmos DB SQL database event. - - :ivar resource: The resource of an Azure Cosmos DB SQL database event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResource + :ivar account_name: The name of the database account. + :vartype account_name: str + :ivar soft_deletion_metadata: Metadata related to the soft deletion of the database account. + :vartype soft_deletion_metadata: ~azure.mgmt.cosmosdb.models.SoftDeletionMetadata + :ivar soft_delete_configuration: The soft delete configuration for the database account. + :vartype soft_delete_configuration: ~azure.mgmt.cosmosdb.models.SoftDeleteConfiguration + :ivar resource: A subset of properties of the underlying database account resource. + :vartype resource: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountResource """ - resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = rest_field( + account_name: Optional[str] = rest_field( + name="accountName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the database account.""" + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = rest_field( + name="softDeletionMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata related to the soft deletion of the database account.""" + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = rest_field( + name="softDeleteConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The soft delete configuration for the database account.""" + resource: Optional["_models.SoftDeletedDatabaseAccountResource"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB SQL database event.""" + """A subset of properties of the underlying database account resource.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableSqlDatabasePropertiesResource"] = None, + account_name: Optional[str] = None, + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = None, + soft_delete_configuration: Optional["_models.SoftDeleteConfiguration"] = None, + resource: Optional["_models.SoftDeletedDatabaseAccountResource"] = None, ) -> None: ... @overload @@ -11690,56 +16870,38 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlDatabasePropertiesResource(_Model): - """The resource of an Azure Cosmos DB SQL database event. +class SoftDeletedDatabaseAccountResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The database account resource information for a soft-deleted account. - :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", - "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 locations: An array that contains all of the locations enabled for the Cosmos DB account. + :vartype locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar write_locations: An array that contains the write location(s) for the Cosmos DB account. + :vartype write_locations: list[~azure.mgmt.cosmosdb.models.Location] + :ivar read_locations: An array that contains the read locations enabled for the Cosmos DB account. - :vartype can_undelete: str - :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 database event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of the SQL database. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of the SQL database. - :vartype owner_resource_id: str - :ivar database: Cosmos DB SQL database resource object. - :vartype database: ~azure.mgmt.cosmosdb.models.RestorableSqlDatabasePropertiesResourceDatabase + :vartype read_locations: list[~azure.mgmt.cosmosdb.models.Location] """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( - name="operationType", visibility=["read"] - ) - """The operation type of this database event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this database to identify if this database is restorable in same account.""" - can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this database can not be restored in same account.""" - event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The time when this database event happened.""" - owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of the SQL database.""" - owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of the SQL database.""" - database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = rest_field( + locations: Optional[list["_models.Location"]] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Cosmos DB SQL database resource object.""" + """An array that contains all of the locations enabled for the Cosmos DB account.""" + write_locations: Optional[list["_models.Location"]] = rest_field( + name="writeLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the write location(s) for the Cosmos DB account.""" + read_locations: Optional[list["_models.Location"]] = rest_field( + name="readLocations", visibility=["read", "create", "update", "delete", "query"] + ) + """An array that contains the read locations enabled for the Cosmos DB account.""" @overload def __init__( self, *, - database: Optional["_models.RestorableSqlDatabasePropertiesResourceDatabase"] = None, + locations: Optional[list["_models.Location"]] = None, + write_locations: Optional[list["_models.Location"]] = None, + read_locations: Optional[list["_models.Location"]] = None, ) -> None: ... @overload @@ -11753,36 +16915,29 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlDatabaseResource(_Model): - """Cosmos DB SQL database resource object. +class SoftDeletedDatabaseAccountsListResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The List operation response, that contains the soft-deleted database accounts and their + properties. - :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 account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode + :ivar value: The SoftDeletedDatabaseAccountGetResult items on this page. Required. + :vartype value: list[~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountGetResult] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ - id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Name of the Cosmos DB SQL database. Required.""" - restore_parameters: Optional["_models.ResourceRestoreParameters"] = rest_field( - name="restoreParameters", visibility=["read", "create", "update", "delete", "query"] - ) - """Parameters to indicate the information about the restore.""" - create_mode: Optional[Union[str, "_models.CreateMode"]] = rest_field( - name="createMode", visibility=["read", "create", "update", "delete", "query"] + value: list["_models.SoftDeletedDatabaseAccountGetResult"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + """The SoftDeletedDatabaseAccountGetResult items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + value: list["_models.SoftDeletedDatabaseAccountGetResult"], + next_link: Optional[str] = None, ) -> None: ... @overload @@ -11796,55 +16951,34 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource): # pylint: disable=name-too-long - """Cosmos DB SQL database resource object. +class SoftDeletedSqlContainerGetResult(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB soft-deleted SQL container. - :ivar id: Name of the Cosmos DB SQL database. Required. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :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 account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: str or ~azure.mgmt.cosmosdb.models.CreateMode - :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 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 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: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerProperties """ - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - ts: Optional[float] = rest_field(name="_ts", visibility=["read"]) - """A system generated property that denotes the last updated timestamp of the resource.""" - etag: Optional[str] = rest_field(name="_etag", visibility=["read"]) - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - colls: Optional[str] = rest_field(name="_colls", visibility=["read"]) - """A system generated property that specified the addressable path of the collections resource.""" - users: Optional[str] = rest_field(name="_users", visibility=["read"]) - """A system generated property that specifies the addressable path of the users resource.""" - self_property: Optional[str] = rest_field(name="_self", visibility=["read"]) - """A system generated property that specifies the addressable path of the database resource.""" + properties: Optional["_models.SoftDeletedSqlContainerProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" @overload def __init__( self, *, - id: str, # pylint: disable=redefined-builtin - restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, - create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + properties: Optional["_models.SoftDeletedSqlContainerProperties"] = None, ) -> None: ... @overload @@ -11858,42 +16992,30 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableSqlResourcesGetResult(_Model): - """Specific Databases to restore. +class SoftDeletedSqlContainerProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a soft-deleted SQL container. - :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] + :ivar soft_deletion_metadata: Metadata related to the soft deletion of the SQL container. + :vartype soft_deletion_metadata: ~azure.mgmt.cosmosdb.models.SoftDeletionMetadata + :ivar resource: The resource information for the soft-deleted SQL container. + :vartype resource: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerResource """ - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - database_name: Optional[str] = rest_field( - name="databaseName", visibility=["read", "create", "update", "delete", "query"] + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = rest_field( + name="softDeletionMetadata", visibility=["read", "create", "update", "delete", "query"] ) - """The name of the database available for restore.""" - collection_names: Optional[list[str]] = rest_field( - name="collectionNames", visibility=["read", "create", "update", "delete", "query"] + """Metadata related to the soft deletion of the SQL container.""" + resource: Optional["_models.SoftDeletedSqlContainerResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The names of the collections available for restore.""" + """The resource information for the soft-deleted SQL container.""" @overload def __init__( self, *, - database_name: Optional[str] = None, - collection_names: Optional[list[str]] = None, + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = None, + resource: Optional["_models.SoftDeletedSqlContainerResource"] = None, ) -> None: ... @overload @@ -11907,37 +17029,41 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableTableGetResult(_Model): - """An Azure Cosmos DB Table event. +class SoftDeletedSqlContainerResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB SQL container resource object. - :ivar properties: The properties of a Table event. - :vartype properties: ~azure.mgmt.cosmosdb.models.RestorableTableProperties - :ivar id: The unique resource Identifier of the ARM resource. + :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 rid: A system generated property. A unique identifier. + :vartype rid: str + :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 """ - properties: Optional["_models.RestorableTableProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB SQL container. Required.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" + partition_key: Optional["_models.ContainerPartitionKey"] = rest_field( + name="partitionKey", visibility=["read", "create", "update", "delete", "query"] ) - """The properties of a Table event.""" - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource Identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the ARM resource.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - - __flattened_items = ["resource"] + """The configuration of the partition key to be used for partitioning data into multiple + partitions.""" + default_ttl: Optional[int] = rest_field( + name="defaultTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """Default time to live.""" @overload def __init__( self, *, - properties: Optional["_models.RestorableTableProperties"] = None, + id: str, # pylint: disable=redefined-builtin + partition_key: Optional["_models.ContainerPartitionKey"] = None, + default_ttl: Optional[int] = None, ) -> None: ... @overload @@ -11948,44 +17074,32 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) - for k, v in _flattened_input.items(): - setattr(self, k, v) - - def __getattr__(self, name: str) -> Any: - if name in self.__flattened_items: - if self.properties is None: - return None - return getattr(self.properties, name) - raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") - - def __setattr__(self, key: str, value: Any) -> None: - if key in self.__flattened_items: - if self.properties is None: - self.properties = self._attr_to_rest_field["properties"]._class_type() - setattr(self.properties, key, value) - else: - super().__setattr__(key, value) -class RestorableTableProperties(_Model): - """The properties of an Azure Cosmos DB Table event. +class SoftDeletedSqlContainersListResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The List operation response, that contains the soft-deleted SQL containers and their + properties. - :ivar resource: The resource of an Azure Cosmos DB Table event. - :vartype resource: ~azure.mgmt.cosmosdb.models.RestorableTablePropertiesResource + :ivar value: The SoftDeletedSqlContainerGetResult items on this page. Required. + :vartype value: list[~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerGetResult] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ - resource: Optional["_models.RestorableTablePropertiesResource"] = rest_field( + value: list["_models.SoftDeletedSqlContainerGetResult"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """The resource of an Azure Cosmos DB Table event.""" + """The SoftDeletedSqlContainerGetResult items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" @overload def __init__( self, *, - resource: Optional["_models.RestorableTablePropertiesResource"] = None, + value: list["_models.SoftDeletedSqlContainerGetResult"], + next_link: Optional[str] = None, ) -> None: ... @overload @@ -11999,123 +17113,34 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RestorableTablePropertiesResource(_Model): - """The resource of an Azure Cosmos DB Table event. - - :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 - """ - - rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) - """A system generated property. A unique identifier.""" - operation_type: Optional[Union[str, "_models.OperationType"]] = rest_field( - name="operationType", visibility=["read"] - ) - """The operation type of this table event. Known values are: \"Create\", \"Replace\", \"Delete\", - \"Recreate\", and \"SystemOperation\".""" - can_undelete: Optional[str] = rest_field(name="canUndelete", visibility=["read"]) - """A state of this table to identify if this table is restorable in same account.""" - can_undelete_reason: Optional[str] = rest_field(name="canUndeleteReason", visibility=["read"]) - """The reason why this table can not be restored in same account.""" - event_timestamp: Optional[str] = rest_field(name="eventTimestamp", visibility=["read"]) - """The time when this table event happened.""" - owner_id: Optional[str] = rest_field(name="ownerId", visibility=["read"]) - """The name of this Table.""" - owner_resource_id: Optional[str] = rest_field(name="ownerResourceId", visibility=["read"]) - """The resource ID of this Table.""" - - -class RestorableTableResourcesGetResult(_Model): - """Specific Databases to restore. +class SoftDeletedSqlDatabaseGetResult(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB soft-deleted SQL database. - :ivar id: The unique resource identifier of the ARM resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the Table. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseProperties """ - id: Optional[str] = rest_field(visibility=["read"]) - """The unique resource identifier of the ARM resource.""" - name: Optional[str] = rest_field(visibility=["read"]) - """The name of the Table.""" - type: Optional[str] = rest_field(visibility=["read"]) - """The type of Azure resource.""" - - -class RestoreParameters(RestoreParametersBase): - """Parameters to indicate the information about the restore. - - :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 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}. - :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 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 - """ - - restore_mode: Optional[Union[str, "_models.RestoreMode"]] = rest_field( - name="restoreMode", visibility=["read", "create", "update", "delete", "query"] - ) - """Describes the mode of the restore. \"PointInTime\"""" - databases_to_restore: Optional[list["_models.DatabaseRestoreResource"]] = rest_field( - name="databasesToRestore", visibility=["read", "create", "update", "delete", "query"] - ) - """List of specific databases available for restore.""" - gremlin_databases_to_restore: Optional[list["_models.GremlinDatabaseRestoreResource"]] = rest_field( - name="gremlinDatabasesToRestore", visibility=["read", "create", "update", "delete", "query"] - ) - """List of specific gremlin databases available for restore.""" - tables_to_restore: Optional[list[str]] = rest_field( - name="tablesToRestore", visibility=["read", "create", "update", "delete", "query"] - ) - """List of specific tables available for restore.""" - source_backup_location: Optional[str] = rest_field( - name="sourceBackupLocation", visibility=["read", "create", "update", "delete", "query"] + properties: Optional["_models.SoftDeletedSqlDatabaseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """The source backup location for restore.""" + """The resource-specific properties for this resource.""" @overload def __init__( self, *, - restore_with_ttl_disabled: Optional[bool] = None, - restore_mode: Optional[Union[str, "_models.RestoreMode"]] = None, - restore_source: Optional[str] = None, - restore_timestamp_in_utc: Optional[datetime.datetime] = None, - databases_to_restore: Optional[list["_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, + properties: Optional["_models.SoftDeletedSqlDatabaseProperties"] = None, ) -> None: ... @overload @@ -12129,26 +17154,30 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Role(_Model): - """The set of roles permitted through this Role Definition. +class SoftDeletedSqlDatabaseProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The properties of a soft-deleted SQL database. - :ivar db: The database name the role is applied. - :vartype db: str - :ivar role: The role name. - :vartype role: str + :ivar soft_deletion_metadata: Metadata related to the soft deletion of the SQL database. + :vartype soft_deletion_metadata: ~azure.mgmt.cosmosdb.models.SoftDeletionMetadata + :ivar resource: The resource information for the soft-deleted SQL database. + :vartype resource: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseResource """ - db: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The database name the role is applied.""" - role: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The role name.""" + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = rest_field( + name="softDeletionMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata related to the soft deletion of the SQL database.""" + resource: Optional["_models.SoftDeletedSqlDatabaseResource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource information for the soft-deleted SQL database.""" @overload def __init__( self, *, - db: Optional[str] = None, - role: Optional[str] = None, + soft_deletion_metadata: Optional["_models.SoftDeletionMetadata"] = None, + resource: Optional["_models.SoftDeletedSqlDatabaseResource"] = None, ) -> None: ... @overload @@ -12162,21 +17191,25 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SeedNode(_Model): - """SeedNode. +class SoftDeletedSqlDatabaseResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB SQL database resource object. - :ivar ip_address: IP address of this seed node. - :vartype ip_address: str + :ivar id: Name of the Cosmos DB SQL database. Required. + :vartype id: str + :ivar rid: A system generated property. A unique identifier. + :vartype rid: str """ - ip_address: Optional[str] = rest_field(name="ipAddress", visibility=["read", "create", "update", "delete", "query"]) - """IP address of this seed node.""" + id: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the Cosmos DB SQL database. Required.""" + rid: Optional[str] = rest_field(name="_rid", visibility=["read"]) + """A system generated property. A unique identifier.""" @overload def __init__( self, *, - ip_address: Optional[str] = None, + id: str, # pylint: disable=redefined-builtin ) -> None: ... @overload @@ -12190,34 +17223,28 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ServiceResource(ProxyResource): - """Properties for the database account. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData - :ivar properties: Services response resource. - :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceProperties +class SoftDeletedSqlDatabasesListResult(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """The List operation response, that contains the soft-deleted SQL databases and their properties. + + :ivar value: The SoftDeletedSqlDatabaseGetResult items on this page. Required. + :vartype value: list[~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseGetResult] + :ivar next_link: The link to the next page of items. + :vartype next_link: str """ - properties: Optional["_models.ServiceResourceProperties"] = rest_field( + value: list["_models.SoftDeletedSqlDatabaseGetResult"] = rest_field( visibility=["read", "create", "update", "delete", "query"] ) - """Services response resource.""" + """The SoftDeletedSqlDatabaseGetResult items on this page. Required.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The link to the next page of items.""" @overload def __init__( self, *, - properties: Optional["_models.ServiceResourceProperties"] = None, + value: list["_models.SoftDeletedSqlDatabaseGetResult"], + next_link: Optional[str] = None, ) -> None: ... @overload @@ -12231,23 +17258,38 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ServiceResourceCreateUpdateParameters(_Model): - """Parameters for Create or Update request for ServiceResource. +class SoftDeletionMetadata(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Metadata about the soft deletion of a resource. - :ivar properties: Properties in ServiceResourceCreateUpdateParameters. - :vartype properties: ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateProperties + :ivar is_soft_deleted: Indicates whether the resource is soft deleted. + :vartype is_soft_deleted: bool + :ivar soft_deletion_start_timestamp: The timestamp when the soft deletion started. + :vartype soft_deletion_start_timestamp: int + :ivar soft_deletion_resource_expiration_timestamp: The timestamp when the soft-deleted resource + will expire and be permanently deleted. + :vartype soft_deletion_resource_expiration_timestamp: int """ - properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = rest_field( - visibility=["read", "create", "update", "delete", "query"] + is_soft_deleted: Optional[bool] = rest_field( + name="isSoftDeleted", visibility=["read", "create", "update", "delete", "query"] ) - """Properties in ServiceResourceCreateUpdateParameters.""" + """Indicates whether the resource is soft deleted.""" + soft_deletion_start_timestamp: Optional[int] = rest_field( + name="softDeletionStartTimestamp", visibility=["read", "create", "update", "delete", "query"] + ) + """The timestamp when the soft deletion started.""" + soft_deletion_resource_expiration_timestamp: Optional[int] = rest_field( + name="softDeletionResourceExpirationTimestamp", visibility=["read", "create", "update", "delete", "query"] + ) + """The timestamp when the soft-deleted resource will expire and be permanently deleted.""" @overload def __init__( self, *, - properties: Optional["_models.ServiceResourceCreateUpdateProperties"] = None, + is_soft_deleted: Optional[bool] = None, + soft_deletion_start_timestamp: Optional[int] = None, + soft_deletion_resource_expiration_timestamp: Optional[int] = None, ) -> None: ... @overload @@ -12261,7 +17303,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SpatialSpec(_Model): +class SpatialSpec(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """SpatialSpec. :ivar path: The path for which the indexing behavior applies to. Index paths typically start @@ -12298,7 +17340,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerCreateUpdateParameters(ARMResourceProperties): +class SqlContainerCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB container. :ivar id: The unique resource identifier of the ARM resource. @@ -12368,7 +17412,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlContainerCreateUpdateProperties(_Model): +class SqlContainerCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB container. :ivar resource: The standard JSON format of a container. Required. @@ -12405,7 +17449,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerGetProperties(_Model): +class SqlContainerGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB container. :ivar resource: @@ -12440,7 +17484,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerGetPropertiesOptions(OptionsResource): +class SqlContainerGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlContainerGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -12469,7 +17513,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerGetPropertiesResource(SqlContainerResource): +class SqlContainerGetPropertiesResource( + SqlContainerResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlContainerGetPropertiesResource. :ivar id: Name of the Cosmos DB SQL container. Required. @@ -12496,12 +17542,22 @@ class SqlContainerGetPropertiesResource(SqlContainerResource): :ivar create_mode: Enum to indicate the mode of account 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 materialized_views: Materialized Views defined on the container. + :vartype materialized_views: list[~azure.mgmt.cosmosdb.models.MaterializedViewDetails] + :ivar materialized_views_properties: Materialized Views Properties defined for source + container. + :vartype materialized_views_properties: ~azure.mgmt.cosmosdb.models.MaterializedViewsProperties :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 full_text_policy: The FullText policy for the container. :vartype full_text_policy: ~azure.mgmt.cosmosdb.models.FullTextPolicy + :ivar data_masking_policy: The Data Masking policy for the container. + :vartype data_masking_policy: ~azure.mgmt.cosmosdb.models.DataMaskingPolicy :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. @@ -12533,9 +17589,13 @@ def __init__( analytical_storage_ttl: Optional[int] = None, restore_parameters: Optional["_models.ResourceRestoreParameters"] = None, create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + materialized_view_definition: Optional["_models.MaterializedViewDefinition"] = None, + materialized_views: Optional[list["_models.MaterializedViewDetails"]] = None, + materialized_views_properties: Optional["_models.MaterializedViewsProperties"] = None, computed_properties: Optional[list["_models.ComputedProperty"]] = None, vector_embedding_policy: Optional["_models.VectorEmbeddingPolicy"] = None, full_text_policy: Optional["_models.FullTextPolicy"] = None, + data_masking_policy: Optional["_models.DataMaskingPolicy"] = None, ) -> None: ... @overload @@ -12549,7 +17609,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlContainerGetResults(ProxyResource): +class SqlContainerGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB container. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -12637,7 +17697,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): +class SqlDatabaseCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB SQL database. :ivar id: The unique resource identifier of the ARM resource. @@ -12707,7 +17769,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlDatabaseCreateUpdateProperties(_Model): +class SqlDatabaseCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB SQL database. :ivar resource: The standard JSON format of a SQL database. Required. @@ -12744,7 +17806,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlDatabaseGetProperties(_Model): +class SqlDatabaseGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB SQL database. :ivar resource: @@ -12779,7 +17841,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlDatabaseGetPropertiesOptions(OptionsResource): +class SqlDatabaseGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlDatabaseGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -12808,7 +17870,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlDatabaseGetPropertiesResource(SqlDatabaseResource): +class SqlDatabaseGetPropertiesResource( + SqlDatabaseResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlDatabaseGetPropertiesResource. :ivar id: Name of the Cosmos DB SQL database. Required. @@ -12867,7 +17931,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlDatabaseGetResults(ProxyResource): +class SqlDatabaseGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB SQL database. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -12975,7 +18039,7 @@ class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): # py class SqlDedicatedGatewayServiceResourceCreateUpdateProperties( ServiceResourceCreateUpdateProperties, discriminator="SqlDedicatedGateway" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Properties for Create or Update request for SqlDedicatedGatewayServiceResource. :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", @@ -13021,7 +18085,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class SqlDedicatedGatewayServiceResourceProperties( ServiceResourceProperties, discriminator="SqlDedicatedGateway" -): # pylint: disable=name-too-long +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Properties for SqlDedicatedGatewayServiceResource. :ivar creation_time: Time of the last state change (ISO-8601 format). @@ -13082,7 +18146,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.service_type = ServiceType.SQL_DEDICATED_GATEWAY # type: ignore -class SqlRoleAssignmentCreateUpdateParameters(_Model): +class SqlRoleAssignmentCreateUpdateParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB SQL Role Assignment. :ivar properties: Properties to create and update an Azure Cosmos DB SQL Role Assignment. @@ -13132,7 +18196,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlRoleAssignmentGetResults(ProxyResource): +class SqlRoleAssignmentGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB Role Assignment. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -13193,7 +18257,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlRoleAssignmentResource(_Model): +class SqlRoleAssignmentResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Cosmos DB SQL Role Assignment resource object. :ivar role_definition_id: The unique identifier for the associated Role Definition. @@ -13240,7 +18304,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlRoleDefinitionCreateUpdateParameters(_Model): +class SqlRoleDefinitionCreateUpdateParameters(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB SQL Role Definition. :ivar properties: Properties to create and update an Azure Cosmos DB SQL Role Definition. @@ -13290,7 +18354,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlRoleDefinitionGetResults(ProxyResource): +class SqlRoleDefinitionGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB SQL Role Definition. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -13351,7 +18415,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlRoleDefinitionResource(_Model): +class SqlRoleDefinitionResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Cosmos DB SQL Role Definition resource object. :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database @@ -13411,7 +18475,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties): +class SqlStoredProcedureCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB storedProcedure. :ivar id: The unique resource identifier of the ARM resource. @@ -13481,7 +18547,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlStoredProcedureCreateUpdateProperties(_Model): +class SqlStoredProcedureCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB storedProcedure. :ivar resource: The standard JSON format of a storedProcedure. Required. @@ -13520,7 +18586,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlStoredProcedureGetProperties(_Model): +class SqlStoredProcedureGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB StoredProcedure. :ivar resource: @@ -13549,7 +18615,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlStoredProcedureResource(_Model): +class SqlStoredProcedureResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB SQL storedProcedure resource object. :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. @@ -13582,7 +18648,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource): +class SqlStoredProcedureGetPropertiesResource( + SqlStoredProcedureResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlStoredProcedureGetPropertiesResource. :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. @@ -13625,7 +18693,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlStoredProcedureGetResults(ProxyResource): +class SqlStoredProcedureGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB storedProcedure. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -13713,7 +18781,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlTriggerCreateUpdateParameters(ARMResourceProperties): +class SqlTriggerCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB trigger. :ivar id: The unique resource identifier of the ARM resource. @@ -13783,7 +18853,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlTriggerCreateUpdateProperties(_Model): +class SqlTriggerCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB trigger. :ivar resource: The standard JSON format of a trigger. Required. @@ -13820,7 +18890,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlTriggerGetProperties(_Model): +class SqlTriggerGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB trigger. :ivar resource: @@ -13849,7 +18919,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlTriggerResource(_Model): +class SqlTriggerResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB SQL trigger resource object. :ivar id: Name of the Cosmos DB SQL trigger. Required. @@ -13898,7 +18968,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlTriggerGetPropertiesResource(SqlTriggerResource): +class SqlTriggerGetPropertiesResource( + SqlTriggerResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """SqlTriggerGetPropertiesResource. :ivar id: Name of the Cosmos DB SQL trigger. Required. @@ -13948,7 +19020,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlTriggerGetResults(ProxyResource): +class SqlTriggerGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB trigger. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -14036,7 +19108,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): # pylint: disable=name-too-long +class SqlUserDefinedFunctionCreateUpdateParameters( + ARMResourceProperties +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB userDefinedFunction. :ivar id: The unique resource identifier of the ARM resource. @@ -14107,7 +19181,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SqlUserDefinedFunctionCreateUpdateProperties(_Model): # pylint: disable=name-too-long +class SqlUserDefinedFunctionCreateUpdateProperties( + _Model +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB userDefinedFunction. :ivar resource: The standard JSON format of a userDefinedFunction. Required. @@ -14146,7 +19222,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlUserDefinedFunctionGetProperties(_Model): +class SqlUserDefinedFunctionGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB userDefinedFunction. :ivar resource: @@ -14175,7 +19251,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlUserDefinedFunctionResource(_Model): +class SqlUserDefinedFunctionResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB SQL userDefinedFunction resource object. :ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required. @@ -14208,7 +19284,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlUserDefinedFunctionGetPropertiesResource(SqlUserDefinedFunctionResource): # pylint: disable=name-too-long +class SqlUserDefinedFunctionGetPropertiesResource( + SqlUserDefinedFunctionResource +): # pylint: disable=name-too-long,docstring-keyword-should-match-keyword-only """SqlUserDefinedFunctionGetPropertiesResource. :ivar id: Name of the Cosmos DB SQL userDefinedFunction. Required. @@ -14251,7 +19329,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SqlUserDefinedFunctionGetResults(ProxyResource): +class SqlUserDefinedFunctionGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB userDefinedFunction. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -14339,7 +19417,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class SystemData(_Model): +class SystemData(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. @@ -14406,7 +19484,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableCreateUpdateParameters(ARMResourceProperties): +class TableCreateUpdateParameters(ARMResourceProperties): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update Cosmos DB Table. :ivar id: The unique resource identifier of the ARM resource. @@ -14476,7 +19554,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class TableCreateUpdateProperties(_Model): +class TableCreateUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to create and update Azure Cosmos DB Table. :ivar resource: The standard JSON format of a Table. Required. @@ -14513,7 +19591,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableGetProperties(_Model): +class TableGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos Table. :ivar resource: @@ -14548,7 +19626,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableGetPropertiesOptions(OptionsResource): +class TableGetPropertiesOptions(OptionsResource): # pylint: disable=docstring-keyword-should-match-keyword-only """TableGetPropertiesOptions. :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the @@ -14577,7 +19655,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableResource(_Model): +class TableResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB table resource object. :ivar id: Name of the Cosmos DB table. Required. @@ -14620,7 +19698,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableGetPropertiesResource(TableResource): +class TableGetPropertiesResource(TableResource): # pylint: disable=docstring-keyword-should-match-keyword-only """TableGetPropertiesResource. :ivar id: Name of the Cosmos DB table. Required. @@ -14667,7 +19745,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableGetResults(ProxyResource): +class TableGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB Table. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -14755,7 +19833,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class TableRoleAssignmentResource(ProxyResource): +class TableRoleAssignmentResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB Table Role Assignment. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -14816,7 +19894,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class TableRoleAssignmentResourceProperties(_Model): +class TableRoleAssignmentResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Cosmos DB Table Role Assignment resource object. :ivar role_definition_id: The unique identifier for the associated Role Definition. @@ -14868,7 +19946,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TableRoleDefinitionResource(ProxyResource): +class TableRoleDefinitionResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to create and update an Azure Cosmos DB Table Role Definition. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -14929,7 +20007,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class TableRoleDefinitionResourceProperties(_Model): +class TableRoleDefinitionResourceProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Azure Cosmos DB Table Role Definition resource object. :ivar id: The path id for the Role Definition. @@ -14994,7 +20072,50 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ThroughputPolicyResource(_Model): +class ThroughputBucketResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Cosmos DB throughput bucket object. + + :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 + :ivar is_default_bucket: Indicates whether this is the default throughput bucket. + :vartype is_default_bucket: bool + """ + + id: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Represents the throughput bucket id. Required.""" + max_throughput_percentage: int = rest_field( + name="maxThroughputPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents maximum percentage throughput that can be used by the bucket. Required.""" + is_default_bucket: Optional[bool] = rest_field( + name="isDefaultBucket", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether this is the default throughput bucket.""" + + @overload + def __init__( + self, + *, + id: int, # pylint: disable=redefined-builtin + max_throughput_percentage: int, + is_default_bucket: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThroughputPolicyResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB resource throughput policy. :ivar is_enabled: Determines whether the ThroughputPolicy is active or not. @@ -15033,7 +20154,278 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ThroughputSettingsGetProperties(_Model): +class ThroughputPoolAccountProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Global Database Account which is part of a Throughputpool. + + :ivar provisioning_state: A provisioning state of the ThroughputPool Account. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :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 + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """A provisioning state of the ThroughputPool Account. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + account_resource_identifier: Optional[str] = rest_field( + name="accountResourceIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource identifier of global database account in the throughputPool.""" + account_location: Optional[str] = rest_field( + name="accountLocation", visibility=["read", "create", "update", "delete", "query"] + ) + """The location of global database account in the throughputPool.""" + account_instance_id: Optional[str] = rest_field(name="accountInstanceId", visibility=["read"]) + """The instance id of global database account in the throughputPool.""" + + @overload + def __init__( + self, + *, + account_resource_identifier: Optional[str] = None, + account_location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThroughputPoolAccountResource(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Throughputpool Account. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.cosmosdb.models.SystemData + :ivar properties: An Azure Cosmos DB Global Database Account which is part of a Throughputpool. + :vartype properties: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountProperties + """ + + properties: Optional["_models.ThroughputPoolAccountProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """An Azure Cosmos DB Global Database Account which is part of a Throughputpool.""" + + __flattened_items = ["provisioning_state", "account_resource_identifier", "account_location", "account_instance_id"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ThroughputPoolAccountProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ThroughputPoolProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Properties to update Azure Cosmos DB throughput pool. + + :ivar provisioning_state: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :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 + """ + + provisioning_state: Optional[Union[str, "_models.Status"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """A provisioning state of the ThroughputPool. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + max_throughput: Optional[int] = rest_field( + name="maxThroughput", visibility=["read", "create", "update", "delete", "query"] + ) + """Value for throughput to be shared among CosmosDB resources in the pool.""" + + @overload + def __init__( + self, + *, + provisioning_state: Optional[Union[str, "_models.Status"]] = None, + max_throughput: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ThroughputPoolResource(TrackedResource): # pylint: disable=docstring-keyword-should-match-keyword-only + """An Azure Cosmos DB Throughputpool. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar 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 + :ivar properties: Properties to update Azure Cosmos DB throughput pool. + :vartype properties: ~azure.mgmt.cosmosdb.models.ThroughputPoolProperties + """ + + properties: Optional["_models.ThroughputPoolProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties to update Azure Cosmos DB throughput pool.""" + + __flattened_items = ["provisioning_state", "max_throughput"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ThroughputPoolProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ThroughputPoolUpdate(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only + """Represents a throughput pool resource for updates. + + :ivar properties: Properties of the throughput pool. + :vartype properties: ~azure.mgmt.cosmosdb.models.ThroughputPoolProperties + """ + + properties: Optional["_models.ThroughputPoolProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the throughput pool.""" + + __flattened_items = ["provisioning_state", "max_throughput"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ThroughputPoolProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ThroughputSettingsGetProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The properties of an Azure Cosmos DB resource throughput. :ivar resource: @@ -15062,7 +20454,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ThroughputSettingsResource(_Model): +class ThroughputSettingsResource(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB resource throughput object. Either throughput is required or autoscaleSettings is required, but not both. @@ -15082,6 +20474,9 @@ class ThroughputSettingsResource(_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] """ throughput: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -15103,6 +20498,10 @@ class ThroughputSettingsResource(_Model): ) """The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified.""" + throughput_buckets: Optional[list["_models.ThroughputBucketResource"]] = rest_field( + name="throughputBuckets", visibility=["read", "create", "update", "delete", "query"] + ) + """Array of throughput bucket limits to be applied to the Cosmos DB container.""" @overload def __init__( @@ -15110,6 +20509,7 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, + throughput_buckets: Optional[list["_models.ThroughputBucketResource"]] = None, ) -> None: ... @overload @@ -15123,7 +20523,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): +class ThroughputSettingsGetPropertiesResource( + ThroughputSettingsResource +): # pylint: disable=docstring-keyword-should-match-keyword-only """ThroughputSettingsGetPropertiesResource. :ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or @@ -15142,6 +20544,9 @@ class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): :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] :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. @@ -15165,6 +20570,7 @@ def __init__( *, throughput: Optional[int] = None, autoscale_settings: Optional["_models.AutoscaleSettingsResource"] = None, + throughput_buckets: Optional[list["_models.ThroughputBucketResource"]] = None, ) -> None: ... @overload @@ -15178,7 +20584,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ThroughputSettingsGetResults(ProxyResource): +class ThroughputSettingsGetResults(ProxyResource): # pylint: disable=docstring-keyword-should-match-keyword-only """An Azure Cosmos DB resource throughput. :ivar id: Fully qualified resource ID for the resource. Ex - @@ -15266,7 +20672,9 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class ThroughputSettingsUpdateParameters(ARMResourceProperties): +class ThroughputSettingsUpdateParameters( + ARMResourceProperties +): # pylint: disable=docstring-keyword-should-match-keyword-only """Parameters to update Cosmos DB resource throughput. :ivar id: The unique resource identifier of the ARM resource. @@ -15336,7 +20744,7 @@ def __setattr__(self, key: str, value: Any) -> None: super().__setattr__(key, value) -class ThroughputSettingsUpdateProperties(_Model): +class ThroughputSettingsUpdateProperties(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Properties to update Azure Cosmos DB resource throughput. :ivar resource: The standard JSON format of a resource throughput. Required. @@ -15366,7 +20774,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class UniqueKey(_Model): +class UniqueKey(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. @@ -15395,7 +20803,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class UniqueKeyPolicy(_Model): +class UniqueKeyPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. @@ -15428,7 +20836,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorEmbedding(_Model): +class VectorEmbedding(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Represents a vector embedding. A vector embedding is used to define a vector field in the documents. @@ -15480,7 +20888,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorEmbeddingPolicy(_Model): +class VectorEmbeddingPolicy(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Cosmos DB Vector Embedding Policy. :ivar vector_embeddings: List of vector embeddings. @@ -15510,7 +20918,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VectorIndex(_Model): +class VectorIndex(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """VectorIndex. :ivar path: The path to the vector field in the document. Required. @@ -15577,7 +20985,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class VirtualNetworkRule(_Model): +class VirtualNetworkRule(_Model): # pylint: disable=docstring-keyword-should-match-keyword-only """Virtual Network ACL Rule object. :ivar id: Resource ID of a subnet, for example: diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level 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 fa812606dc52..307a22ea7774 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 @@ -14,14 +14,23 @@ from ._operations import Operations # type: ignore from ._operations import DatabaseAccountsOperations # type: ignore +from ._operations import CopyJobsOperations # type: ignore +from ._operations import GraphResourcesOperations # type: ignore from ._operations import SqlResourcesOperations # type: ignore from ._operations import MongoDBResourcesOperations # type: ignore from ._operations import TableResourcesOperations # type: ignore from ._operations import CassandraResourcesOperations # type: ignore from ._operations import GremlinResourcesOperations # type: ignore +from ._operations import DataTransferJobsOperations # type: ignore +from ._operations import GarnetClustersOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore from ._operations import NotebookWorkspacesOperations # type: ignore from ._operations import PrivateEndpointConnectionsOperations # type: ignore from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import SoftDeletedDatabaseAccountsOperations # type: ignore +from ._operations import SoftDeletedSqlDatabasesOperations # type: ignore +from ._operations import SoftDeletedSqlContainersOperations # type: ignore +from ._operations import ChaosFaultOperations # type: ignore from ._operations import DatabaseOperations # type: ignore from ._operations import CollectionOperations # type: ignore from ._operations import CollectionRegionOperations # type: ignore @@ -49,8 +58,13 @@ from ._operations import RestorableTablesOperations # type: ignore from ._operations import RestorableTableResourcesOperations # type: ignore from ._operations import ServiceOperations # type: ignore +from ._operations import ThroughputPoolOperations # type: ignore +from ._operations import ThroughputPoolsOperations # type: ignore +from ._operations import ThroughputPoolAccountOperations # type: ignore +from ._operations import ThroughputPoolAccountsOperations # type: ignore from ._operations import MongoMIResourcesOperations # type: ignore from ._operations import FleetOperations # type: ignore +from ._operations import FleetAnalyticsOperations # type: ignore from ._operations import FleetspaceOperations # type: ignore from ._operations import FleetspaceAccountOperations # type: ignore @@ -61,14 +75,23 @@ __all__ = [ "Operations", "DatabaseAccountsOperations", + "CopyJobsOperations", + "GraphResourcesOperations", "SqlResourcesOperations", "MongoDBResourcesOperations", "TableResourcesOperations", "CassandraResourcesOperations", "GremlinResourcesOperations", + "DataTransferJobsOperations", + "GarnetClustersOperations", + "NetworkSecurityPerimeterConfigurationsOperations", "NotebookWorkspacesOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", + "SoftDeletedDatabaseAccountsOperations", + "SoftDeletedSqlDatabasesOperations", + "SoftDeletedSqlContainersOperations", + "ChaosFaultOperations", "DatabaseOperations", "CollectionOperations", "CollectionRegionOperations", @@ -96,8 +119,13 @@ "RestorableTablesOperations", "RestorableTableResourcesOperations", "ServiceOperations", + "ThroughputPoolOperations", + "ThroughputPoolsOperations", + "ThroughputPoolAccountOperations", + "ThroughputPoolAccountsOperations", "MongoMIResourcesOperations", "FleetOperations", + "FleetAnalyticsOperations", "FleetspaceOperations", "FleetspaceAccountOperations", ] 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 d2a3bec85433..f22357bc8e50 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 @@ -36,6 +36,7 @@ from .._configuration import CosmosDBManagementClientConfiguration from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] @@ -49,7 +50,7 @@ def build_operations_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +71,7 @@ def build_database_accounts_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +100,7 @@ def build_database_accounts_create_or_update_request( # pylint: disable=name-to _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +131,7 @@ def build_database_accounts_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +160,7 @@ def build_database_accounts_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}" path_format_arguments = { @@ -182,7 +183,7 @@ def build_database_accounts_list_by_resource_group_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -207,7 +208,7 @@ def build_database_accounts_list_request(subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +235,7 @@ def build_database_accounts_failover_priority_change_request( # pylint: disable _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange" path_format_arguments = { @@ -261,7 +262,7 @@ def build_database_accounts_list_keys_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,7 +290,7 @@ def build_database_accounts_list_connection_strings_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -318,7 +319,7 @@ def build_database_accounts_offline_region_request( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion" path_format_arguments = { @@ -346,7 +347,7 @@ def build_database_accounts_online_region_request( # pylint: disable=name-too-l _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion" path_format_arguments = { @@ -373,7 +374,7 @@ def build_database_accounts_get_read_only_keys_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -401,7 +402,7 @@ def build_database_accounts_list_read_only_keys_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -430,7 +431,7 @@ def build_database_accounts_regenerate_key_request( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey" path_format_arguments = { @@ -457,7 +458,7 @@ def build_database_accounts_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -486,7 +487,7 @@ def build_database_accounts_list_usages_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -516,7 +517,7 @@ def build_database_accounts_list_metric_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -543,7 +544,7 @@ def build_database_accounts_check_name_exists_request( # pylint: disable=name-t ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}" path_format_arguments = { @@ -558,13 +559,330 @@ def build_database_accounts_check_name_exists_request( # pylint: disable=name-t return HttpRequest(method="HEAD", url=_url, params=_params, **kwargs) +def build_copy_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_copy_jobs_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_copy_jobs_list_by_database_account_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_copy_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}/pause" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_copy_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}/resume" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_copy_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}/cancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_copy_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/copyJobs/{jobName}/complete" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_graph_resources_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_graph_resources_create_update_graph_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_graph_resources_delete_graph_resource_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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) + + +def build_graph_resources_list_graphs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_sql_resources_get_sql_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -594,7 +912,7 @@ def build_sql_resources_create_update_sql_database_request( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -624,7 +942,7 @@ def build_sql_resources_delete_sql_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}" path_format_arguments = { @@ -648,7 +966,7 @@ def build_sql_resources_list_sql_databases_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -670,13 +988,45 @@ def build_sql_resources_list_sql_databases_request( # pylint: disable=name-too- return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_sql_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/partitionMerge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_get_sql_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -706,7 +1056,7 @@ def build_sql_resources_update_sql_database_throughput_request( # pylint: disab _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -737,7 +1087,7 @@ def build_sql_resources_migrate_sql_database_to_autoscale_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -766,7 +1116,7 @@ def build_sql_resources_migrate_sql_database_to_manual_throughput_request( # py _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -789,6 +1139,70 @@ def build_sql_resources_migrate_sql_database_to_manual_throughput_request( # py return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_sql_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default/redistributeThroughput" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_get_sql_container_throughput_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -800,7 +1214,7 @@ def build_sql_resources_get_sql_container_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -836,7 +1250,7 @@ def build_sql_resources_update_sql_container_throughput_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -873,7 +1287,7 @@ def build_sql_resources_migrate_sql_container_to_autoscale_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -908,7 +1322,7 @@ def build_sql_resources_migrate_sql_container_to_manual_throughput_request( # p _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -932,6 +1346,82 @@ def build_sql_resources_migrate_sql_container_to_manual_throughput_request( # p return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_sql_resources_sql_container_retrieve_throughput_distribution_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/retrieveThroughputDistribution" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_sql_resources_sql_container_redistribute_throughput_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default/redistributeThroughput" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_sql_resources_get_client_encryption_key_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -943,7 +1433,7 @@ def build_sql_resources_get_client_encryption_key_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -979,7 +1469,7 @@ def build_sql_resources_create_update_client_encryption_key_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1011,7 +1501,7 @@ def build_sql_resources_list_client_encryption_keys_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1045,7 +1535,7 @@ def build_sql_resources_get_sql_container_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1081,7 +1571,7 @@ def build_sql_resources_create_update_sql_container_request( # pylint: disable= _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1117,7 +1607,7 @@ def build_sql_resources_delete_sql_container_request( # pylint: disable=name-to ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}" path_format_arguments = { @@ -1142,7 +1632,7 @@ def build_sql_resources_list_sql_containers_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1165,6 +1655,44 @@ def build_sql_resources_list_sql_containers_request( # pylint: disable=name-too return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_sql_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/partitionMerge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_sql_resources_retrieve_continuous_backup_information_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -1177,7 +1705,7 @@ def build_sql_resources_retrieve_continuous_backup_information_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1215,7 +1743,7 @@ def build_sql_resources_get_sql_stored_procedure_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1253,7 +1781,7 @@ def build_sql_resources_create_update_sql_stored_procedure_request( # pylint: d _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1291,7 +1819,7 @@ def build_sql_resources_delete_sql_stored_procedure_request( # pylint: disable= ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}" path_format_arguments = { @@ -1322,7 +1850,7 @@ def build_sql_resources_list_sql_stored_procedures_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1358,7 +1886,7 @@ def build_sql_resources_get_sql_user_defined_function_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1396,7 +1924,7 @@ def build_sql_resources_create_update_sql_user_defined_function_request( # pyli _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1434,7 +1962,7 @@ def build_sql_resources_delete_sql_user_defined_function_request( # pylint: dis ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}" path_format_arguments = { @@ -1465,7 +1993,7 @@ def build_sql_resources_list_sql_user_defined_functions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1501,7 +2029,7 @@ def build_sql_resources_get_sql_trigger_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1539,7 +2067,7 @@ def build_sql_resources_create_update_sql_trigger_request( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1577,7 +2105,7 @@ def build_sql_resources_delete_sql_trigger_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}" path_format_arguments = { @@ -1608,7 +2136,7 @@ def build_sql_resources_list_sql_triggers_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1638,7 +2166,7 @@ def build_sql_resources_get_sql_role_definition_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1668,7 +2196,7 @@ def build_sql_resources_create_update_sql_role_definition_request( # pylint: di _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1698,7 +2226,7 @@ def build_sql_resources_delete_sql_role_definition_request( # pylint: disable=n ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleDefinitions/{roleDefinitionId}" path_format_arguments = { @@ -1722,7 +2250,7 @@ def build_sql_resources_list_sql_role_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1750,7 +2278,7 @@ def build_sql_resources_get_sql_role_assignment_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1780,7 +2308,7 @@ def build_sql_resources_create_update_sql_role_assignment_request( # pylint: di _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1810,7 +2338,7 @@ def build_sql_resources_delete_sql_role_assignment_request( # pylint: disable=n ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlRoleAssignments/{roleAssignmentId}" path_format_arguments = { @@ -1834,7 +2362,7 @@ def build_sql_resources_list_sql_role_assignments_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1862,7 +2390,7 @@ def build_mongo_db_resources_get_mongo_db_database_throughput_request( # pylint _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1892,7 +2420,7 @@ def build_mongo_db_resources_update_mongo_db_database_throughput_request( # pyl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1923,7 +2451,7 @@ def build_mongo_db_resources_migrate_mongo_db_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1952,7 +2480,7 @@ def build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_requ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1975,6 +2503,70 @@ def build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_requ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_mongo_db_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/retrieveThroughputDistribution" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default/redistributeThroughput" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_get_mongo_db_collection_throughput_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -1986,7 +2578,7 @@ def build_mongo_db_resources_get_mongo_db_collection_throughput_request( # pyli _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2022,7 +2614,7 @@ def build_mongo_db_resources_update_mongo_db_collection_throughput_request( # p _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2048,6 +2640,82 @@ def build_mongo_db_resources_update_mongo_db_collection_throughput_request( # p return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_mongo_db_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/retrieveThroughputDistribution" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default/redistributeThroughput" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_migrate_mongo_db_collection_to_autoscale_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -2059,7 +2727,7 @@ def build_mongo_db_resources_migrate_mongo_db_collection_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2094,7 +2762,7 @@ def build_mongo_db_resources_migrate_mongo_db_collection_to_manual_throughput_re _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2124,7 +2792,7 @@ def build_mongo_db_resources_get_mongo_db_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2154,7 +2822,7 @@ def build_mongo_db_resources_create_update_mongo_db_database_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2184,7 +2852,7 @@ def build_mongo_db_resources_delete_mongo_db_database_request( # pylint: disabl ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}" path_format_arguments = { @@ -2208,7 +2876,7 @@ def build_mongo_db_resources_list_mongo_db_databases_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2230,6 +2898,38 @@ def build_mongo_db_resources_list_mongo_db_databases_request( # pylint: disable return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_mongo_db_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/partitionMerge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_get_mongo_db_collection_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -2241,7 +2941,7 @@ def build_mongo_db_resources_get_mongo_db_collection_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2277,7 +2977,7 @@ def build_mongo_db_resources_create_update_mongo_db_collection_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2313,7 +3013,7 @@ def build_mongo_db_resources_delete_mongo_db_collection_request( # pylint: disa ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}" path_format_arguments = { @@ -2338,7 +3038,7 @@ def build_mongo_db_resources_list_mongo_db_collections_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2361,6 +3061,44 @@ def build_mongo_db_resources_list_mongo_db_collections_request( # pylint: disab return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_mongo_db_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/partitionMerge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_resources_retrieve_continuous_backup_information_request( # pylint: disable=name-too-long resource_group_name: str, account_name: str, @@ -2373,7 +3111,7 @@ def build_mongo_db_resources_retrieve_continuous_backup_information_request( # _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2405,7 +3143,7 @@ def build_mongo_db_resources_get_mongo_role_definition_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2435,7 +3173,7 @@ def build_mongo_db_resources_create_update_mongo_role_definition_request( # pyl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2465,7 +3203,7 @@ def build_mongo_db_resources_delete_mongo_role_definition_request( # pylint: di ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbRoleDefinitions/{mongoRoleDefinitionId}" path_format_arguments = { @@ -2489,7 +3227,7 @@ def build_mongo_db_resources_list_mongo_role_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2517,7 +3255,7 @@ def build_mongo_db_resources_get_mongo_user_definition_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2547,7 +3285,7 @@ def build_mongo_db_resources_create_update_mongo_user_definition_request( # pyl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2577,7 +3315,7 @@ def build_mongo_db_resources_delete_mongo_user_definition_request( # pylint: di ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbUserDefinitions/{mongoUserDefinitionId}" path_format_arguments = { @@ -2601,7 +3339,7 @@ def build_mongo_db_resources_list_mongo_user_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2629,7 +3367,7 @@ def build_table_resources_get_table_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2659,7 +3397,7 @@ def build_table_resources_update_table_throughput_request( # pylint: disable=na _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2690,7 +3428,7 @@ def build_table_resources_migrate_table_to_autoscale_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2719,7 +3457,7 @@ def build_table_resources_migrate_table_to_manual_throughput_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2748,7 +3486,7 @@ def build_table_resources_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2778,7 +3516,7 @@ def build_table_resources_create_update_table_request( # pylint: disable=name-t _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2808,7 +3546,7 @@ def build_table_resources_delete_table_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}" path_format_arguments = { @@ -2832,7 +3570,7 @@ def build_table_resources_list_tables_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2861,7 +3599,7 @@ def build_table_resources_retrieve_continuous_backup_information_request( # pyl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2892,7 +3630,7 @@ def build_table_resources_get_table_role_definition_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2922,7 +3660,7 @@ def build_table_resources_create_update_table_role_definition_request( # pylint _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -2952,7 +3690,7 @@ def build_table_resources_delete_table_role_definition_request( # pylint: disab ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleDefinitions/{roleDefinitionId}" path_format_arguments = { @@ -2976,7 +3714,7 @@ def build_table_resources_list_table_role_definitions_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3004,7 +3742,7 @@ def build_table_resources_get_table_role_assignment_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3034,7 +3772,7 @@ def build_table_resources_create_update_table_role_assignment_request( # pylint _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3064,7 +3802,7 @@ def build_table_resources_delete_table_role_assignment_request( # pylint: disab ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tableRoleAssignments/{roleAssignmentId}" path_format_arguments = { @@ -3088,7 +3826,7 @@ def build_table_resources_list_table_role_assignments_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3116,7 +3854,7 @@ def build_cassandra_resources_get_cassandra_keyspace_throughput_request( # pyli _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3146,7 +3884,7 @@ def build_cassandra_resources_update_cassandra_keyspace_throughput_request( # p _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3177,7 +3915,7 @@ def build_cassandra_resources_migrate_cassandra_keyspace_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3206,7 +3944,7 @@ def build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_re _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3240,7 +3978,7 @@ def build_cassandra_resources_get_cassandra_table_throughput_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3276,7 +4014,7 @@ def build_cassandra_resources_update_cassandra_table_throughput_request( # pyli _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3313,7 +4051,7 @@ def build_cassandra_resources_migrate_cassandra_table_to_autoscale_request( # p _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3348,7 +4086,7 @@ def build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_reque _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3372,13 +4110,136 @@ def build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_reque return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_cassandra_resources_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_get_cassandra_keyspace_request( # pylint: disable=name-too-long 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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3408,7 +4269,7 @@ def build_cassandra_resources_create_update_cassandra_keyspace_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3438,7 +4299,7 @@ def build_cassandra_resources_delete_cassandra_keyspace_request( # pylint: disa ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}" path_format_arguments = { @@ -3462,7 +4323,7 @@ def build_cassandra_resources_list_cassandra_keyspaces_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3495,7 +4356,7 @@ def build_cassandra_resources_get_cassandra_table_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3531,7 +4392,7 @@ def build_cassandra_resources_create_update_cassandra_table_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3567,7 +4428,7 @@ def build_cassandra_resources_delete_cassandra_table_request( # pylint: disable ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}" path_format_arguments = { @@ -3592,7 +4453,7 @@ def build_cassandra_resources_list_cassandra_tables_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3615,13 +4476,129 @@ def build_cassandra_resources_list_cassandra_tables_request( # pylint: disable= return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_cassandra_resources_get_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_delete_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: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_list_cassandra_views_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_cassandra_resources_get_cassandra_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3651,7 +4628,7 @@ def build_cassandra_resources_create_update_cassandra_role_definition_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3681,7 +4658,7 @@ def build_cassandra_resources_delete_cassandra_role_definition_request( # pylin ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraRoleDefinitions/{roleDefinitionId}" path_format_arguments = { @@ -3705,7 +4682,7 @@ def build_cassandra_resources_list_cassandra_role_definitions_request( # pylint _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3733,7 +4710,7 @@ def build_cassandra_resources_get_cassandra_role_assignment_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3763,7 +4740,7 @@ def build_cassandra_resources_create_update_cassandra_role_assignment_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3793,7 +4770,7 @@ def build_cassandra_resources_delete_cassandra_role_assignment_request( # pylin ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraRoleAssignments/{roleAssignmentId}" path_format_arguments = { @@ -3817,7 +4794,7 @@ def build_cassandra_resources_list_cassandra_role_assignments_request( # pylint _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3845,7 +4822,7 @@ def build_gremlin_resources_get_gremlin_database_throughput_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3875,7 +4852,7 @@ def build_gremlin_resources_update_gremlin_database_throughput_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3906,7 +4883,7 @@ def build_gremlin_resources_migrate_gremlin_database_to_autoscale_request( # py _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3935,7 +4912,7 @@ def build_gremlin_resources_migrate_gremlin_database_to_manual_throughput_reques _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -3969,7 +4946,7 @@ def build_gremlin_resources_get_gremlin_graph_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4005,7 +4982,7 @@ def build_gremlin_resources_update_gremlin_graph_throughput_request( # pylint: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4042,7 +5019,7 @@ def build_gremlin_resources_migrate_gremlin_graph_to_autoscale_request( # pylin _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4077,7 +5054,7 @@ def build_gremlin_resources_migrate_gremlin_graph_to_manual_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4107,7 +5084,7 @@ def build_gremlin_resources_get_gremlin_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4137,7 +5114,7 @@ def build_gremlin_resources_create_update_gremlin_database_request( # pylint: d _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4167,7 +5144,7 @@ def build_gremlin_resources_delete_gremlin_database_request( # pylint: disable= ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}" path_format_arguments = { @@ -4191,7 +5168,7 @@ def build_gremlin_resources_list_gremlin_databases_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4224,7 +5201,7 @@ def build_gremlin_resources_get_gremlin_graph_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4260,7 +5237,7 @@ def build_gremlin_resources_create_update_gremlin_graph_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4296,7 +5273,7 @@ def build_gremlin_resources_delete_gremlin_graph_request( # pylint: disable=nam ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}" path_format_arguments = { @@ -4321,7 +5298,7 @@ def build_gremlin_resources_list_gremlin_graphs_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4356,7 +5333,7 @@ def build_gremlin_resources_retrieve_continuous_backup_information_request( # p _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4388,7 +5365,7 @@ def build_gremlin_resources_get_gremlin_role_definition_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4418,7 +5395,7 @@ def build_gremlin_resources_create_update_gremlin_role_definition_request( # py _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4448,7 +5425,7 @@ def build_gremlin_resources_delete_gremlin_role_definition_request( # pylint: d ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinRoleDefinitions/{roleDefinitionId}" path_format_arguments = { @@ -4472,7 +5449,7 @@ def build_gremlin_resources_list_gremlin_role_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4500,7 +5477,7 @@ def build_gremlin_resources_get_gremlin_role_assignment_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4530,7 +5507,7 @@ def build_gremlin_resources_create_update_gremlin_role_assignment_request( # py _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4560,7 +5537,7 @@ def build_gremlin_resources_delete_gremlin_role_assignment_request( # pylint: d ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinRoleAssignments/{roleAssignmentId}" path_format_arguments = { @@ -4584,7 +5561,7 @@ def build_gremlin_resources_list_gremlin_role_assignments_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4606,6 +5583,468 @@ def build_gremlin_resources_list_gremlin_role_assignments_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_data_transfer_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_data_transfer_jobs_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_data_transfer_jobs_list_by_database_account_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_data_transfer_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/pause" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_data_transfer_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/resume" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_data_transfer_jobs_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/cancel" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_data_transfer_jobs_complete_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/dataTransferJobs/{jobName}/complete" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_garnet_clusters_get_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/garnetClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_garnet_clusters_create_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/garnetClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_garnet_clusters_update_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/garnetClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_garnet_clusters_delete_request( + resource_group_name: str, cluster_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/garnetClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_garnet_clusters_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/garnetClusters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_garnet_clusters_list_by_subscription_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/garnetClusters" + 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_network_security_perimeter_configurations_get_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", network_security_perimeter_configuration_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_network_security_perimeter_configurations_list_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_network_security_perimeter_configurations_reconcile_request( # pylint: disable=name-too-long + resource_group_name: str, + account_name: str, + network_security_perimeter_configuration_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/networkSecurityPerimeterConfigurations/{networkSecurityPerimeterConfigurationName}/reconcile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "networkSecurityPerimeterConfigurationName": _SERIALIZER.url( + "network_security_perimeter_configuration_name", network_security_perimeter_configuration_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="POST", url=_url, params=_params, **kwargs) + + def build_notebook_workspaces_get_request( resource_group_name: str, account_name: str, @@ -4616,7 +6055,7 @@ def build_notebook_workspaces_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4650,7 +6089,7 @@ def build_notebook_workspaces_create_or_update_request( # pylint: disable=name- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4684,7 +6123,7 @@ def build_notebook_workspaces_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}" path_format_arguments = { @@ -4708,7 +6147,7 @@ def build_notebook_workspaces_list_by_database_account_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4740,7 +6179,7 @@ def build_notebook_workspaces_list_connection_info_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4772,7 +6211,7 @@ def build_notebook_workspaces_regenerate_auth_token_request( # pylint: disable= ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken" path_format_arguments = { @@ -4799,7 +6238,7 @@ def build_notebook_workspaces_start_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start" path_format_arguments = { @@ -4827,7 +6266,7 @@ def build_private_endpoint_connections_get_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4863,7 +6302,7 @@ def build_private_endpoint_connections_create_or_update_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4899,7 +6338,7 @@ def build_private_endpoint_connections_delete_request( # pylint: disable=name-t ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}" path_format_arguments = { @@ -4925,7 +6364,7 @@ def build_private_endpoint_connections_list_by_database_account_request( # pyli _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4953,7 +6392,7 @@ def build_private_link_resources_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -4982,7 +6421,7 @@ def build_private_link_resources_list_by_database_account_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5004,13 +6443,510 @@ def build_private_link_resources_list_by_database_account_request( # pylint: di return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_soft_deleted_database_accounts_get_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_soft_deleted_database_accounts_list_by_location_request( # pylint: disable=name-too-long + location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "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_soft_deleted_database_accounts_list_by_resource_group_and_location_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "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_soft_deleted_database_accounts_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}?softDeleteActionKind=RestoreSoftDeletedResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_soft_deleted_database_accounts_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}?softDeleteActionKind=PermanentDeleteResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_soft_deleted_sql_databases_get_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_soft_deleted_sql_databases_list_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_soft_deleted_sql_databases_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}?softDeleteActionKind=RestoreSoftDeletedResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_soft_deleted_sql_databases_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}?softDeleteActionKind=PermanentDeleteResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_soft_deleted_sql_containers_get_request( # pylint: disable=name-too-long + resource_group_name: str, + location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}/softDeletedSqlContainers/{containerName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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 + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_soft_deleted_sql_containers_list_request( # pylint: disable=name-too-long + resource_group_name: str, location: 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}/softDeletedSqlContainers" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_soft_deleted_sql_containers_restore_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}/softDeletedSqlContainers/{containerName}?softDeleteActionKind=RestoreSoftDeletedResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_soft_deleted_sql_containers_purge_request( # pylint: disable=name-too-long + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + subscription_id: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/locations/{location}/softDeletedDatabaseAccounts/{accountName}/softDeletedSqlDatabases/{databaseName}/softDeletedSqlContainers/{containerName}?softDeleteActionKind=PermanentDeleteResource" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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") + if soft_delete_action_kind is not None: + _params["softDeleteActionKind"] = _SERIALIZER.query("soft_delete_action_kind", soft_delete_action_kind, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_chaos_fault_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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) + + +def build_chaos_fault_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults/{chaosFault}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_name, "str"), + "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_chaos_fault_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/chaosFaults" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "accountName": _SERIALIZER.url("account_name", account_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_database_list_metrics_request( resource_group_name: str, account_name: str, database_rid: str, subscription_id: str, *, filter: 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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5046,7 +6982,7 @@ def build_database_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5077,7 +7013,7 @@ def build_database_list_metric_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5113,7 +7049,7 @@ def build_collection_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5151,7 +7087,7 @@ def build_collection_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5188,7 +7124,7 @@ def build_collection_list_metric_definitions_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5226,7 +7162,7 @@ def build_collection_region_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5258,7 +7194,7 @@ def build_database_account_region_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5295,7 +7231,7 @@ def build_percentile_source_target_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5326,7 +7262,7 @@ def build_percentile_target_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5356,7 +7292,7 @@ def build_percentile_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5393,7 +7329,7 @@ def build_collection_partition_region_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5432,7 +7368,7 @@ def build_collection_partition_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5470,7 +7406,7 @@ def build_collection_partition_list_usages_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5510,7 +7446,7 @@ def build_partition_key_range_id_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5551,7 +7487,7 @@ def build_partition_key_range_id_region_list_metrics_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5582,7 +7518,7 @@ def build_locations_get_request(location: str, subscription_id: str, **kwargs: A _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5607,7 +7543,7 @@ def build_locations_list_request(subscription_id: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5633,7 +7569,7 @@ def build_cassandra_clusters_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5662,7 +7598,7 @@ def build_cassandra_clusters_create_update_request( # pylint: disable=name-too- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5693,7 +7629,7 @@ def build_cassandra_clusters_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5722,7 +7658,7 @@ def build_cassandra_clusters_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" path_format_arguments = { @@ -5745,7 +7681,7 @@ def build_cassandra_clusters_list_by_resource_group_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5772,7 +7708,7 @@ def build_cassandra_clusters_list_by_subscription_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5799,7 +7735,7 @@ def build_cassandra_clusters_invoke_command_request( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -5823,20 +7759,18 @@ def build_cassandra_clusters_invoke_command_request( # pylint: disable=name-too return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_clusters_deallocate_request( # pylint: disable=name-too-long - resource_group_name: str, - cluster_name: str, - subscription_id: str, - *, - x_ms_force_deallocate: Optional[str] = None, - **kwargs: Any +def build_cassandra_clusters_invoke_command_async_request( # pylint: disable=name-too-long + 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", "2026-03-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommandAsync" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5849,20 +7783,24 @@ def build_cassandra_clusters_deallocate_request( # pylint: disable=name-too-lon _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") + 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_cassandra_clusters_start_request( +def build_cassandra_clusters_list_command_request( # pylint: disable=name-too-long 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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -5874,24 +7812,28 @@ def build_cassandra_clusters_start_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_clusters_status_request( - resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +def build_cassandra_clusters_get_command_async_request( # pylint: disable=name-too-long + 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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/commands/{commandId}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "commandId": _SERIALIZER.url("command_id", command_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5905,22 +7847,21 @@ def build_cassandra_clusters_status_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_data_centers_get_request( - resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +def build_cassandra_clusters_list_backups_request( # pylint: disable=name-too-long + 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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "dataCenterName": _SERIALIZER.url("data_center_name", data_center_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5934,23 +7875,22 @@ def build_cassandra_data_centers_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_data_centers_create_update_request( # pylint: disable=name-too-long - resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +def build_cassandra_clusters_get_backup_request( # pylint: disable=name-too-long + 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 {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "dataCenterName": _SERIALIZER.url("data_center_name", data_center_name, "str"), + "backupId": _SERIALIZER.url("backup_id", backup_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5959,30 +7899,29 @@ def build_cassandra_data_centers_create_update_request( # pylint: disable=name- _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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_data_centers_update_request( # pylint: disable=name-too-long - resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +def build_cassandra_clusters_deallocate_request( # pylint: disable=name-too-long + 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 {}) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "dataCenterName": _SERIALIZER.url("data_center_name", data_center_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -5991,26 +7930,24 @@ def build_cassandra_data_centers_update_request( # pylint: disable=name-too-lon _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") + if x_ms_force_deallocate is not None: + _headers["x-ms-force-deallocate"] = _SERIALIZER.header("x_ms_force_deallocate", x_ms_force_deallocate, "str") - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_cassandra_data_centers_delete_request( # pylint: disable=name-too-long - resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +def build_cassandra_clusters_start_request( + resource_group_name: str, cluster_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "dataCenterName": _SERIALIZER.url("data_center_name", data_center_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6018,20 +7955,20 @@ def build_cassandra_data_centers_delete_request( # pylint: disable=name-too-lon # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) -def build_cassandra_data_centers_list_request( # pylint: disable=name-too-long +def build_cassandra_clusters_status_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -6049,21 +7986,165 @@ def build_cassandra_data_centers_list_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_restorable_database_accounts_get_by_location_request( # pylint: disable=name-too-long - location: str, instance_id: str, subscription_id: str, **kwargs: Any +def build_cassandra_data_centers_get_request( + resource_group_name: str, cluster_name: str, data_center_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}" + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "dataCenterName": _SERIALIZER.url("data_center_name", data_center_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_cassandra_data_centers_create_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "dataCenterName": _SERIALIZER.url("data_center_name", data_center_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_cassandra_data_centers_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, data_center_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "dataCenterName": _SERIALIZER.url("data_center_name", data_center_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cassandra_data_centers_delete_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, data_center_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters/{dataCenterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "dataCenterName": _SERIALIZER.url("data_center_name", data_center_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_cassandra_data_centers_list_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/dataCenters" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_restorable_database_accounts_get_by_location_request( # pylint: disable=name-too-long + location: str, instance_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}/restorableDatabaseAccounts/{instanceId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "instanceId": _SERIALIZER.url("instance_id", instance_id, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -6083,7 +8164,7 @@ def build_restorable_database_accounts_list_by_location_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6112,7 +8193,7 @@ def build_restorable_database_accounts_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6138,7 +8219,7 @@ def build_restorable_sql_databases_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6173,7 +8254,7 @@ def build_restorable_sql_containers_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6215,7 +8296,7 @@ def build_restorable_sql_resources_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6249,7 +8330,7 @@ def build_restorable_mongodb_databases_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6284,7 +8365,7 @@ def build_restorable_mongodb_collections_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6326,7 +8407,7 @@ def build_restorable_mongodb_resources_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6360,7 +8441,7 @@ def build_restorable_gremlin_databases_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6395,7 +8476,7 @@ def build_restorable_gremlin_graphs_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6437,7 +8518,7 @@ def build_restorable_gremlin_resources_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6477,7 +8558,7 @@ def build_restorable_tables_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6515,7 +8596,7 @@ def build_restorable_table_resources_list_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6549,7 +8630,7 @@ def build_service_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6579,7 +8660,7 @@ def build_service_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6609,7 +8690,7 @@ def build_service_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" path_format_arguments = { @@ -6633,7 +8714,7 @@ def build_service_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6655,13 +8736,306 @@ def build_service_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_throughput_pool_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_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_throughput_pool_create_or_update_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_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_throughput_pool_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_throughput_pool_delete_request( + resource_group_name: str, throughput_pool_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_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_throughput_pools_list_by_resource_group_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_throughput_pools_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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_throughput_pool_account_get_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_name, "str"), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", throughput_pool_account_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_throughput_pool_account_create_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_name, "str"), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", throughput_pool_account_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_throughput_pool_account_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + throughput_pool_name: str, + throughput_pool_account_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts/{throughputPoolAccountName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_name, "str"), + "throughputPoolAccountName": _SERIALIZER.url( + "throughput_pool_account_name", throughput_pool_account_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_throughput_pool_accounts_list_request( # pylint: disable=name-too-long + 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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/throughputPools/{throughputPoolName}/throughputPoolAccounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "throughputPoolName": _SERIALIZER.url("throughput_pool_name", throughput_pool_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_mongo_mi_resources_get_mongo_mi_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6691,7 +9065,7 @@ def build_mongo_mi_resources_create_update_mongo_mi_role_definition_request( # _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6721,7 +9095,7 @@ def build_mongo_mi_resources_delete_mongo_mi_role_definition_request( # pylint: ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongoMIRoleDefinitions/{roleDefinitionId}" path_format_arguments = { @@ -6745,7 +9119,7 @@ def build_mongo_mi_resources_list_mongo_mi_role_definitions_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6773,7 +9147,7 @@ def build_mongo_mi_resources_get_mongo_mi_role_assignment_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6803,7 +9177,7 @@ def build_mongo_mi_resources_create_update_mongo_mi_role_assignment_request( # _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6833,7 +9207,7 @@ def build_mongo_mi_resources_delete_mongo_mi_role_assignment_request( # pylint: ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongoMIRoleAssignments/{roleAssignmentId}" path_format_arguments = { @@ -6857,7 +9231,7 @@ def build_mongo_mi_resources_list_mongo_mi_role_assignments_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6885,7 +9259,7 @@ def build_fleet_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6914,7 +9288,7 @@ def build_fleet_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6945,7 +9319,7 @@ def build_fleet_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -6974,7 +9348,7 @@ def build_fleet_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}" path_format_arguments = { @@ -6997,7 +9371,7 @@ def build_fleet_list_by_resource_group_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7022,7 +9396,7 @@ def build_fleet_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7042,13 +9416,125 @@ def build_fleet_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_fleet_analytics_get_request( + resource_group_name: str, fleet_name: str, fleet_analytics_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetAnalytics/{fleetAnalyticsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, "str"), + "fleetAnalyticsName": _SERIALIZER.url("fleet_analytics_name", fleet_analytics_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_fleet_analytics_create_request( + resource_group_name: str, fleet_name: str, fleet_analytics_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetAnalytics/{fleetAnalyticsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, "str"), + "fleetAnalyticsName": _SERIALIZER.url("fleet_analytics_name", fleet_analytics_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_fleet_analytics_delete_request( + resource_group_name: str, fleet_name: str, fleet_analytics_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", "2026-04-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetAnalytics/{fleetAnalyticsName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fleetName": _SERIALIZER.url("fleet_name", fleet_name, "str"), + "fleetAnalyticsName": _SERIALIZER.url("fleet_analytics_name", fleet_analytics_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_fleet_analytics_list_request( + resource_group_name: str, fleet_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", "2026-04-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetAnalytics" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "fleetName": _SERIALIZER.url("fleet_name", fleet_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_fleetspace_get_request( resource_group_name: str, fleet_name: str, fleetspace_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7078,7 +9564,7 @@ def build_fleetspace_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7110,7 +9596,7 @@ def build_fleetspace_update_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7140,7 +9626,7 @@ def build_fleetspace_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetspaces/{fleetspaceName}" path_format_arguments = { @@ -7164,7 +9650,7 @@ def build_fleetspace_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7197,7 +9683,7 @@ def build_fleetspace_account_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7233,7 +9719,7 @@ def build_fleetspace_account_create_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7269,7 +9755,7 @@ def build_fleetspace_account_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/fleets/{fleetName}/fleetspaces/{fleetspaceName}/fleetspaceAccounts/{fleetspaceAccountName}" path_format_arguments = { @@ -7294,7 +9780,7 @@ def build_fleetspace_account_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", "2026-03-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-04-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -7317,7 +9803,7 @@ def build_fleetspace_account_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class Operations: +class Operations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -7427,7 +9913,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class DatabaseAccountsOperations: # pylint: disable=too-many-public-methods +class DatabaseAccountsOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -9917,14 +12403,14 @@ def check_name_exists(self, account_name: str, **kwargs: Any) -> bool: return 200 <= response.status_code <= 299 -class SqlResourcesOperations: # pylint: disable=too-many-public-methods +class CopyJobsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`sql_resources` attribute. + :attr:`copy_jobs` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -9935,21 +12421,34 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get_sql_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.SqlDatabaseGetResults: - """Gets the SQL database under an existing Azure Cosmos DB database account with the provided - name. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def get( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Get a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: SqlDatabaseGetResults. The SqlDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -9963,12 +12462,12 @@ def get_sql_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_database_request( + _request = build_copy_jobs_get_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -9995,7 +12494,7 @@ def get_sql_database( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10003,279 +12502,143 @@ def get_sql_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_sql_database_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - create_update_sql_database_parameters: Union[ - _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(create_update_sql_database_parameters, (IOBase, bytes)): - _content = create_update_sql_database_parameters - else: - _content = json.dumps(create_update_sql_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_sql_resources_create_update_sql_database_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - @overload - def begin_create_update_sql_database( + def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: _models.SqlDatabaseCreateUpdateParameters, + job_name: str, + job_create_parameters: _models.CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :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 SqlDatabaseGetResults. The SqlDatabaseGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_database( + def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: _types.SqlDatabaseCreateUpdateParameters, + job_name: str, + job_create_parameters: _types.CopyJobGetResults, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.types.CopyJobGetResults :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 SqlDatabaseGetResults. The SqlDatabaseGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_database( + def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: IO[bytes], + job_name: str, + job_create_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Required. - :type create_update_sql_database_parameters: IO[bytes] + :param job_name: Name of the Copy 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: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_database( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def create( self, resource_group_name: str, account_name: str, - database_name: str, - create_update_sql_database_parameters: Union[ - _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, IO[bytes] - ], + job_name: str, + job_create_parameters: Union[_models.CopyJobGetResults, _types.CopyJobGetResults, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.SqlDatabaseGetResults]: - """Create or update an Azure Cosmos DB SQL database. + ) -> _models.CopyJobGetResults: + """Creates a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param create_update_sql_database_parameters: The parameters to provide for the current SQL - database. Is either a SqlDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_database_parameters: - ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :param job_create_parameters: Is either a CopyJobGetResults type or a IO[bytes] type. Required. + :type job_create_parameters: ~azure.mgmt.cosmosdb.models.CopyJobGetResults or + ~azure.mgmt.cosmosdb.types.CopyJobGetResults or IO[bytes] + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlDatabaseGetResults] = 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_database_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - create_update_sql_database_parameters=create_update_sql_database_parameters, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.SqlDatabaseGetResults].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SqlDatabaseGetResults]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_sql_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10284,17 +12647,27 @@ def _delete_sql_database_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_database_request( + content_type = content_type or "application/json" + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _content = json.dumps(job_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_copy_jobs_create_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -10304,120 +12677,62 @@ def _delete_sql_database_initial( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + if response.status_code not in [200, 201]: + if _stream: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore @distributed_trace - def begin_delete_sql_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes 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 instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_database_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_databases( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_database_account( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.SqlDatabaseGetResults"]: - """Lists the SQL databases under an existing Azure Cosmos DB database account. + ) -> ItemPaged["_models.CopyJobGetResults"]: + """Get a list of Copy 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 SqlDatabaseGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :return: An iterator like instance of CopyJobGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CopyJobGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SqlDatabaseGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CopyJobGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -10430,7 +12745,7 @@ def list_sql_databases( def prepare_request(next_link=None): if not next_link: - _request = build_sql_resources_list_sql_databases_request( + _request = build_copy_jobs_list_by_database_account_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -10473,7 +12788,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlDatabaseGetResults], + List[_models.CopyJobGetResults], deserialized.get("value", []), ) if cls: @@ -10492,7 +12807,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10502,22 +12817,34 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_sql_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account - with the provided name. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def pause( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Pause a Copy 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :param job_name: Name of the Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -10531,12 +12858,387 @@ def get_sql_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_database_throughput_request( + _request = build_copy_jobs_pause_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def resume( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Resumes a Copy 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 Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) + + _request = build_copy_jobs_resume_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def cancel( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Cancels a Copy 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 Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) + + _request = build_copy_jobs_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def complete( + self, resource_group_name: str, account_name: str, job_name: str, **kwargs: Any + ) -> _models.CopyJobGetResults: + """Completes an Online Copy 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 Copy Job. Required. + :type job_name: str + :return: CopyJobGetResults. The CopyJobGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CopyJobGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CopyJobGetResults] = kwargs.pop("cls", None) + + _request = build_copy_jobs_complete_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CopyJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class GraphResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The GraphResourceGetResults is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GraphResourceGetResults] = kwargs.pop("cls", None) + + _request = build_graph_resources_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=self._config.api_version, headers=_headers, @@ -10571,20 +13273,35 @@ def get_sql_database_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.GraphResourceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_sql_database_throughput_initial( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _create_update_graph_initial( self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + graph_name: str, + create_update_graph_parameters: Union[ + _models.GraphResourceCreateUpdateParameters, _types.GraphResourceCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -10604,15 +13321,15 @@ def _update_sql_database_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_graph_parameters, (IOBase, bytes)): + _content = create_update_graph_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_update_sql_database_throughput_request( + _request = build_graph_resources_create_update_graph_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -10661,148 +13378,162 @@ def _update_sql_database_throughput_initial( return deserialized # type: ignore @overload - def begin_update_sql_database_throughput( + def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + graph_name: str, + create_update_graph_parameters: _models.GraphResourceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_sql_database_throughput( + def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + graph_name: str, + create_update_graph_parameters: _types.GraphResourceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_sql_database_throughput( + def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: IO[bytes], + graph_name: str, + create_update_graph_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_sql_database_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_create_update_graph( self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + graph_name: str, + create_update_graph_parameters: Union[ + _models.GraphResourceCreateUpdateParameters, _types.GraphResourceCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL database. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current SQL database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 + ~azure.mgmt.cosmosdb.types.GraphResourceCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns GraphResourceGetResults. The + GraphResourceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_sql_database_throughput_initial( + raw_result = self._create_update_graph_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - update_throughput_parameters=update_throughput_parameters, + graph_name=graph_name, + create_update_graph_parameters=create_update_graph_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -10814,7 +13545,7 @@ def begin_update_sql_database_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.GraphResourceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -10832,18 +13563,31 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return LROPoller[_models.GraphResourceGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, @@ -10858,10 +13602,10 @@ def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_migrate_sql_database_to_autoscale_request( + _request = build_graph_resources_delete_graph_resource_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -10880,14 +13624,14 @@ def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -10898,7 +13642,6 @@ def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -10908,35 +13651,47 @@ def _migrate_sql_database_to_autoscale_initial( # pylint: disable=name-too-long return deserialized # type: ignore @distributed_trace - def begin_migrate_sql_database_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "graph_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param graph_name: Cosmos DB graph resource name. Required. + :type graph_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_database_to_autoscale_initial( + raw_result = self._delete_graph_resource_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + graph_name=graph_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -10945,12 +13700,9 @@ def begin_migrate_sql_database_to_autoscale( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -10965,19 +13717,41 @@ 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 + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_graphs( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_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 GraphResourceGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GraphResourceGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GraphResourceGetResults]] = kwargs.pop("cls", None) - 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -10986,134 +13760,104 @@ def _migrate_sql_database_to_manual_throughput_initial( # pylint: disable=name- } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_graph_resources_list_graphs_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_sql_resources_migrate_sql_database_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GraphResourceGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_next(next_link=None): + _request = prepare_request(next_link) - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace - def begin_migrate_sql_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + return pipeline_response - :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 instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return ItemPaged(get_next, extract_data) - 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_database_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized +class SqlResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`sql_resources` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @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. + def get_sql_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SqlDatabaseGetResults: + """Gets the SQL database 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. @@ -11122,11 +13866,8 @@ def get_sql_container_throughput( :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. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :return: SqlDatabaseGetResults. The SqlDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11140,13 +13881,12 @@ def get_sql_container_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlDatabaseGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_container_throughput_request( + _request = build_sql_resources_get_sql_database_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=self._config.api_version, headers=_headers, @@ -11181,21 +13921,20 @@ def get_sql_container_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_sql_container_throughput_initial( + def _create_update_sql_database_initial( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + create_update_sql_database_parameters: Union[ + _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -11215,16 +13954,15 @@ def _update_sql_container_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_database_parameters, (IOBase, bytes)): + _content = create_update_sql_database_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_update_sql_container_throughput_request( + _request = build_sql_resources_create_update_sql_database_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, content_type=content_type, api_version=self._config.api_version, @@ -11273,18 +14011,17 @@ def _update_sql_container_throughput_initial( return deserialized # type: ignore @overload - def begin_update_sql_container_throughput( + def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + create_update_sql_database_parameters: _models.SqlDatabaseCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11293,34 +14030,31 @@ def begin_update_sql_container_throughput( :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 + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_sql_container_throughput( + def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + create_update_sql_database_parameters: _types.SqlDatabaseCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11329,34 +14063,31 @@ def begin_update_sql_container_throughput( :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.types.ThroughputSettingsUpdateParameters + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_sql_container_throughput( + def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - update_throughput_parameters: IO[bytes], + create_update_sql_database_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.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11365,33 +14096,30 @@ def begin_update_sql_container_throughput( :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] + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Required. + :type create_update_sql_database_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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_sql_container_throughput( + def begin_create_update_sql_database( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + create_update_sql_database_parameters: Union[ + _models.SqlDatabaseCreateUpdateParameters, _types.SqlDatabaseCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB SQL container. + ) -> LROPoller[_models.SqlDatabaseGetResults]: + """Create or update an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11400,34 +14128,30 @@ def begin_update_sql_container_throughput( :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 - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param create_update_sql_database_parameters: The parameters to provide for the current SQL + database. Is either a SqlDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_database_parameters: + ~azure.mgmt.cosmosdb.models.SqlDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlDatabaseGetResults. The SqlDatabaseGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlDatabaseGetResults] = 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_database_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_database_parameters=create_update_sql_database_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -11439,7 +14163,7 @@ def begin_update_sql_container_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlDatabaseGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -11457,18 +14181,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.SqlDatabaseGetResults].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.SqlDatabaseGetResults]( 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 + def _delete_sql_database_initial( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11483,11 +14207,10 @@ def _migrate_sql_container_to_autoscale_initial( # pylint: disable=name-too-lon cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_migrate_sql_container_to_autoscale_request( + _request = build_sql_resources_delete_sql_database_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=self._config.api_version, headers=_headers, @@ -11506,14 +14229,14 @@ 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -11533,10 +14256,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( - 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. + def begin_delete_sql_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11545,26 +14268,22 @@ def begin_migrate_sql_container_to_autoscale( :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_database_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -11573,12 +14292,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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -11593,18 +14309,138 @@ 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 + @distributed_trace + def list_sql_databases( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.SqlDatabaseGetResults"]: + """Lists the SQL databases under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 SqlDatabaseGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SqlDatabaseGetResults]] = 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_sql_resources_list_sql_databases_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SqlDatabaseGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _sql_database_partition_merge_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -11614,18 +14450,27 @@ 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 = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_migrate_sql_container_to_manual_throughput_request( + content_type = content_type or "application/json" + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -11660,6 +14505,7 @@ def _migrate_sql_container_to_manual_throughput_initial( # pylint: disable=name "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -11668,11 +14514,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. @@ -11681,74 +14534,30 @@ 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) - @distributed_trace - def get_client_encryption_key( + @overload + def begin_sql_database_partition_merge( 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. + merge_parameters: _types.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. @@ -11757,11 +14566,163 @@ def get_client_encryption_key( :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. The ClientEncryptionKeyGetResults is compatible with + :param merge_parameters: The parameters for the merge operation. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.types.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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :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 PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_sql_database_partition_merge( + self, + resource_group_name: str, + account_name: str, + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account + with the provided name. + + :param resource_group_name: 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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -11775,13 +14736,12 @@ def get_client_encryption_key( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_client_encryption_key_request( + _request = build_sql_resources_get_sql_database_throughput_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=self._config.api_version, headers=_headers, @@ -11816,23 +14776,20 @@ def get_client_encryption_key( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_client_encryption_key_initial( # pylint: disable=name-too-long + def _update_sql_database_throughput_initial( 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, - _types.ClientEncryptionKeyCreateUpdateParameters, - IO[bytes], + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -11852,16 +14809,15 @@ def _create_update_client_encryption_key_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _content = None - if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): - _content = create_update_client_encryption_key_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_client_encryption_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_client_encryption_key_request( + _request = build_sql_resources_update_sql_database_throughput_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, content_type=content_type, api_version=self._config.api_version, @@ -11910,19 +14866,17 @@ 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_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, 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.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11931,36 +14885,31 @@ 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 update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. 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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: _types.ClientEncryptionKeyCreateUpdateParameters, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, 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.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -11969,36 +14918,31 @@ 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.types.ClientEncryptionKeyCreateUpdateParameters + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_update_sql_database_throughput( self, resource_group_name: str, account_name: str, database_name: str, - client_encryption_key_name: str, - create_update_client_encryption_key_parameters: IO[bytes], + update_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.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -12007,37 +14951,30 @@ 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 update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. 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 ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_client_encryption_key( # pylint: disable=name-too-long + def begin_update_sql_database_throughput( 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, - _types.ClientEncryptionKeyCreateUpdateParameters, - IO[bytes], + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, 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.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB SQL database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -12046,35 +14983,31 @@ 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. + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current SQL database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. Required. - :type create_update_client_encryption_key_parameters: - ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ClientEncryptionKeyGetResults. The - ClientEncryptionKeyGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClientEncryptionKeyGetResults] = 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._create_update_client_encryption_key_initial( + raw_result = self._update_sql_database_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, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12086,7 +15019,7 @@ def begin_create_update_client_encryption_key( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12104,38 +15037,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ClientEncryptionKeyGetResults].from_continuation_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.ClientEncryptionKeyGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @distributed_trace - def list_client_encryption_keys( + 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 - ) -> ItemPaged["_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 ClientEncryptionKeyGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ClientEncryptionKeyGetResults]] = kwargs.pop("cls", None) - + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12144,86 +15058,65 @@ def list_client_encryption_keys( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_sql_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_sql_resources_migrate_sql_database_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ClientEncryptionKeyGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @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 begin_migrate_sql_database_to_autoscale( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -12232,12 +15125,64 @@ 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. The SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_database_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -12249,13 +15194,12 @@ def get_sql_container( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_container_request( + _request = build_sql_resources_migrate_sql_database_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=self._config.api_version, headers=_headers, @@ -12267,44 +15211,130 @@ def get_sql_container( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() 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_sql_container_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - create_update_sql_container_parameters: Union[ - _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] + @distributed_trace + def begin_migrate_sql_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB SQL database from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -12324,16 +15354,15 @@ def _create_update_sql_container_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): - _content = create_update_sql_container_parameters + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(create_update_sql_container_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_container_request( + _request = build_sql_resources_sql_database_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, content_type=content_type, api_version=self._config.api_version, @@ -12361,7 +15390,7 @@ def _create_update_sql_container_initial( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -12382,18 +15411,17 @@ def _create_update_sql_container_initial( return deserialized # type: ignore @overload - def begin_create_update_sql_container( + def begin_sql_database_retrieve_throughput_distribution( # 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, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. @@ -12402,34 +15430,31 @@ 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 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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_container( + def begin_sql_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - create_update_sql_container_parameters: _types.SqlContainerCreateUpdateParameters, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. @@ -12438,34 +15463,31 @@ 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.types.SqlContainerCreateUpdateParameters + :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.types.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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_container( + def begin_sql_database_retrieve_throughput_distribution( # 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], + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. @@ -12474,33 +15496,46 @@ 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 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 SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_container( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_sql_database_retrieve_throughput_distribution( # 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, _types.SqlContainerCreateUpdateParameters, IO[bytes] + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.SqlContainerGetResults]: - """Create or update an Azure Cosmos DB SQL container. + ) -> 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. @@ -12509,33 +15544,31 @@ 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 - ~azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlContainerGetResults. The - SqlContainerGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlContainerGetResults] = 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_sql_container_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, - create_update_sql_container_parameters=create_update_sql_container_parameters, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -12547,7 +15580,7 @@ def begin_create_update_sql_container( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -12565,258 +15598,39 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlContainerGetResults].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.SqlContainerGetResults]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_sql_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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.iter_bytes() if _decompress else response.iter_raw() - - 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. - - :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 None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_containers( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> ItemPaged["_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. - :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 SqlContainerGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlContainerGetResults]] = 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_sql_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlContainerGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _sql_database_redistribute_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -12835,16 +15649,15 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too content_type = content_type or "application/json" _content = None - if isinstance(location, (IOBase, bytes)): - _content = location + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_retrieve_continuous_backup_information_request( + _request = build_sql_resources_sql_database_redistribute_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, content_type=content_type, api_version=self._config.api_version, @@ -12879,6 +15692,9 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -12890,18 +15706,17 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too return deserialized # type: ignore @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: _models.ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -12910,32 +15725,32 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo :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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: _types.ContinuousBackupRestoreLocation, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -12944,32 +15759,32 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo :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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :param redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL database. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: IO[bytes], + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -12978,30 +15793,46 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo :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 location: The name of the continuous backup restore location. Required. - :type location: IO[bytes] + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_sql_database_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a container resource. + ) -> 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. @@ -13010,32 +15841,32 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo :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 location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + raw_result = self._sql_database_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - location=location, + redistribute_throughput_parameters=redistribute_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13047,7 +15878,7 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13065,27 +15896,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.BackupInformation].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.BackupInformation]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @distributed_trace - def get_sql_stored_procedure( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - stored_procedure_name: str, - **kwargs: Any - ) -> _models.SqlStoredProcedureGetResults: - """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + 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. @@ -13096,11 +15922,9 @@ def get_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :return: SqlStoredProcedureGetResults. The SqlStoredProcedureGetResults is compatible with + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -13114,14 +15938,13 @@ def get_sql_stored_procedure( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_stored_procedure_request( + _request = build_sql_resources_get_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13156,22 +15979,21 @@ def get_sql_stored_procedure( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-long + def _update_sql_container_throughput_initial( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: Union[ - _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -13191,17 +16013,16 @@ def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-lon content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_stored_procedure_parameters, (IOBase, bytes)): - _content = create_update_sql_stored_procedure_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_sql_stored_procedure_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_stored_procedure_request( + _request = build_sql_resources_update_sql_container_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13250,19 +16071,18 @@ def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-lon return deserialized # type: ignore @overload - def begin_create_update_sql_stored_procedure( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: _models.SqlStoredProcedureCreateUpdateParameters, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -13273,35 +16093,32 @@ def begin_create_update_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters + :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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_stored_procedure( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: _types.SqlStoredProcedureCreateUpdateParameters, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -13312,35 +16129,32 @@ def begin_create_update_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters + :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.types.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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_stored_procedure( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: IO[bytes], + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -13351,34 +16165,31 @@ def begin_create_update_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Required. - :type create_update_sql_stored_procedure_parameters: IO[bytes] + :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 SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_stored_procedure( + def begin_update_sql_container_throughput( self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - stored_procedure_name: str, - create_update_sql_stored_procedure_parameters: Union[ - _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.SqlStoredProcedureGetResults]: - """Create or update an Azure Cosmos DB SQL storedProcedure. + ) -> 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. @@ -13389,35 +16200,32 @@ def begin_create_update_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current - SQL storedProcedure. Is either a SqlStoredProcedureCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_sql_stored_procedure_parameters: - ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlStoredProcedureGetResults. The - SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlStoredProcedureGetResults] = 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._create_update_sql_stored_procedure_initial( + 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, - stored_procedure_name=stored_procedure_name, - create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -13429,7 +16237,7 @@ def begin_create_update_sql_stored_procedure( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -13447,24 +16255,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlStoredProcedureGetResults].from_continuation_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.SqlStoredProcedureGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_stored_procedure_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - stored_procedure_name: str, - **kwargs: Any + 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, @@ -13479,12 +16281,11 @@ def _delete_sql_stored_procedure_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_stored_procedure_request( + _request = build_sql_resources_migrate_sql_container_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13503,14 +16304,14 @@ def _delete_sql_stored_procedure_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -13530,16 +16331,10 @@ def _delete_sql_stored_procedure_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_sql_stored_procedure( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - stored_procedure_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL storedProcedure. + 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. @@ -13550,26 +16345,24 @@ def begin_delete_sql_stored_procedure( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param stored_procedure_name: Cosmos DB storedProcedure name. Required. - :type stored_procedure_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_sql_stored_procedure_initial( + 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, - stored_procedure_name=stored_procedure_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -13578,9 +16371,12 @@ def begin_delete_sql_stored_procedure( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -13595,150 +16391,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - @distributed_trace - def list_sql_stored_procedures( + 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 - ) -> ItemPaged["_models.SqlStoredProcedureGetResults"]: - """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlStoredProcedureGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlStoredProcedureGetResults]] = 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_sql_resources_list_sql_stored_procedures_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlStoredProcedureGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get_sql_user_defined_function( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - user_defined_function_name: str, - **kwargs: Any - ) -> _models.SqlUserDefinedFunctionGetResults: - """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :return: SqlUserDefinedFunctionGetResults. The SqlUserDefinedFunctionGetResults is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -13750,14 +16415,13 @@ def get_sql_user_defined_function( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_user_defined_function_request( + _request = build_sql_resources_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, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -13769,47 +16433,134 @@ def get_sql_user_defined_function( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) + 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.iter_bytes() if _decompress else response.iter_raw() 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_sql_user_defined_function_initial( # pylint: disable=name-too-long + @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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: Union[ - _models.SqlUserDefinedFunctionCreateUpdateParameters, - _types.SqlUserDefinedFunctionCreateUpdateParameters, - IO[bytes], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -13829,17 +16580,16 @@ def _create_update_sql_user_defined_function_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_user_defined_function_parameters, (IOBase, bytes)): - _content = create_update_sql_user_defined_function_parameters + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(create_update_sql_user_defined_function_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_user_defined_function_request( + _request = build_sql_resources_sql_container_retrieve_throughput_distribution_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -13867,7 +16617,7 @@ def _create_update_sql_user_defined_function_initial( # pylint: disable=name-to pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -13878,7 +16628,6 @@ def _create_update_sql_user_defined_function_initial( # pylint: disable=name-to "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -13888,19 +16637,18 @@ def _create_update_sql_user_defined_function_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: _models.SqlUserDefinedFunctionCreateUpdateParameters, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -13911,36 +16659,32 @@ def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-l :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters + :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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: _types.SqlUserDefinedFunctionCreateUpdateParameters, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -13951,36 +16695,32 @@ def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-l :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters + :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.types.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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: IO[bytes], + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -13991,37 +16731,48 @@ def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-l :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Required. - :type create_update_sql_user_defined_function_parameters: IO[bytes] + :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 SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, - user_defined_function_name: str, - create_update_sql_user_defined_function_parameters: Union[ - _models.SqlUserDefinedFunctionCreateUpdateParameters, - _types.SqlUserDefinedFunctionCreateUpdateParameters, - IO[bytes], + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: - """Create or update an Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -14032,36 +16783,32 @@ def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-l :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :param create_update_sql_user_defined_function_parameters: The parameters to provide for the - current SQL userDefinedFunction. Is either a SqlUserDefinedFunctionCreateUpdateParameters type - or a IO[bytes] type. Required. - :type create_update_sql_user_defined_function_parameters: - ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlUserDefinedFunctionGetResults. The - SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = 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_sql_user_defined_function_initial( + 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, - user_defined_function_name=user_defined_function_name, - create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14073,7 +16820,7 @@ def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-l def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14091,23 +16838,41 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlUserDefinedFunctionGetResults].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.SqlUserDefinedFunctionGetResults]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, - user_defined_function_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -14118,19 +16883,28 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_user_defined_function_request( + content_type = content_type or "application/json" + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_sql_container_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -14147,14 +16921,14 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -14173,17 +16947,145 @@ def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long return deserialized # type: ignore + @overload + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_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 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 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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. + :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 redistribute_throughput_parameters: The parameters to provide for redistributing + throughput for the current SQL container. Required. + :type redistribute_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_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 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 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete_sql_user_defined_function( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_sql_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, container_name: str, - user_defined_function_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + ) -> 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. @@ -14194,26 +17096,34 @@ def begin_delete_sql_user_defined_function( :type database_name: str :param container_name: Cosmos DB container name. Required. :type container_name: str - :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. - :type user_defined_function_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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, 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_user_defined_function_initial( + raw_result = self._sql_container_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, container_name=container_name, - user_defined_function_name=user_defined_function_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -14222,9 +17132,12 @@ def begin_delete_sql_user_defined_function( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -14239,134 +17152,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_sql_user_defined_functions( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> ItemPaged["_models.SqlUserDefinedFunctionGetResults"]: - """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlUserDefinedFunctionGetResults - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlUserDefinedFunctionGetResults]] = 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_sql_resources_list_sql_user_defined_functions_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlUserDefinedFunctionGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace - def get_sql_trigger( + def get_client_encryption_key( self, resource_group_name: str, account_name: str, database_name: str, - container_name: str, - trigger_name: str, + client_encryption_key_name: str, **kwargs: Any - ) -> _models.SqlTriggerGetResults: - """Gets the SQL trigger under an existing Azure Cosmos DB database account. + ) -> _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. @@ -14375,12 +17180,11 @@ def get_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :return: SqlTriggerGetResults. The SqlTriggerGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults + :param client_encryption_key_name: Cosmos DB ClientEncryptionKey name. Required. + :type client_encryption_key_name: str + :return: ClientEncryptionKeyGetResults. The ClientEncryptionKeyGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -14394,14 +17198,13 @@ def get_sql_trigger( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ClientEncryptionKeyGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_trigger_request( + _request = build_sql_resources_get_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -14436,22 +17239,23 @@ def get_sql_trigger( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) + deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_sql_trigger_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, - trigger_name: str, - create_update_sql_trigger_parameters: Union[ - _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, + _types.ClientEncryptionKeyCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> Iterator[bytes]: @@ -14471,17 +17275,16 @@ def _create_update_sql_trigger_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_trigger_parameters, (IOBase, bytes)): - _content = create_update_sql_trigger_parameters + if isinstance(create_update_client_encryption_key_parameters, (IOBase, bytes)): + _content = create_update_client_encryption_key_parameters else: - _content = json.dumps(create_update_sql_trigger_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_client_encryption_key_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_trigger_request( + _request = build_sql_resources_create_update_client_encryption_key_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, + client_encryption_key_name=client_encryption_key_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -14530,19 +17333,19 @@ def _create_update_sql_trigger_initial( return deserialized # type: ignore @overload - def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: _models.SqlTriggerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _models.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -14551,37 +17354,36 @@ def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters + :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 SqlTriggerGetResults. The SqlTriggerGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of LROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: _types.SqlTriggerCreateUpdateParameters, + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: _types.ClientEncryptionKeyCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -14590,37 +17392,36 @@ def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters + :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.types.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 SqlTriggerGetResults. The SqlTriggerGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of LROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_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.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -14629,36 +17430,37 @@ def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Required. - :type create_update_sql_trigger_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 SqlTriggerGetResults. The SqlTriggerGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :return: An instance of LROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_trigger( + 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, - trigger_name: str, - create_update_sql_trigger_parameters: Union[ - _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] + client_encryption_key_name: str, + create_update_client_encryption_key_parameters: Union[ + _models.ClientEncryptionKeyCreateUpdateParameters, + _types.ClientEncryptionKeyCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> LROPoller[_models.SqlTriggerGetResults]: - """Create or update an Azure Cosmos DB SQL trigger. + ) -> 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. @@ -14667,36 +17469,35 @@ def begin_create_update_sql_trigger( :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL - trigger. Is either a SqlTriggerCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_sql_trigger_parameters: - ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlTriggerGetResults. The SqlTriggerGetResults - is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] + :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 + ~azure.mgmt.cosmosdb.types.ClientEncryptionKeyCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ClientEncryptionKeyGetResults. The + ClientEncryptionKeyGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlTriggerGetResults] = 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_trigger_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, - trigger_name=trigger_name, - create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, + client_encryption_key_name=client_encryption_key_name, + create_update_client_encryption_key_parameters=create_update_client_encryption_key_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -14708,7 +17509,7 @@ def begin_create_update_sql_trigger( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) + deserialized = _deserialize(_models.ClientEncryptionKeyGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -14726,25 +17527,38 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlTriggerGetResults].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.SqlTriggerGetResults]( + return LROPoller[_models.ClientEncryptionKeyGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_trigger_initial( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - trigger_name: str, - **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def list_client_encryption_keys( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> ItemPaged["_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 ClientEncryptionKeyGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClientEncryptionKeyGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClientEncryptionKeyGetResults]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -14753,216 +17567,54 @@ def _delete_sql_trigger_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_sql_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_sql_resources_delete_sql_trigger_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete_sql_trigger( - self, - resource_group_name: str, - account_name: str, - database_name: str, - container_name: str, - trigger_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL trigger. - - :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 trigger_name: Cosmos DB trigger name. Required. - :type trigger_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_trigger_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - container_name=container_name, - trigger_name=trigger_name, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_sql_triggers( - self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any - ) -> ItemPaged["_models.SqlTriggerGetResults"]: - """Lists the SQL trigger under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 iterator like instance of SqlTriggerGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlTriggerGetResults]] = 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_sql_resources_list_sql_triggers_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) return _request def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlTriggerGetResults], + List[_models.ClientEncryptionKeyGetResults], deserialized.get("value", []), ) if cls: @@ -14991,21 +17643,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_sql_role_definition( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.SqlRoleDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + def get_sql_container( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> _models.SqlContainerGetResults: + """Gets the SQL container under an existing Azure Cosmos DB database account. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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: SqlRoleDefinitionGetResults. The SqlRoleDefinitionGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults + :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. The SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlContainerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -15019,12 +17672,13 @@ def get_sql_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlContainerGetResults] = kwargs.pop("cls", None) - _request = build_sql_resources_get_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_get_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=self._config.api_version, headers=_headers, @@ -15051,7 +17705,7 @@ def get_sql_role_definition( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -15059,20 +17713,21 @@ def get_sql_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long + def _create_update_sql_container_initial( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: Union[ - _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] + database_name: str, + container_name: str, + create_update_sql_container_parameters: Union[ + _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -15092,15 +17747,16 @@ def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _content = None - if isinstance(create_update_sql_role_definition_parameters, (IOBase, bytes)): - _content = create_update_sql_role_definition_parameters + if isinstance(create_update_sql_container_parameters, (IOBase, bytes)): + _content = create_update_sql_container_parameters else: - _content = json.dumps(create_update_sql_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_container_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_sql_resources_create_update_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_create_update_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, content_type=content_type, api_version=self._config.api_version, @@ -15128,13 +17784,16 @@ def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -15146,148 +17805,160 @@ def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long return deserialized # type: ignore @overload - def begin_create_update_sql_role_definition( + def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, + database_name: str, + container_name: str, + create_update_sql_container_parameters: _models.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters + :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 :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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_role_definition( + def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: _types.SqlRoleDefinitionCreateUpdateParameters, + database_name: str, + container_name: str, + create_update_sql_container_parameters: _types.SqlContainerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters + :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.types.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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_role_definition( + def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: IO[bytes], + database_name: str, + container_name: str, + create_update_sql_container_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_sql_role_definition_parameters: IO[bytes] + :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] :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 SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_role_definition( + def begin_create_update_sql_container( self, - role_definition_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_definition_parameters: Union[ - _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] + database_name: str, + container_name: str, + create_update_sql_container_parameters: Union[ + _models.SqlContainerCreateUpdateParameters, _types.SqlContainerCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Definition. + ) -> LROPoller[_models.SqlContainerGetResults]: + """Create or update an Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 create_update_sql_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a SqlRoleDefinitionCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_sql_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlRoleDefinitionGetResults. The - SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :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 + ~azure.mgmt.cosmosdb.types.SqlContainerCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlContainerGetResults. The + SqlContainerGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlRoleDefinitionGetResults] = 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._create_update_sql_role_definition_initial( - role_definition_id=role_definition_id, + raw_result = self._create_update_sql_container_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_sql_role_definition_parameters=create_update_sql_role_definition_parameters, + database_name=database_name, + container_name=container_name, + create_update_sql_container_parameters=create_update_sql_container_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15299,7 +17970,7 @@ def begin_create_update_sql_role_definition( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlContainerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15317,18 +17988,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlRoleDefinitionGetResults].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.SqlRoleDefinitionGetResults]( + return LROPoller[_models.SqlContainerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_role_definition_initial( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -15343,10 +18014,11 @@ def _delete_sql_role_definition_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_role_definition_request( - role_definition_id=role_definition_id, + _request = build_sql_resources_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=self._config.api_version, headers=_headers, @@ -15365,22 +18037,24 @@ def _delete_sql_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -15390,18 +18064,20 @@ def _delete_sql_role_definition_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_sql_role_definition( - self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 Role Definition. + """Deletes an existing Azure Cosmos DB SQL container. - :param role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str :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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -15414,10 +18090,11 @@ def begin_delete_sql_role_definition( 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_role_definition_initial( - role_definition_id=role_definition_id, + 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, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15452,24 +18129,26 @@ 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 @distributed_trace - def list_sql_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.SqlRoleDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. + def list_sql_containers( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> ItemPaged["_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. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :return: An iterator like instance of SqlRoleDefinitionGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An iterator like instance of SqlContainerGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlContainerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlContainerGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15482,9 +18161,10 @@ def list_sql_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_sql_resources_list_sql_role_definitions_request( + _request = build_sql_resources_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=self._config.api_version, headers=_headers, @@ -15525,7 +18205,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.SqlRoleDefinitionGetResults], + List[_models.SqlContainerGetResults], deserialized.get("value", []), ) if cls: @@ -15544,7 +18224,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -15553,24 +18233,31 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @distributed_trace - def get_sql_role_assignment( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.SqlRoleAssignmentGetResults: - """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. - - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str - :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: SqlRoleAssignmentGetResults. The SqlRoleAssignmentGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.MergeParameters, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -15579,17 +18266,28 @@ def get_sql_role_assignment( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.SqlRoleAssignmentGetResults] = 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_sql_resources_get_sql_role_assignment_request( - role_assignment_id=role_assignment_id, + content_type = content_type or "application/json" + _content = None + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters + else: + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -15599,19 +18297,18 @@ def get_sql_role_assignment( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( _models.CloudError, @@ -15619,238 +18316,187 @@ def get_sql_role_assignment( ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) + 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.iter_bytes() if _decompress else response.iter_raw() 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_sql_role_assignment_initial( # pylint: disable=name-too-long + @overload + def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: Union[ - _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] - ], + database_name: str, + container_name: str, + merge_parameters: _models.MergeParameters, + *, + content_type: str = "application/json", **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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(create_update_sql_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_sql_role_assignment_parameters - else: - _content = json.dumps(create_update_sql_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_sql_resources_create_update_sql_role_assignment_request( - role_assignment_id=role_assignment_id, - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_update_sql_role_assignment( - self, - role_assignment_id: str, - resource_group_name: str, - account_name: str, - create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. - - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters + :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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_role_assignment( + def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: _types.SqlRoleAssignmentCreateUpdateParameters, + database_name: str, + container_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters + :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.types.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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_sql_role_assignment( + def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: IO[bytes], + database_name: str, + container_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_sql_role_assignment_parameters: IO[bytes] + :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 SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_sql_role_assignment( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "container_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_list_sql_container_partition_merge( self, - role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_sql_role_assignment_parameters: Union[ - _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] - ], + database_name: str, + container_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: - """Creates or updates an Azure Cosmos DB SQL Role Assignment. + ) -> LROPoller[_models.PhysicalPartitionStorageInfoCollection]: + """Merges the partitions of a SQL Container. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 create_update_sql_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a SqlRoleAssignmentCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_sql_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns SqlRoleAssignmentGetResults. The - SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] + :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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SqlRoleAssignmentGetResults] = 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_sql_role_assignment_initial( - role_assignment_id=role_assignment_id, + raw_result = self._list_sql_container_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_sql_role_assignment_parameters=create_update_sql_role_assignment_parameters, + database_name=database_name, + container_name=container_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -15862,7 +18508,7 @@ def begin_create_update_sql_role_assignment( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -15880,18 +18526,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.SqlRoleAssignmentGetResults].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.SqlRoleAssignmentGetResults]( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_sql_role_assignment_initial( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any + def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -15901,17 +18553,28 @@ def _delete_sql_role_assignment_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_sql_resources_delete_sql_role_assignment_request( - role_assignment_id=role_assignment_id, + content_type = content_type or "application/json" + _content = None + if isinstance(location, (IOBase, bytes)): + _content = location + else: + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_sql_resources_retrieve_continuous_backup_information_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -15928,7 +18591,7 @@ def _delete_sql_role_assignment_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): @@ -15952,35 +18615,154 @@ def _delete_sql_role_assignment_initial( return deserialized # type: ignore + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: _models.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: _types.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 location: The name of the continuous backup restore location. Required. + :type location: 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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete_sql_role_assignment( - self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB SQL Role Assignment. + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a container resource. - :param role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str :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 instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :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 location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = 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_role_assignment_initial( - role_assignment_id=role_assignment_id, + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, + container_name=container_name, + location=location, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -15989,9 +18771,12 @@ def begin_delete_sql_role_assignment( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -16006,140 +18791,27 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.BackupInformation].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_sql_role_assignments( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.SqlRoleAssignmentGetResults"]: - """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 SqlRoleAssignmentGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.SqlRoleAssignmentGetResults]] = 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_sql_resources_list_sql_role_assignments_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.SqlRoleAssignmentGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class MongoDBResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`mongo_db_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return LROPoller[_models.BackupInformation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace - def get_mongo_db_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database - account with the provided name. + def get_sql_stored_procedure( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any + ) -> _models.SqlStoredProcedureGetResults: + """Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16148,9 +18820,13 @@ def get_mongo_db_database_throughput( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :return: SqlStoredProcedureGetResults. The SqlStoredProcedureGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16164,12 +18840,14 @@ def get_mongo_db_database_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlStoredProcedureGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_database_throughput_request( + _request = build_sql_resources_get_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16204,20 +18882,22 @@ def get_mongo_db_database_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long + def _create_update_sql_stored_procedure_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: Union[ + _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -16237,15 +18917,17 @@ def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_stored_procedure_parameters, (IOBase, bytes)): + _content = create_update_sql_stored_procedure_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_stored_procedure_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_update_mongo_db_database_throughput_request( + _request = build_sql_resources_create_update_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16273,7 +18955,7 @@ def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-lo pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -16294,17 +18976,19 @@ def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-lo return deserialized # type: ignore @overload - def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: _models.SqlStoredProcedureCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16313,31 +18997,37 @@ def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: _types.SqlStoredProcedureCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16346,31 +19036,37 @@ def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16379,30 +19075,36 @@ def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Required. - :type update_throughput_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Required. + :type create_update_sql_stored_procedure_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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_stored_procedure( self, resource_group_name: str, account_name: str, database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + stored_procedure_name: str, + create_update_sql_stored_procedure_parameters: Union[ + _models.SqlStoredProcedureCreateUpdateParameters, _types.SqlStoredProcedureCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of the an Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlStoredProcedureGetResults]: + """Create or update an Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16411,31 +19113,37 @@ def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :param create_update_sql_stored_procedure_parameters: The parameters to provide for the current + SQL storedProcedure. Is either a SqlStoredProcedureCreateUpdateParameters type or a IO[bytes] type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :type create_update_sql_stored_procedure_parameters: + ~azure.mgmt.cosmosdb.models.SqlStoredProcedureCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlStoredProcedureCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlStoredProcedureGetResults. The + SqlStoredProcedureGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlStoredProcedureGetResults] = 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_mongo_db_database_throughput_initial( + raw_result = self._create_update_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - update_throughput_parameters=update_throughput_parameters, + container_name=container_name, + stored_procedure_name=stored_procedure_name, + create_update_sql_stored_procedure_parameters=create_update_sql_stored_procedure_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -16447,7 +19155,7 @@ def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlStoredProcedureGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -16465,18 +19173,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.SqlStoredProcedureGetResults].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.SqlStoredProcedureGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + def _delete_sql_stored_procedure_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -16491,10 +19205,12 @@ def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_migrate_mongo_db_database_to_autoscale_request( + _request = build_sql_resources_delete_sql_stored_procedure_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16513,14 +19229,14 @@ def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -16531,7 +19247,6 @@ def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -16541,10 +19256,16 @@ def _migrate_mongo_db_database_to_autoscale_initial( # pylint: disable=name-too return deserialized # type: ignore @distributed_trace - def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. + def begin_delete_sql_stored_procedure( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + stored_procedure_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL storedProcedure. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16553,23 +19274,28 @@ def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-lo :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param stored_procedure_name: Cosmos DB storedProcedure name. Required. + :type stored_procedure_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_database_to_autoscale_initial( + raw_result = self._delete_sql_stored_procedure_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + stored_procedure_name=stored_procedure_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -16578,12 +19304,9 @@ def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-lo raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -16598,86 +19321,19 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + def list_sql_stored_procedures( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> ItemPaged["_models.SqlStoredProcedureGetResults"]: + """Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16686,67 +19342,112 @@ def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=nam :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: An iterator like instance of SqlStoredProcedureGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlStoredProcedureGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_database_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[List[_models.SqlStoredProcedureGetResults]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + def prepare_request(next_link=None): + if not next_link: + + _request = build_sql_resources_list_sql_stored_procedures_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SqlStoredProcedureGetResults], + deserialized.get("value", []), ) - 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, + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 ) - return LROPoller[_models.ThroughputSettingsGetResults]( - 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) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def get_mongo_db_collection_throughput( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database - account with the provided name. + def get_sql_user_defined_function( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any + ) -> _models.SqlUserDefinedFunctionGetResults: + """Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16755,11 +19456,13 @@ def get_mongo_db_collection_throughput( :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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :return: SqlUserDefinedFunctionGetResults. The SqlUserDefinedFunctionGetResults is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -16773,13 +19476,14 @@ def get_mongo_db_collection_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_collection_throughput_request( + _request = build_sql_resources_get_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -16814,21 +19518,24 @@ def get_mongo_db_collection_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long + def _create_update_sql_user_defined_function_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: Union[ + _models.SqlUserDefinedFunctionCreateUpdateParameters, + _types.SqlUserDefinedFunctionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> Iterator[bytes]: @@ -16848,16 +19555,17 @@ def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too- content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_sql_user_defined_function_parameters, (IOBase, bytes)): + _content = create_update_sql_user_defined_function_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_user_defined_function_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_update_mongo_db_collection_throughput_request( + _request = build_sql_resources_create_update_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -16906,18 +19614,19 @@ def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too- return deserialized # type: ignore @overload - def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: _models.SqlUserDefinedFunctionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16926,34 +19635,38 @@ def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-lon :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: _types.SqlUserDefinedFunctionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16962,34 +19675,38 @@ def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-lon :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: IO[bytes], + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -16998,33 +19715,39 @@ def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-lon :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Required. - :type update_throughput_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Required. + :type create_update_sql_user_defined_function_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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long + def begin_create_update_sql_user_defined_function( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, database_name: str, - collection_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + container_name: str, + user_defined_function_name: str, + create_update_sql_user_defined_function_parameters: Union[ + _models.SqlUserDefinedFunctionCreateUpdateParameters, + _types.SqlUserDefinedFunctionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update the RUs per second of an Azure Cosmos DB MongoDB collection. + ) -> LROPoller[_models.SqlUserDefinedFunctionGetResults]: + """Create or update an Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17033,34 +19756,38 @@ def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-lon :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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :param create_update_sql_user_defined_function_parameters: The parameters to provide for the + current SQL userDefinedFunction. Is either a SqlUserDefinedFunctionCreateUpdateParameters type + or a IO[bytes] type. Required. + :type create_update_sql_user_defined_function_parameters: + ~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlUserDefinedFunctionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlUserDefinedFunctionGetResults. The + SqlUserDefinedFunctionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlUserDefinedFunctionGetResults] = 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_mongo_db_collection_throughput_initial( + raw_result = self._create_update_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, - update_throughput_parameters=update_throughput_parameters, + container_name=container_name, + user_defined_function_name=user_defined_function_name, + create_update_sql_user_defined_function_parameters=create_update_sql_user_defined_function_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17072,7 +19799,7 @@ def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-lon def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.SqlUserDefinedFunctionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17090,18 +19817,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.SqlUserDefinedFunctionGetResults].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.SqlUserDefinedFunctionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + def _delete_sql_user_defined_function_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17116,11 +19849,12 @@ def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-t cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_migrate_mongo_db_collection_to_autoscale_request( + _request = build_sql_resources_delete_sql_user_defined_function_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17139,14 +19873,14 @@ def _migrate_mongo_db_collection_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: 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -17157,7 +19891,6 @@ def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-t "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -17167,10 +19900,16 @@ def _migrate_mongo_db_collection_to_autoscale_initial( # pylint: disable=name-t return deserialized # type: ignore @distributed_trace - def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + def begin_delete_sql_user_defined_function( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + user_defined_function_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB SQL userDefinedFunction. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17179,26 +19918,28 @@ def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too- :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param user_defined_function_name: Cosmos DB userDefinedFunction name. Required. + :type user_defined_function_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_collection_to_autoscale_initial( + raw_result = self._delete_sql_user_defined_function_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - collection_name=collection_name, + container_name=container_name, + user_defined_function_name=user_defined_function_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17207,12 +19948,9 @@ def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too- raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -17227,87 +19965,19 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_mongo_db_resources_migrate_mongo_db_collection_to_manual_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + def list_sql_user_defined_functions( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> ItemPaged["_models.SqlUserDefinedFunctionGetResults"]: + """Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17316,70 +19986,113 @@ def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=n :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :return: An iterator like instance of SqlUserDefinedFunctionGetResults + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlUserDefinedFunctionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_mongo_db_collection_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + cls: ClsType[List[_models.SqlUserDefinedFunctionGetResults]] = kwargs.pop("cls", None) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, } + error_map.update(kwargs.pop("error_map", {}) or {}) - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + def prepare_request(next_link=None): + if not next_link: + + _request = build_sql_resources_list_sql_user_defined_functions_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SqlUserDefinedFunctionGetResults], + deserialized.get("value", []), ) - 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, + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 ) - return LROPoller[_models.ThroughputSettingsGetResults]( - 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) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace - def get_mongo_db_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.MongoDBDatabaseGetResults: - """Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided - name. + def get_sql_trigger( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any + ) -> _models.SqlTriggerGetResults: + """Gets the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17388,9 +20101,12 @@ def get_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :return: MongoDBDatabaseGetResults. The MongoDBDatabaseGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :return: SqlTriggerGetResults. The SqlTriggerGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SqlTriggerGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17404,12 +20120,14 @@ def get_mongo_db_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlTriggerGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_database_request( + _request = build_sql_resources_get_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17444,20 +20162,22 @@ def get_mongo_db_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_mongo_db_database_initial( + def _create_update_sql_trigger_initial( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: Union[ - _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: Union[ + _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -17477,15 +20197,17 @@ def _create_update_mongo_db_database_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_db_database_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_database_parameters + if isinstance(create_update_sql_trigger_parameters, (IOBase, bytes)): + _content = create_update_sql_trigger_parameters else: - _content = json.dumps(create_update_mongo_db_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_trigger_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_db_database_request( + _request = build_sql_resources_create_update_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -17534,17 +20256,19 @@ def _create_update_mongo_db_database_initial( return deserialized # type: ignore @overload - def begin_create_update_mongo_db_database( + def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters, + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: _models.SqlTriggerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17553,31 +20277,37 @@ def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters :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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of LROPoller that returns SqlTriggerGetResults. The SqlTriggerGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_db_database( + def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: _types.MongoDBDatabaseCreateUpdateParameters, + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: _types.SqlTriggerCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17586,31 +20316,37 @@ def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters :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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of LROPoller that returns SqlTriggerGetResults. The SqlTriggerGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_db_database( + def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: IO[bytes], + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17619,30 +20355,36 @@ def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Required. - :type create_update_mongo_db_database_parameters: IO[bytes] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Required. + :type create_update_sql_trigger_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 MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :return: An instance of LROPoller that returns SqlTriggerGetResults. The SqlTriggerGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_mongo_db_database( + def begin_create_update_sql_trigger( self, resource_group_name: str, account_name: str, database_name: str, - create_update_mongo_db_database_parameters: Union[ - _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] + container_name: str, + trigger_name: str, + create_update_sql_trigger_parameters: Union[ + _models.SqlTriggerCreateUpdateParameters, _types.SqlTriggerCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.MongoDBDatabaseGetResults]: - """Create or updates Azure Cosmos DB MongoDB database. + ) -> LROPoller[_models.SqlTriggerGetResults]: + """Create or update an Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17651,31 +20393,36 @@ def begin_create_update_mongo_db_database( :type account_name: str :param database_name: Cosmos DB database name. Required. :type database_name: str - :param create_update_mongo_db_database_parameters: The parameters to provide for the current - MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_mongo_db_database_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns MongoDBDatabaseGetResults. The - MongoDBDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :param container_name: Cosmos DB container name. Required. + :type container_name: str + :param trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str + :param create_update_sql_trigger_parameters: The parameters to provide for the current SQL + trigger. Is either a SqlTriggerCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_sql_trigger_parameters: + ~azure.mgmt.cosmosdb.models.SqlTriggerCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlTriggerCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlTriggerGetResults. The SqlTriggerGetResults + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlTriggerGetResults] = 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_database_initial( + raw_result = self._create_update_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, - create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, + container_name=container_name, + trigger_name=trigger_name, + create_update_sql_trigger_parameters=create_update_sql_trigger_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -17687,7 +20434,7 @@ def begin_create_update_mongo_db_database( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.SqlTriggerGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -17705,18 +20452,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.MongoDBDatabaseGetResults].from_continuation_token( + return LROPoller[_models.SqlTriggerGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.MongoDBDatabaseGetResults]( + return LROPoller[_models.SqlTriggerGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_mongo_db_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + def _delete_sql_trigger_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17731,10 +20484,12 @@ def _delete_mongo_db_database_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_db_database_request( + _request = build_sql_resources_delete_sql_trigger_request( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -17780,10 +20535,16 @@ def _delete_mongo_db_database_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_mongo_db_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + def begin_delete_sql_trigger( + self, + resource_group_name: str, + account_name: str, + database_name: str, + container_name: str, + trigger_name: str, + **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB database. + """Deletes an existing Azure Cosmos DB SQL trigger. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -17792,6 +20553,10 @@ def begin_delete_mongo_db_database( :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 trigger_name: Cosmos DB trigger name. Required. + :type trigger_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -17804,10 +20569,12 @@ def begin_delete_mongo_db_database( 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_database_initial( + raw_result = self._delete_sql_trigger_initial( resource_group_name=resource_group_name, account_name=account_name, database_name=database_name, + container_name=container_name, + trigger_name=trigger_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -17842,24 +20609,28 @@ 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 @distributed_trace - def list_mongo_db_databases( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.MongoDBDatabaseGetResults"]: - """Lists the MongoDB databases under an existing Azure Cosmos DB database account. + def list_sql_triggers( + self, resource_group_name: str, account_name: str, database_name: str, container_name: str, **kwargs: Any + ) -> ItemPaged["_models.SqlTriggerGetResults"]: + """Lists the SQL trigger under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoDBDatabaseGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] + :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 iterator like instance of SqlTriggerGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlTriggerGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlTriggerGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -17872,9 +20643,11 @@ def list_mongo_db_databases( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_db_databases_request( + _request = build_sql_resources_list_sql_triggers_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=self._config.api_version, headers=_headers, @@ -17915,7 +20688,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoDBDatabaseGetResults], + List[_models.SqlTriggerGetResults], deserialized.get("value", []), ) if cls: @@ -17944,23 +20717,21 @@ def get_next(next_link=None): 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. + def get_sql_role_definition( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.SqlRoleDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB SQL Role Definition with the given Id. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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. The MongoDBCollectionGetResults is compatible with + :return: SqlRoleDefinitionGetResults. The SqlRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -17974,13 +20745,12 @@ def get_mongo_db_collection( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_db_collection_request( + _request = build_sql_resources_get_sql_role_definition_request( + role_definition_id=role_definition_id, 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=self._config.api_version, headers=_headers, @@ -18007,7 +20777,7 @@ def get_mongo_db_collection( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -18015,21 +20785,20 @@ def get_mongo_db_collection( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) 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 + def _create_update_sql_role_definition_initial( # pylint: disable=name-too-long self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[ - _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] + create_update_sql_role_definition_parameters: Union[ + _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -18049,16 +20818,15 @@ def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): - _content = create_update_mongo_db_collection_parameters + if isinstance(create_update_sql_role_definition_parameters, (IOBase, bytes)): + _content = create_update_sql_role_definition_parameters else: - _content = json.dumps(create_update_mongo_db_collection_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_db_collection_request( + _request = build_sql_resources_create_update_sql_role_definition_request( + role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -18086,16 +20854,13 @@ def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -18107,161 +20872,148 @@ 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_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, + create_update_sql_role_definition_parameters: _models.SqlRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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 + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters :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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :return: An instance of LROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_db_collection( + def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: _types.MongoDBCollectionCreateUpdateParameters, + create_update_sql_role_definition_parameters: _types.SqlRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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.types.MongoDBCollectionCreateUpdateParameters + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters :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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :return: An instance of LROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_db_collection( + def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: IO[bytes], + create_update_sql_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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] + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_sql_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 MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :return: An instance of LROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_mongo_db_collection( + def begin_create_update_sql_role_definition( self, + role_definition_id: str, resource_group_name: str, account_name: str, - database_name: str, - collection_name: str, - create_update_mongo_db_collection_parameters: Union[ - _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] + create_update_sql_role_definition_parameters: Union[ + _models.SqlRoleDefinitionCreateUpdateParameters, _types.SqlRoleDefinitionCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.MongoDBCollectionGetResults]: - """Create or update an Azure Cosmos DB MongoDB Collection. + ) -> LROPoller[_models.SqlRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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. Is either a MongoDBCollectionCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_mongo_db_collection_parameters: - ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoDBCollectionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns MongoDBCollectionGetResults. The - MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :param create_update_sql_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a SqlRoleDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_sql_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlRoleDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlRoleDefinitionGetResults. The + SqlRoleDefinitionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleDefinitionGetResults] = 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._create_update_sql_role_definition_initial( + role_definition_id=role_definition_id, 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, + create_update_sql_role_definition_parameters=create_update_sql_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -18273,7 +21025,7 @@ def begin_create_update_mongo_db_collection( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -18291,18 +21043,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.MongoDBCollectionGetResults].from_continuation_token( + return LROPoller[_models.SqlRoleDefinitionGetResults].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.SqlRoleDefinitionGetResults]( 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 _delete_sql_role_definition_initial( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18317,11 +21069,10 @@ def _delete_mongo_db_collection_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_db_collection_request( + _request = build_sql_resources_delete_sql_role_definition_request( + role_definition_id=role_definition_id, 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=self._config.api_version, headers=_headers, @@ -18340,24 +21091,22 @@ 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, 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -18367,20 +21116,18 @@ def _delete_mongo_db_collection_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_mongo_db_collection( - self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + def begin_delete_sql_role_definition( + self, role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB MongoDB Collection. + """Deletes an existing Azure Cosmos DB SQL Role Definition. + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str :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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -18393,11 +21140,10 @@ def begin_delete_mongo_db_collection( 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._delete_sql_role_definition_initial( + role_definition_id=role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - collection_name=collection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -18432,26 +21178,24 @@ 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 @distributed_trace - def list_mongo_db_collections( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> ItemPaged["_models.MongoDBCollectionGetResults"]: - """Lists the MongoDB collection under an existing Azure Cosmos DB database account. + def list_sql_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.SqlRoleDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB SQL Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoDBCollectionGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] + :return: An iterator like instance of SqlRoleDefinitionGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlRoleDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -18464,10 +21208,9 @@ def list_mongo_db_collections( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_db_collections_request( + _request = build_sql_resources_list_sql_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -18508,7 +21251,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoDBCollectionGetResults], + List[_models.SqlRoleDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -18527,7 +21270,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -18536,288 +21279,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, 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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(location, (IOBase, bytes)): - _content = location - else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_mongo_db_resources_retrieve_continuous_backup_information_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, - content_type=content_type, - api_version=self._config.api_version, - content=_content, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: _models.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: _types.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Required. - :type location: 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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - collection_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a Mongodb collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - collection_name=collection_name, - location=location, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.BackupInformation].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.BackupInformation]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - @distributed_trace - def get_mongo_role_definition( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.MongoRoleDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given - Id. + def get_sql_role_assignment( + self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.SqlRoleAssignmentGetResults: + """Retrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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: MongoRoleDefinitionGetResults. The MongoRoleDefinitionGetResults is compatible with + :return: SqlRoleAssignmentGetResults. The SqlRoleAssignmentGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -18831,10 +21308,10 @@ def get_mongo_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_get_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -18871,22 +21348,20 @@ def get_mongo_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long + def _create_update_sql_role_assignment_initial( # pylint: disable=name-too-long self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: Union[ - _models.MongoRoleDefinitionCreateUpdateParameters, - _types.MongoRoleDefinitionCreateUpdateParameters, - IO[bytes], + create_update_sql_role_assignment_parameters: Union[ + _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -18906,13 +21381,13 @@ def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_role_definition_parameters, (IOBase, bytes)): - _content = create_update_mongo_role_definition_parameters + if isinstance(create_update_sql_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_sql_role_assignment_parameters else: - _content = json.dumps(create_update_mongo_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_sql_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_create_update_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -18960,154 +21435,148 @@ def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-lo return deserialized # type: ignore @overload - def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters, + create_update_sql_role_assignment_parameters: _models.SqlRoleAssignmentCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters :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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: _types.MongoRoleDefinitionCreateUpdateParameters, + create_update_sql_role_assignment_parameters: _types.SqlRoleAssignmentCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters :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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: IO[bytes], + create_update_sql_role_assignment_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_mongo_role_definition_parameters: IO[bytes] + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_sql_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 MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An instance of LROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long + def begin_create_update_sql_role_assignment( self, - mongo_role_definition_id: str, + role_assignment_id: str, resource_group_name: str, account_name: str, - create_update_mongo_role_definition_parameters: Union[ - _models.MongoRoleDefinitionCreateUpdateParameters, - _types.MongoRoleDefinitionCreateUpdateParameters, - IO[bytes], + create_update_sql_role_assignment_parameters: Union[ + _models.SqlRoleAssignmentCreateUpdateParameters, _types.SqlRoleAssignmentCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo Role Definition. + ) -> LROPoller[_models.SqlRoleAssignmentGetResults]: + """Creates or updates an Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :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 create_update_mongo_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a + :param create_update_sql_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a SqlRoleAssignmentCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_mongo_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns MongoRoleDefinitionGetResults. The - MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :type create_update_sql_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.SqlRoleAssignmentCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.SqlRoleAssignmentCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns SqlRoleAssignmentGetResults. The + SqlRoleAssignmentGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.SqlRoleAssignmentGetResults] = 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_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = self._create_update_sql_role_assignment_initial( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, + create_update_sql_role_assignment_parameters=create_update_sql_role_assignment_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19119,7 +21588,7 @@ def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.SqlRoleAssignmentGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19137,18 +21606,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.MongoRoleDefinitionGetResults].from_continuation_token( + return LROPoller[_models.SqlRoleAssignmentGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.MongoRoleDefinitionGetResults]( + return LROPoller[_models.SqlRoleAssignmentGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_mongo_role_definition_initial( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -19163,8 +21632,8 @@ def _delete_mongo_role_definition_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_role_definition_request( - mongo_role_definition_id=mongo_role_definition_id, + _request = build_sql_resources_delete_sql_role_assignment_request( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -19210,13 +21679,13 @@ def _delete_mongo_role_definition_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_mongo_role_definition( - self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + def begin_delete_sql_role_assignment( + self, role_assignment_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo Role Definition. + """Deletes an existing Azure Cosmos DB SQL Role Assignment. - :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. - :type mongo_role_definition_id: str + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str @@ -19234,8 +21703,8 @@ def begin_delete_mongo_role_definition( 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_role_definition_initial( - mongo_role_definition_id=mongo_role_definition_id, + raw_result = self._delete_sql_role_assignment_initial( + role_assignment_id=role_assignment_id, resource_group_name=resource_group_name, account_name=account_name, cls=lambda x, y, z: x, @@ -19272,24 +21741,24 @@ 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 @distributed_trace - def list_mongo_role_definitions( + def list_sql_role_assignments( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.MongoRoleDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. + ) -> ItemPaged["_models.SqlRoleAssignmentGetResults"]: + """Retrieves the list of all Azure Cosmos DB SQL Role Assignments. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 MongoRoleDefinitionGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] + :return: An iterator like instance of SqlRoleAssignmentGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.SqlRoleAssignmentGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.SqlRoleAssignmentGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -19302,7 +21771,7 @@ def list_mongo_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_mongo_db_resources_list_mongo_role_definitions_request( + _request = build_sql_resources_list_sql_role_assignments_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -19345,7 +21814,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MongoRoleDefinitionGetResults], + List[_models.SqlRoleAssignmentGetResults], deserialized.get("value", []), ) if cls: @@ -19373,23 +21842,41 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - @distributed_trace - def get_mongo_user_definition( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> _models.MongoUserDefinitionGetResults: - """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given - Id. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str +class MongoDBResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`mongo_db_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_mongo_db_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database + account with the provided name. + :param resource_group_name: 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: MongoUserDefinitionGetResults. The MongoUserDefinitionGetResults is compatible with + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -19403,12 +21890,12 @@ def get_mongo_user_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_get_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_get_mongo_db_database_throughput_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -19435,7 +21922,7 @@ def get_mongo_user_definition( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -19443,22 +21930,20 @@ def get_mongo_user_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long + def _update_mongo_db_database_throughput_initial( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: Union[ - _models.MongoUserDefinitionCreateUpdateParameters, - _types.MongoUserDefinitionCreateUpdateParameters, - IO[bytes], + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -19478,15 +21963,15 @@ def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _content = None - if isinstance(create_update_mongo_user_definition_parameters, (IOBase, bytes)): - _content = create_update_mongo_user_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_mongo_user_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_mongo_db_resources_create_update_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_update_mongo_db_database_throughput_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -19521,6 +22006,9 @@ def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-lo 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -19532,154 +22020,148 @@ def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-lo return deserialized # type: ignore @overload - def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters, + database_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. 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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: _types.MongoUserDefinitionCreateUpdateParameters, + database_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: IO[bytes], + database_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Required. - :type create_update_mongo_user_definition_parameters: IO[bytes] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. 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 MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long + def begin_update_mongo_db_database_throughput( # pylint: disable=name-too-long self, - mongo_user_definition_id: str, resource_group_name: str, account_name: str, - create_update_mongo_user_definition_parameters: Union[ - _models.MongoUserDefinitionCreateUpdateParameters, - _types.MongoUserDefinitionCreateUpdateParameters, - IO[bytes], + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.MongoUserDefinitionGetResults]: - """Creates or updates an Azure Cosmos DB Mongo User Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of the an Azure Cosmos DB MongoDB database. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 create_update_mongo_user_definition_parameters: The properties required to create or - update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a - IO[bytes] type. Required. - :type create_update_mongo_user_definition_parameters: - ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns MongoUserDefinitionGetResults. The - MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MongoUserDefinitionGetResults] = 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._create_update_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, + raw_result = self._update_mongo_db_database_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -19691,7 +22173,7 @@ def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -19709,18 +22191,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.MongoUserDefinitionGetResults].from_continuation_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.MongoUserDefinitionGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_mongo_user_definition_initial( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -19735,10 +22217,10 @@ def _delete_mongo_user_definition_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_mongo_db_resources_delete_mongo_user_definition_request( - mongo_user_definition_id=mongo_user_definition_id, + _request = build_mongo_db_resources_migrate_mongo_db_database_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -19757,7 +22239,7 @@ def _delete_mongo_user_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): @@ -19771,6 +22253,9 @@ def _delete_mongo_user_definition_initial( 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -19782,34 +22267,35 @@ def _delete_mongo_user_definition_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_mongo_user_definition( - self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Mongo User Definition. + def begin_migrate_mongo_db_database_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB database from manual throughput to autoscale. - :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. - :type mongo_user_definition_id: str :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 instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_mongo_user_definition_initial( - mongo_user_definition_id=mongo_user_definition_id, + raw_result = self._migrate_mongo_db_database_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, + database_name=database_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -19818,9 +22304,12 @@ def begin_delete_mongo_user_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -19835,153 +22324,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_mongo_user_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.MongoUserDefinitionGetResults"]: - """Retrieves the list of all Azure Cosmos DB Mongo User Definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 MongoUserDefinitionGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.MongoUserDefinitionGetResults]] = 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_mongo_db_resources_list_mongo_user_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MongoUserDefinitionGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class TableResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`table_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_table_throughput( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with - the provided name. + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -19993,12 +22348,12 @@ def get_table_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_throughput_request( + _request = build_mongo_db_resources_migrate_mongo_db_database_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20010,43 +22365,130 @@ def get_table_throughput( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - def _update_table_throughput_initial( + @distributed_trace + def begin_migrate_mongo_db_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB database from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _mongo_db_database_retrieve_throughput_distribution_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -20066,15 +22508,15 @@ def _update_table_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_update_table_throughput_request( + _request = build_mongo_db_resources_mongo_db_database_retrieve_throughput_distribution_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -20102,7 +22544,7 @@ def _update_table_throughput_initial( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -20123,148 +22565,164 @@ def _update_table_throughput_initial( return deserialized # type: ignore @overload - def begin_update_table_throughput( + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + retrieve_throughput_parameters: _models.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_table_throughput( + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + retrieve_throughput_parameters: _types.RetrieveThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_table_throughput( + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + retrieve_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_table_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_mongo_db_database_retrieve_throughput_distribution( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + retrieve_throughput_parameters: Union[ + _models.RetrieveThroughputParameters, _types.RetrieveThroughputParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The parameters to provide for the RUs per second of the - current Table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. - Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = 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._update_table_throughput_initial( + raw_result = self._mongo_db_database_retrieve_throughput_distribution_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + retrieve_throughput_parameters=retrieve_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20276,7 +22734,7 @@ def begin_update_table_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20294,18 +22752,40 @@ def get_long_running_output(pipeline_response): 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 ) - def _migrate_table_to_autoscale_initial( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.RedistributeThroughputParameters, IO[bytes] + ], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20315,17 +22795,27 @@ def _migrate_table_to_autoscale_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_migrate_table_to_autoscale_request( + content_type = content_type or "application/json" + _content = None + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters + else: + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_mongo_db_database_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -20369,169 +22859,169 @@ def _migrate_table_to_autoscale_initial( return deserialized # type: ignore - @distributed_trace - def begin_migrate_table_to_autoscale( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. + @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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_table_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_table_resources_migrate_table_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @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: _types.RedistributeThroughputParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + :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.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, response_headers) # 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: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PhysicalPartitionThroughputInfoResult]: + """Redistribute throughput for an Azure Cosmos DB MongoDB database. - return deserialized # type: ignore + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_migrate_table_to_manual_throughput( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - 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, 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_table_to_manual_throughput_initial( + raw_result = self._mongo_db_database_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -20542,7 +23032,7 @@ def begin_migrate_table_to_manual_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20560,31 +23050,35 @@ def get_long_running_output(pipeline_response): 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 get_table( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> _models.TableGetResults: - """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + def get_mongo_db_collection_throughput( + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :return: TableGetResults. The TableGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults + :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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -20598,12 +23092,13 @@ def get_table( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_request( + _request = build_mongo_db_resources_get_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -20638,20 +23133,21 @@ def get_table( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.TableGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_table_initial( + def _update_mongo_db_collection_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: Union[ - _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -20671,15 +23167,16 @@ def _create_update_table_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_table_parameters, (IOBase, bytes)): - _content = create_update_table_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_create_update_table_request( + _request = build_mongo_db_resources_update_mongo_db_collection_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -20728,144 +23225,161 @@ def _create_update_table_initial( return deserialized # type: ignore @overload - def begin_create_update_table( + def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: _models.TableCreateUpdateParameters, + database_name: str, + collection_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. 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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table( + def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: _types.TableCreateUpdateParameters, + database_name: str, + collection_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table( + def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: IO[bytes], + database_name: str, + collection_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. - Required. - :type create_update_table_parameters: IO[bytes] + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. 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 TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_table( + def begin_update_mongo_db_collection_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - create_update_table_parameters: Union[ - _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.TableGetResults]: - """Create or update an Azure Cosmos DB Table. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update the RUs per second of an Azure Cosmos DB MongoDB collection. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_table_parameters: The parameters to provide for the current Table. Is - either a TableCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters - or ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns TableGetResults. The TableGetResults is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current MongoDB collection. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableGetResults] = 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._create_update_table_initial( + raw_result = self._update_mongo_db_collection_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - create_update_table_parameters=create_update_table_parameters, + database_name=database_name, + collection_name=collection_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -20877,7 +23391,7 @@ def begin_create_update_table( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -20895,18 +23409,42 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.TableGetResults].from_continuation_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.TableGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_table_initial( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.RetrieveThroughputParameters, IO[bytes] + ], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -20916,17 +23454,28 @@ def _delete_table_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_delete_table_request( - resource_group_name=resource_group_name, - account_name=account_name, - table_name=table_name, + content_type = content_type or "application/json" + _content = None + if isinstance(retrieve_throughput_parameters, (IOBase, bytes)): + _content = retrieve_throughput_parameters + else: + _content = json.dumps(retrieve_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_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, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -20943,14 +23492,14 @@ def _delete_table_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -20961,6 +23510,7 @@ def _delete_table_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -20969,35 +23519,180 @@ def _delete_table_initial( 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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :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: _types.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.types.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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :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 PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_delete_table( - self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Table. + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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, _types.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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :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 ~azure.mgmt.cosmosdb.types.RetrieveThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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, 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_initial( + raw_result = self._mongo_db_container_retrieve_throughput_distribution_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, + retrieve_throughput_parameters=retrieve_throughput_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -21006,9 +23701,12 @@ def begin_delete_table( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -21023,122 +23721,41 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_tables( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.TableGetResults"]: - """Lists the Tables under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 TableGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TableGetResults]] = 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_table_resources_list_tables_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TableGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _mongo_db_container_redistribute_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -21157,15 +23774,16 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too content_type = content_type or "application/json" _content = None - if isinstance(location, (IOBase, bytes)): - _content = location + if isinstance(redistribute_throughput_parameters, (IOBase, bytes)): + _content = redistribute_throughput_parameters else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(redistribute_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_retrieve_continuous_backup_information_request( + _request = build_mongo_db_resources_mongo_db_container_redistribute_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -21200,6 +23818,9 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -21211,139 +23832,181 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too return deserialized # type: ignore @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: _models.ContinuousBackupRestoreLocation, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _models.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: _types.ContinuousBackupRestoreLocation, + database_name: str, + collection_name: str, + redistribute_throughput_parameters: _types.RedistributeThroughputParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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.types.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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: IO[bytes], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: IO[bytes] + :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_mongo_db_container_redistribute_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - table_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + database_name: str, + collection_name: str, + redistribute_throughput_parameters: Union[ + _models.RedistributeThroughputParameters, _types.RedistributeThroughputParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a table. + ) -> 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :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 + ~azure.mgmt.cosmosdb.types.RedistributeThroughputParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionThroughputInfoResult. The + PhysicalPartitionThroughputInfoResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionThroughputInfoResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + raw_result = self._mongo_db_container_redistribute_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - table_name=table_name, - location=location, + database_name=database_name, + collection_name=collection_name, + redistribute_throughput_parameters=redistribute_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21355,7 +24018,7 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionThroughputInfoResult, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21373,35 +24036,19 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.BackupInformation].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.BackupInformation]( + return LROPoller[_models.PhysicalPartitionThroughputInfoResult]( 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. The TableRoleDefinitionResource is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -21413,12 +24060,13 @@ def get_table_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_get_table_role_definition_request( + _request = build_mongo_db_resources_migrate_mongo_db_collection_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21430,45 +24078,113 @@ def get_table_role_definition( _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() 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_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, _types.TableRoleDefinitionResource, IO[bytes] - ], - **kwargs: Any + @distributed_trace + def begin_migrate_mongo_db_collection_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB collection from manual throughput to autoscale. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_collection_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, @@ -21478,27 +24194,18 @@ def _create_update_table_role_definition_initial( # pylint: disable=name-too-lo } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): - _content = create_update_table_role_definition_parameters - else: - _content = json.dumps(create_update_table_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_table_resources_create_update_table_role_definition_request( + _request = build_mongo_db_resources_migrate_mongo_db_collection_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -21522,7 +24229,7 @@ def _create_update_table_role_definition_initial( # pylint: disable=name-too-lo pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -21533,6 +24240,7 @@ def _create_update_table_role_definition_initial( # pylint: disable=name-too-lo "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -21541,149 +24249,379 @@ def _create_update_table_role_definition_initial( # pylint: disable=name-too-lo 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, - *, + @distributed_trace + def begin_migrate_mongo_db_collection_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, collection_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB MongoDB collection from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_mongo_db_collection_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + collection_name=collection_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def get_mongo_db_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.MongoDBDatabaseGetResults: + """Gets the MongoDB databases 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :return: MongoDBDatabaseGetResults. The MongoDBDatabaseGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MongoDBDatabaseGetResults] = kwargs.pop("cls", None) + + _request = build_mongo_db_resources_get_mongo_db_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_mongo_db_database_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_mongo_db_database_parameters: Union[ + _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_mongo_db_database_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_database_parameters + else: + _content = json.dumps(create_update_mongo_db_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_create_update_mongo_db_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update_mongo_db_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_mongo_db_database_parameters: _models.MongoDBDatabaseCreateUpdateParameters, + *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> LROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters :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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :return: An instance of LROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table_role_definition( # pylint: disable=name-too-long + def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: _types.TableRoleDefinitionResource, + database_name: str, + create_update_mongo_db_database_parameters: _types.MongoDBDatabaseCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> LROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.types.TableRoleDefinitionResource + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters :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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :return: An instance of LROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table_role_definition( # pylint: disable=name-too-long + def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: IO[bytes], + database_name: str, + create_update_mongo_db_database_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> LROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Required. + :type create_update_mongo_db_database_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 TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :return: An instance of LROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_table_role_definition( # pylint: disable=name-too-long + def begin_create_update_mongo_db_database( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_table_role_definition_parameters: Union[ - _models.TableRoleDefinitionResource, _types.TableRoleDefinitionResource, IO[bytes] + database_name: str, + create_update_mongo_db_database_parameters: Union[ + _models.MongoDBDatabaseCreateUpdateParameters, _types.MongoDBDatabaseCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.TableRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Table Role Definition. + ) -> LROPoller[_models.MongoDBDatabaseGetResults]: + """Create or updates Azure Cosmos DB MongoDB database. :param resource_group_name: The name of the resource group. The name is case insensitive. 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. + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_mongo_db_database_parameters: The parameters to provide for the current + MongoDB database. Is either a MongoDBDatabaseCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_table_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.TableRoleDefinitionResource or IO[bytes] - :return: An instance of LROPoller that returns TableRoleDefinitionResource. The - TableRoleDefinitionResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :type create_update_mongo_db_database_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoDBDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns MongoDBDatabaseGetResults. The + MongoDBDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoDBDatabaseGetResults] = 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( + raw_result = self._create_update_mongo_db_database_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, + database_name=database_name, + create_update_mongo_db_database_parameters=create_update_mongo_db_database_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -21695,7 +24633,7 @@ def begin_create_update_table_role_definition( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.MongoDBDatabaseGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -21713,18 +24651,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.TableRoleDefinitionResource].from_continuation_token( + return LROPoller[_models.MongoDBDatabaseGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.TableRoleDefinitionResource]( + return LROPoller[_models.MongoDBDatabaseGetResults]( 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 + def _delete_mongo_db_database_initial( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21739,10 +24677,10 @@ def _delete_table_role_definition_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_table_resources_delete_table_role_definition_request( + _request = build_mongo_db_resources_delete_mongo_db_database_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -21761,7 +24699,7 @@ def _delete_table_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -21788,18 +24726,18 @@ def _delete_table_role_definition_initial( 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 + def begin_delete_mongo_db_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Table Role Definition. + """Deletes an existing 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str + :param database_name: Cosmos DB database name. Required. + :type database_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -21812,10 +24750,10 @@ def begin_delete_table_role_definition( 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( + raw_result = self._delete_mongo_db_database_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + database_name=database_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -21850,24 +24788,24 @@ 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 @distributed_trace - def list_table_role_definitions( + def list_mongo_db_databases( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.TableRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Table Role Definitions. + ) -> ItemPaged["_models.MongoDBDatabaseGetResults"]: + """Lists the MongoDB databases under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 TableRoleDefinitionResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :return: An iterator like instance of MongoDBDatabaseGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.TableRoleDefinitionResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoDBDatabaseGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -21880,7 +24818,7 @@ def list_table_role_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_table_resources_list_table_role_definitions_request( + _request = build_mongo_db_resources_list_mongo_db_databases_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -21923,7 +24861,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.TableRoleDefinitionResource], + List[_models.MongoDBDatabaseGetResults], deserialized.get("value", []), ) if cls: @@ -21951,91 +24889,27 @@ def get_next(next_link=None): 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. The TableRoleAssignmentResource is compatible with - MutableMapping - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) - - _request = build_table_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) - - 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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _mongo_db_database_partition_merge_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, _types.TableRoleAssignmentResource, IO[bytes] - ], + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -22054,15 +24928,15 @@ def _create_update_table_role_assignment_initial( # pylint: disable=name-too-lo content_type = content_type or "application/json" _content = None - if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_table_role_assignment_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _content = json.dumps(create_update_table_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_table_resources_create_update_table_role_assignment_request( + _request = build_mongo_db_resources_mongo_db_database_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + database_name=database_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22090,7 +24964,7 @@ def _create_update_table_role_assignment_initial( # pylint: disable=name-too-lo pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -22111,148 +24985,158 @@ def _create_update_table_role_assignment_initial( # pylint: disable=name-too-lo return deserialized # type: ignore @overload - def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, + database_name: str, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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 + :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 LROPoller that returns TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: _types.TableRoleAssignmentResource, + database_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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.types.TableRoleAssignmentResource + :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.types.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 TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: IO[bytes], + database_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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] + :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 TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_table_role_assignment( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_mongo_db_database_partition_merge( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_table_role_assignment_parameters: Union[ - _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] - ], + database_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.TableRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Table Role Assignment. + ) -> 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. :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 - ~azure.mgmt.cosmosdb.types.TableRoleAssignmentResource or IO[bytes] - :return: An instance of LROPoller that returns TableRoleAssignmentResource. The - TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :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 + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TableRoleAssignmentResource] = 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_table_role_assignment_initial( + raw_result = self._mongo_db_database_partition_merge_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, + database_name=database_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22264,7 +25148,7 @@ def begin_create_update_table_role_assignment( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22282,279 +25166,34 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.TableRoleAssignmentResource].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.TableRoleAssignmentResource]( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( 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 = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_table_resources_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=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.ErrorResponse, - 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.iter_bytes() if _decompress else response.iter_raw() - - 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 None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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, - 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 - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) -> ItemPaged["_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 TableRoleAssignmentResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.TableRoleAssignmentResource]] = 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_table_resources_list_table_role_assignments_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.TableRoleAssignmentResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class CassandraResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`cassandra_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get_cassandra_keyspace_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database - account with the provided name. + 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :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. The MongoDBCollectionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -22568,12 +25207,13 @@ def get_cassandra_keyspace_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoDBCollectionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_keyspace_throughput_request( + _request = build_mongo_db_resources_get_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22608,20 +25248,21 @@ def get_cassandra_keyspace_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long + def _create_update_mongo_db_collection_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[ + _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -22641,15 +25282,16 @@ def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-l content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_mongo_db_collection_parameters, (IOBase, bytes)): + _content = create_update_mongo_db_collection_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_db_collection_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_update_cassandra_keyspace_throughput_request( + _request = build_mongo_db_resources_create_update_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -22698,148 +25340,161 @@ def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-l return deserialized # type: ignore @overload - def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _models.MongoDBCollectionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: _types.MongoDBCollectionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long + def begin_create_update_mongo_db_collection( self, resource_group_name: str, account_name: str, - keyspace_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + database_name: str, + collection_name: str, + create_update_mongo_db_collection_parameters: Union[ + _models.MongoDBCollectionCreateUpdateParameters, _types.MongoDBCollectionCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + :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 update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :type create_update_mongo_db_collection_parameters: + ~azure.mgmt.cosmosdb.models.MongoDBCollectionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoDBCollectionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns MongoDBCollectionGetResults. The + MongoDBCollectionGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_cassandra_keyspace_throughput_initial( + raw_result = self._create_update_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + collection_name=collection_name, + create_update_mongo_db_collection_parameters=create_update_mongo_db_collection_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -22851,7 +25506,7 @@ def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.MongoDBCollectionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -22869,18 +25524,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return LROPoller[_models.MongoDBCollectionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + 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, @@ -22895,10 +25550,11 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-to cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_migrate_cassandra_keyspace_to_autoscale_request( + _request = build_mongo_db_resources_delete_mongo_db_collection_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -22917,14 +25573,14 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-to 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -22935,7 +25591,6 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-to "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -22945,35 +25600,37 @@ def _migrate_cassandra_keyspace_to_autoscale_initial( # pylint: disable=name-to return deserialized # type: ignore @distributed_trace - def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. + 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_cassandra_keyspace_to_autoscale_initial( + raw_result = self._delete_mongo_db_collection_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, + database_name=database_name, + collection_name=collection_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -22982,12 +25639,9 @@ def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-l raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -23002,170 +25656,36 @@ 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 - ) - - 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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + def list_mongo_db_collections( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> ItemPaged["_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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An iterator like instance of MongoDBCollectionGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoDBCollectionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_keyspace_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 - ) - - @distributed_trace - def get_cassandra_table_throughput( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database - account with the provided name. + cls: ClsType[List[_models.MongoDBCollectionGetResults]] = kwargs.pop("cls", None) - :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults - :raises ~azure.core.exceptions.HttpResponseError: - """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -23174,66 +25694,104 @@ def get_cassandra_table_throughput( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + _request = build_mongo_db_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_cassandra_resources_get_cassandra_table_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MongoDBCollectionGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, + 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 ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) - def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _list_mongo_db_collection_partition_merge_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -23252,16 +25810,16 @@ def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(merge_parameters, (IOBase, bytes)): + _content = merge_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(merge_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_update_cassandra_table_throughput_request( + _request = build_mongo_db_resources_list_mongo_db_collection_partition_merge_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23289,7 +25847,7 @@ def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -23310,161 +25868,172 @@ def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long return deserialized # type: ignore @overload - def begin_update_cassandra_table_throughput( + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + merge_parameters: _models.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_cassandra_table_throughput( + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + database_name: str, + collection_name: str, + merge_parameters: _types.MergeParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_cassandra_table_throughput( + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: IO[bytes], + database_name: str, + collection_name: str, + merge_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_cassandra_table_throughput( + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "database_name", + "collection_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_list_mongo_db_collection_partition_merge( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + database_name: str, + collection_name: str, + merge_parameters: Union[_models.MergeParameters, _types.MergeParameters, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Cassandra table. + ) -> 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 keyspace_name: Cosmos DB keyspace name. Required. - :type keyspace_name: str - :param table_name: Cosmos DB table name. Required. - :type table_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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. Is either a MergeParameters + type or a IO[bytes] type. Required. + :type merge_parameters: ~azure.mgmt.cosmosdb.models.MergeParameters or + ~azure.mgmt.cosmosdb.types.MergeParameters or IO[bytes] + :return: An instance of LROPoller that returns PhysicalPartitionStorageInfoCollection. The + PhysicalPartitionStorageInfoCollection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PhysicalPartitionStorageInfoCollection] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = 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._update_cassandra_table_throughput_initial( + raw_result = self._list_mongo_db_collection_partition_merge_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - update_throughput_parameters=update_throughput_parameters, + database_name=database_name, + collection_name=collection_name, + merge_parameters=merge_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -23476,7 +26045,7 @@ def begin_update_cassandra_table_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.PhysicalPartitionStorageInfoCollection, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23494,18 +26063,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].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.ThroughputSettingsGetResults]( + return LROPoller[_models.PhysicalPartitionStorageInfoCollection]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -23515,18 +26090,28 @@ def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-l } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_migrate_cassandra_table_to_autoscale_request( + content_type = content_type or "application/json" + _content = None + if isinstance(location, (IOBase, bytes)): + _content = location + else: + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_mongo_db_resources_retrieve_continuous_backup_information_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -23557,9 +26142,6 @@ def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-l 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -23570,176 +26152,154 @@ def _migrate_cassandra_table_to_autoscale_initial( # pylint: disable=name-too-l return deserialized # type: ignore - @distributed_trace - def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: _models.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - 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_table_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: _types.ContinuousBackupRestoreLocation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + :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 location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation + :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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + @overload + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. - return deserialized # type: ignore + :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 location: The name of the continuous backup restore location. Required. + :type location: 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 BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + database_name: str, + collection_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a Mongodb collection. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupInformation] = 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_table_to_manual_throughput_initial( + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, + database_name=database_name, + collection_name=collection_name, + location=location, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -23750,7 +26310,7 @@ def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name- def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -23768,33 +26328,33 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.BackupInformation].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.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @distributed_trace - def get_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> _models.CassandraKeyspaceGetResults: - """Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the - provided name. + def get_mongo_role_definition( + self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.MongoRoleDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB Mongo Role Definition with the given + Id. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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: CassandraKeyspaceGetResults. The CassandraKeyspaceGetResults is compatible with + :return: MongoRoleDefinitionGetResults. The MongoRoleDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -23808,12 +26368,12 @@ def get_cassandra_keyspace( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_keyspace_request( + _request = build_mongo_db_resources_get_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -23840,7 +26400,7 @@ def get_cassandra_keyspace( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -23848,20 +26408,22 @@ def get_cassandra_keyspace( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) + deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long + def _create_update_mongo_role_definition_initial( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[ - _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] + create_update_mongo_role_definition_parameters: Union[ + _models.MongoRoleDefinitionCreateUpdateParameters, + _types.MongoRoleDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> Iterator[bytes]: @@ -23881,15 +26443,15 @@ def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_keyspace_parameters, (IOBase, bytes)): - _content = create_update_cassandra_keyspace_parameters + if isinstance(create_update_mongo_role_definition_parameters, (IOBase, bytes)): + _content = create_update_mongo_role_definition_parameters else: - _content = json.dumps(create_update_cassandra_keyspace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_keyspace_request( + _request = build_mongo_db_resources_create_update_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -23917,16 +26479,13 @@ def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -23938,148 +26497,154 @@ def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long return deserialized # type: ignore @overload - def begin_create_update_cassandra_keyspace( + def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, + create_update_mongo_role_definition_parameters: _models.MongoRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters :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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + :return: An instance of LROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_keyspace( + def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: _types.CassandraKeyspaceCreateUpdateParameters, + create_update_mongo_role_definition_parameters: _types.MongoRoleDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters :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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + :return: An instance of LROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_keyspace( + def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: IO[bytes], + create_update_mongo_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Required. - :type create_update_cassandra_keyspace_parameters: IO[bytes] + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_mongo_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 CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + :return: An instance of LROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_keyspace( + def begin_create_update_mongo_role_definition( # pylint: disable=name-too-long self, + mongo_role_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - create_update_cassandra_keyspace_parameters: Union[ - _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] + create_update_mongo_role_definition_parameters: Union[ + _models.MongoRoleDefinitionCreateUpdateParameters, + _types.MongoRoleDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> LROPoller[_models.CassandraKeyspaceGetResults]: - """Create or update an Azure Cosmos DB Cassandra keyspace. + ) -> LROPoller[_models.MongoRoleDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 create_update_cassandra_keyspace_parameters: The parameters to provide for the current - Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes] - type. Required. - :type create_update_cassandra_keyspace_parameters: - ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns CassandraKeyspaceGetResults. The - CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + :param create_update_mongo_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a MongoRoleDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_mongo_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoRoleDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoRoleDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns MongoRoleDefinitionGetResults. The + MongoRoleDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoRoleDefinitionGetResults] = 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_keyspace_initial( + raw_result = self._create_update_mongo_role_definition_initial( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, + create_update_mongo_role_definition_parameters=create_update_mongo_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24091,7 +26656,7 @@ def begin_create_update_cassandra_keyspace( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) + deserialized = _deserialize(_models.MongoRoleDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24109,18 +26674,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CassandraKeyspaceGetResults].from_continuation_token( + return LROPoller[_models.MongoRoleDefinitionGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CassandraKeyspaceGetResults]( + return LROPoller[_models.MongoRoleDefinitionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_cassandra_keyspace_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -24135,10 +26700,10 @@ def _delete_cassandra_keyspace_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_keyspace_request( + _request = build_mongo_db_resources_delete_mongo_role_definition_request( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24157,24 +26722,22 @@ def _delete_cassandra_keyspace_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -24184,18 +26747,18 @@ def _delete_cassandra_keyspace_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_cassandra_keyspace( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + def begin_delete_mongo_role_definition( + self, mongo_role_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra keyspace. + """Deletes an existing Azure Cosmos DB Mongo Role Definition. + :param mongo_role_definition_id: The ID for the Role Definition {dbName.roleName}. Required. + :type mongo_role_definition_id: str :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 instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24208,10 +26771,10 @@ def begin_delete_cassandra_keyspace( 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_keyspace_initial( + raw_result = self._delete_mongo_role_definition_initial( + mongo_role_definition_id=mongo_role_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -24246,24 +26809,24 @@ 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 @distributed_trace - def list_cassandra_keyspaces( + def list_mongo_role_definitions( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.CassandraKeyspaceGetResults"]: - """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. + ) -> ItemPaged["_models.MongoRoleDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB Mongo Role Definitions. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraKeyspaceGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] + :return: An iterator like instance of MongoRoleDefinitionGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoRoleDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoRoleDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24276,7 +26839,7 @@ def list_cassandra_keyspaces( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_keyspaces_request( + _request = build_mongo_db_resources_list_mongo_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -24319,7 +26882,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraKeyspaceGetResults], + List[_models.MongoRoleDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -24338,7 +26901,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -24348,23 +26911,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any - ) -> _models.CassandraTableGetResults: - """Gets the Cassandra table under an existing Azure Cosmos DB database account. + def get_mongo_user_definition( + self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any + ) -> _models.MongoUserDefinitionGetResults: + """Retrieves the properties of an existing Azure Cosmos DB Mongo User Definition with the given + Id. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :return: CassandraTableGetResults. The CassandraTableGetResults is compatible with + :return: MongoUserDefinitionGetResults. The MongoUserDefinitionGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults + :rtype: ~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24378,13 +26940,12 @@ def get_cassandra_table( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoUserDefinitionGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_table_request( + _request = build_mongo_db_resources_get_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24411,7 +26972,7 @@ def get_cassandra_table( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -24419,21 +26980,22 @@ def get_cassandra_table( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) + deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_cassandra_table_initial( + def _create_update_mongo_user_definition_initial( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[ - _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] + create_update_mongo_user_definition_parameters: Union[ + _models.MongoUserDefinitionCreateUpdateParameters, + _types.MongoUserDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any ) -> Iterator[bytes]: @@ -24453,16 +27015,15 @@ def _create_update_cassandra_table_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_table_parameters, (IOBase, bytes)): - _content = create_update_cassandra_table_parameters + if isinstance(create_update_mongo_user_definition_parameters, (IOBase, bytes)): + _content = create_update_mongo_user_definition_parameters else: - _content = json.dumps(create_update_cassandra_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_mongo_user_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_table_request( + _request = build_mongo_db_resources_create_update_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -24490,16 +27051,13 @@ def _create_update_cassandra_table_initial( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -24511,161 +27069,154 @@ def _create_update_cassandra_table_initial( return deserialized # type: ignore @overload - def begin_create_update_cassandra_table( + def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, + create_update_mongo_user_definition_parameters: _models.MongoUserDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters :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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_table( + def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: _types.CassandraTableCreateUpdateParameters, + create_update_mongo_user_definition_parameters: _types.MongoUserDefinitionCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters :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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_table( + def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: IO[bytes], + create_update_mongo_user_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Required. - :type create_update_cassandra_table_parameters: IO[bytes] + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Required. + :type create_update_mongo_user_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 CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An instance of LROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_table( + def begin_create_update_mongo_user_definition( # pylint: disable=name-too-long self, + mongo_user_definition_id: str, resource_group_name: str, account_name: str, - keyspace_name: str, - table_name: str, - create_update_cassandra_table_parameters: Union[ - _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] + create_update_mongo_user_definition_parameters: Union[ + _models.MongoUserDefinitionCreateUpdateParameters, + _types.MongoUserDefinitionCreateUpdateParameters, + IO[bytes], ], **kwargs: Any - ) -> LROPoller[_models.CassandraTableGetResults]: - """Create or update an Azure Cosmos DB Cassandra Table. + ) -> LROPoller[_models.MongoUserDefinitionGetResults]: + """Creates or updates an Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str - :param create_update_cassandra_table_parameters: The parameters to provide for the current - Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_cassandra_table_parameters: - ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns CassandraTableGetResults. The - CassandraTableGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :param create_update_mongo_user_definition_parameters: The properties required to create or + update a User Definition. Is either a MongoUserDefinitionCreateUpdateParameters type or a + IO[bytes] type. Required. + :type create_update_mongo_user_definition_parameters: + ~azure.mgmt.cosmosdb.models.MongoUserDefinitionCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.MongoUserDefinitionCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns MongoUserDefinitionGetResults. The + MongoUserDefinitionGetResults is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.MongoUserDefinitionGetResults] = 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_table_initial( + raw_result = self._create_update_mongo_user_definition_initial( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, - create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, + create_update_mongo_user_definition_parameters=create_update_mongo_user_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -24677,7 +27228,7 @@ def begin_create_update_cassandra_table( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) + deserialized = _deserialize(_models.MongoUserDefinitionGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -24695,18 +27246,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CassandraTableGetResults].from_continuation_token( + return LROPoller[_models.MongoUserDefinitionGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CassandraTableGetResults]( + return LROPoller[_models.MongoUserDefinitionGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_cassandra_table_initial( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -24721,11 +27272,10 @@ def _delete_cassandra_table_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_table_request( + _request = build_mongo_db_resources_delete_mongo_user_definition_request( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24744,24 +27294,22 @@ def _delete_cassandra_table_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + 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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -24771,20 +27319,18 @@ def _delete_cassandra_table_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_cassandra_table( - self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + def begin_delete_mongo_user_definition( + self, mongo_user_definition_id: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra table. + """Deletes an existing Azure Cosmos DB Mongo User Definition. + :param mongo_user_definition_id: The ID for the User Definition {dbName.userName}. Required. + :type mongo_user_definition_id: str :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 table_name: Cosmos DB table name. Required. - :type table_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -24797,11 +27343,10 @@ def begin_delete_cassandra_table( 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_table_initial( + raw_result = self._delete_mongo_user_definition_initial( + mongo_user_definition_id=mongo_user_definition_id, resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, - table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -24836,26 +27381,24 @@ 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 @distributed_trace - def list_cassandra_tables( - self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any - ) -> ItemPaged["_models.CassandraTableGetResults"]: - """Lists the Cassandra table under an existing Azure Cosmos DB database account. + def list_mongo_user_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.MongoUserDefinitionGetResults"]: + """Retrieves the list of all Azure Cosmos DB Mongo User Definition. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraTableGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :return: An iterator like instance of MongoUserDefinitionGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MongoUserDefinitionGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.MongoUserDefinitionGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -24868,10 +27411,9 @@ def list_cassandra_tables( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_tables_request( + _request = build_mongo_db_resources_list_mongo_user_definitions_request( resource_group_name=resource_group_name, account_name=account_name, - keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -24912,7 +27454,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraTableGetResults], + List[_models.MongoUserDefinitionGetResults], deserialized.get("value", []), ) if cls: @@ -24931,7 +27473,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 = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -24940,23 +27482,41 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class TableResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`table_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def get_cassandra_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> _models.CassandraRoleDefinitionResource: - """Retrieves the properties of an existing Azure Cosmos DB Cassandra Role Definition with the - given Id. + def get_table_throughput( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with + the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: CassandraRoleDefinitionResource. The CassandraRoleDefinitionResource is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -24970,12 +27530,12 @@ def get_cassandra_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_role_definition_request( + _request = build_table_resources_get_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25010,20 +27570,20 @@ def get_cassandra_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_cassandra_role_definition_initial( # pylint: disable=name-too-long + def _update_table_throughput_initial( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: Union[ - _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -25043,15 +27603,15 @@ def _create_update_cassandra_role_definition_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_role_definition_parameters, (IOBase, bytes)): - _content = create_update_cassandra_role_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_cassandra_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_role_definition_request( + _request = build_table_resources_update_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -25100,152 +27660,148 @@ def _create_update_cassandra_role_definition_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: _models.CassandraRoleDefinitionResource, + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. 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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: _types.CassandraRoleDefinitionResource, + table_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: IO[bytes], + table_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_cassandra_role_definition_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. 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 CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long + def begin_update_table_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_cassandra_role_definition_parameters: Union[ - _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.CassandraRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Definition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a CassandraRoleDefinitionResource type or a IO[bytes] type. + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The parameters to provide for the RUs per second of the + current Table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. Required. - :type create_update_cassandra_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource or IO[bytes] - :return: An instance of LROPoller that returns CassandraRoleDefinitionResource. The - CassandraRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraRoleDefinitionResource] = 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._create_update_cassandra_role_definition_initial( + raw_result = self._update_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, - create_update_cassandra_role_definition_parameters=create_update_cassandra_role_definition_parameters, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -25257,7 +27813,7 @@ def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-l def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25275,18 +27831,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CassandraRoleDefinitionResource].from_continuation_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.CassandraRoleDefinitionResource]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + def _migrate_table_to_autoscale_initial( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25301,10 +27857,10 @@ def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_role_definition_request( + _request = build_table_resources_migrate_table_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25323,14 +27879,14 @@ def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long response = pipeline_response.http_response - if response.status_code not in [200, 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -25341,6 +27897,7 @@ def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -25350,34 +27907,35 @@ def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long return deserialized # type: ignore @distributed_trace - def begin_delete_cassandra_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra Role Definition. + def begin_migrate_table_to_autoscale( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Table from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 None - :rtype: ~azure.core.polling.LROPoller[None] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_cassandra_role_definition_initial( + raw_result = self._migrate_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -25386,9 +27944,12 @@ def begin_delete_cassandra_role_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -25403,35 +27964,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_cassandra_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.CassandraRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Cassandra 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 CassandraRoleDefinitionResource - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.CassandraRoleDefinitionResource]] = kwargs.pop("cls", None) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -25440,97 +27985,143 @@ def list_cassandra_role_definitions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_cassandra_resources_list_cassandra_role_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_table_resources_migrate_table_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.CassandraRoleDefinitionResource], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_table_to_manual_throughput( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Table from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_table_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + table_name=table_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) @distributed_trace - def get_cassandra_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any - ) -> _models.CassandraRoleAssignmentResource: - """Retrieves the properties of an existing Azure Cosmos DB Cassandra Role Assignment with the - given Id. + def get_table( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any + ) -> _models.TableGetResults: + """Gets the Tables under an existing Azure Cosmos DB database account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: CassandraRoleAssignmentResource. The CassandraRoleAssignmentResource is compatible - with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: TableGetResults. The TableGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.TableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -25544,12 +28135,12 @@ def get_cassandra_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TableGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_resources_get_cassandra_role_assignment_request( + _request = build_table_resources_get_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25584,20 +28175,20 @@ def get_cassandra_role_assignment( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.TableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-too-long + def _create_update_table_initial( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: Union[ - _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + table_name: str, + create_update_table_parameters: Union[ + _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -25617,15 +28208,15 @@ def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-to content_type = content_type or "application/json" _content = None - if isinstance(create_update_cassandra_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_cassandra_role_assignment_parameters + if isinstance(create_update_table_parameters, (IOBase, bytes)): + _content = create_update_table_parameters else: - _content = json.dumps(create_update_cassandra_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_resources_create_update_cassandra_role_assignment_request( + _request = build_table_resources_create_update_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -25674,152 +28265,144 @@ def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-to return deserialized # type: ignore @overload - def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: _models.CassandraRoleAssignmentResource, + table_name: str, + create_update_table_parameters: _models.TableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> LROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters :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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of LROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: _types.CassandraRoleAssignmentResource, + table_name: str, + create_update_table_parameters: _types.TableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> LROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters :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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of LROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: IO[bytes], + table_name: str, + create_update_table_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> LROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_cassandra_role_assignment_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. + Required. + :type create_update_table_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 CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An instance of LROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + def begin_create_update_table( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_cassandra_role_assignment_parameters: Union[ - _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + table_name: str, + create_update_table_parameters: Union[ + _models.TableCreateUpdateParameters, _types.TableCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.CassandraRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. + ) -> LROPoller[_models.TableGetResults]: + """Create or update an Azure Cosmos DB Table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_cassandra_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a CassandraRoleAssignmentResource type or a IO[bytes] type. - Required. - :type create_update_cassandra_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource or - ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource or IO[bytes] - :return: An instance of LROPoller that returns CassandraRoleAssignmentResource. The - CassandraRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_table_parameters: The parameters to provide for the current Table. Is + either a TableCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_table_parameters: ~azure.mgmt.cosmosdb.models.TableCreateUpdateParameters + or ~azure.mgmt.cosmosdb.types.TableCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns TableGetResults. The TableGetResults is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.TableGetResults] = 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_role_assignment_initial( + raw_result = self._create_update_table_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, - create_update_cassandra_role_assignment_parameters=create_update_cassandra_role_assignment_parameters, + table_name=table_name, + create_update_table_parameters=create_update_table_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -25831,7 +28414,7 @@ def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-l def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.TableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -25849,18 +28432,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CassandraRoleAssignmentResource].from_continuation_token( + return LROPoller[_models.TableGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CassandraRoleAssignmentResource]( + return LROPoller[_models.TableGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + def _delete_table_initial( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -25875,10 +28458,10 @@ def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_resources_delete_cassandra_role_assignment_request( + _request = build_table_resources_delete_table_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -25897,7 +28480,7 @@ def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -25924,18 +28507,18 @@ def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long return deserialized # type: ignore @distributed_trace - def begin_delete_cassandra_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + def begin_delete_table( + self, resource_group_name: str, account_name: str, table_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Cassandra Role Assignment. + """Deletes an existing Azure Cosmos DB Table. :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 table_name: Cosmos DB table name. Required. + :type table_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -25948,10 +28531,10 @@ def begin_delete_cassandra_role_assignment( 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_role_assignment_initial( + raw_result = self._delete_table_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -25986,25 +28569,24 @@ 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 @distributed_trace - def list_cassandra_role_assignments( + def list_tables( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.CassandraRoleAssignmentResource"]: - """Retrieves the list of all Azure Cosmos DB Cassandra Role Assignments. + ) -> ItemPaged["_models.TableGetResults"]: + """Lists the Tables under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CassandraRoleAssignmentResource - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :return: An iterator like instance of TableGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.CassandraRoleAssignmentResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.TableGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26017,7 +28599,7 @@ def list_cassandra_role_assignments( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_resources_list_cassandra_role_assignments_request( + _request = build_table_resources_list_tables_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -26060,7 +28642,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.CassandraRoleAssignmentResource], + List[_models.TableGetResults], deserialized.get("value", []), ) if cls: @@ -26088,109 +28670,12 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class GremlinResourcesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`gremlin_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get_gremlin_database_throughput( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database - account with the provided name. - - :param resource_group_name: 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: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with - MutableMapping - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - - _request = build_gremlin_resources_get_gremlin_database_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("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]: - if _stream: - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long + def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + table_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -26209,15 +28694,15 @@ def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-lon content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(location, (IOBase, bytes)): + _content = location else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_update_gremlin_database_throughput_request( + _request = build_table_resources_retrieve_continuous_backup_information_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -26245,16 +28730,13 @@ def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-lon pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -26266,148 +28748,139 @@ def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-lon return deserialized # type: ignore @overload - def begin_update_gremlin_database_throughput( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + table_name: str, + location: _models.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_gremlin_database_throughput( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + table_name: str, + location: _types.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_gremlin_database_throughput( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: IO[bytes], + table_name: str, + location: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Required. - :type update_throughput_parameters: IO[bytes] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: 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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_gremlin_database_throughput( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] - ], + table_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] - type. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupInformation] = 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_gremlin_database_throughput_initial( + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - update_throughput_parameters=update_throughput_parameters, + table_name=table_name, + location=location, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -26419,7 +28892,7 @@ def begin_update_gremlin_database_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26437,19 +28910,35 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_token( + return LROPoller[_models.BackupInformation].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.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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]: + @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. The TableRoleDefinitionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -26461,12 +28950,12 @@ def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too- _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.TableRoleDefinitionResource] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_database_to_autoscale_request( + _request = build_table_resources_get_table_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26478,110 +28967,45 @@ def _migrate_gremlin_database_to_autoscale_initial( # pylint: disable=name-too- _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = True + _stream = kwargs.pop("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 + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - @distributed_trace - def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - 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_gremlin_database_to_autoscale_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_database_to_manual_throughput_initial( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + 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, _types.TableRoleDefinitionResource, IO[bytes] + ], + **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -26591,17 +29015,27 @@ def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=n } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_database_to_manual_throughput_request( + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_table_role_definition_parameters, (IOBase, bytes)): + _content = create_update_table_role_definition_parameters + else: + _content = json.dumps(create_update_table_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_table_resources_create_update_table_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -26625,7 +29059,7 @@ def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=n pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -26636,7 +29070,6 @@ def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=n "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -26645,36 +29078,150 @@ def _migrate_gremlin_database_to_manual_throughput_initial( # pylint: disable=n return deserialized # type: ignore - @distributed_trace - def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. + @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 database_name: Cosmos DB database name. Required. - :type database_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + @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: _types.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.types.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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :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 TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :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, _types.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 + ~azure.mgmt.cosmosdb.types.TableRoleDefinitionResource or IO[bytes] + :return: An instance of LROPoller that returns TableRoleDefinitionResource. The + TableRoleDefinitionResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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._migrate_gremlin_database_to_manual_throughput_initial( + raw_result = self._create_update_table_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + role_definition_id=role_definition_id, + create_update_table_role_definition_parameters=create_update_table_role_definition_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -26685,7 +29232,7 @@ def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -26703,35 +29250,261 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_table_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + @distributed_trace - def get_gremlin_graph_throughput( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> _models.ThroughputSettingsGetResults: - """Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the - provided name. + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) -> ItemPaged["_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 TableRoleDefinitionResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TableRoleDefinitionResource]] = 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_table_resources_list_table_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TableRoleDefinitionResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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. The TableRoleAssignmentResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :rtype: ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -26745,13 +29518,12 @@ def get_gremlin_graph_throughput( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.TableRoleAssignmentResource] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_graph_throughput_request( + _request = build_table_resources_get_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -26786,21 +29558,20 @@ def get_gremlin_graph_throughput( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _update_gremlin_graph_throughput_initial( + def _create_update_table_role_assignment_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[ + _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -26820,16 +29591,15 @@ def _update_gremlin_graph_throughput_initial( content_type = content_type or "application/json" _content = None - if isinstance(update_throughput_parameters, (IOBase, bytes)): - _content = update_throughput_parameters + if isinstance(create_update_table_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_table_role_assignment_parameters else: - _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_table_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_update_gremlin_graph_throughput_request( + _request = build_table_resources_create_update_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -26878,161 +29648,148 @@ def _update_gremlin_graph_throughput_initial( return deserialized # type: ignore @overload - def begin_update_gremlin_graph_throughput( + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _models.TableRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_gremlin_graph_throughput( + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + role_assignment_id: str, + create_update_table_role_assignment_parameters: _types.TableRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters + :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.types.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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update_gremlin_graph_throughput( + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: IO[bytes], + role_assignment_id: str, + create_update_table_role_assignment_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Required. - :type update_throughput_parameters: IO[bytes] + :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 ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :return: An instance of LROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update_gremlin_graph_throughput( + def begin_create_update_table_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - update_throughput_parameters: Union[ - _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + role_assignment_id: str, + create_update_table_role_assignment_parameters: Union[ + _models.TableRoleAssignmentResource, _types.TableRoleAssignmentResource, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Update RUs per second of an Azure Cosmos DB Gremlin graph. + ) -> 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param update_throughput_parameters: The RUs per second of the parameters to provide for the - current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + :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 update_throughput_parameters: - ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or - ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: + :type create_update_table_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.TableRoleAssignmentResource or IO[bytes] + :return: An instance of LROPoller that returns TableRoleAssignmentResource. The + TableRoleAssignmentResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", 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._update_gremlin_graph_throughput_initial( + raw_result = self._create_update_table_role_assignment_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - update_throughput_parameters=update_throughput_parameters, + role_assignment_id=role_assignment_id, + create_update_table_role_assignment_parameters=create_update_table_role_assignment_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27044,7 +29801,7 @@ def begin_update_gremlin_graph_throughput( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + deserialized = _deserialize(_models.TableRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27062,18 +29819,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ThroughputSettingsGetResults].from_continuation_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.ThroughputSettingsGetResults]( + return LROPoller[_models.TableRoleAssignmentResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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 + 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, @@ -27088,11 +29845,10 @@ def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-lon cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_migrate_gremlin_graph_to_autoscale_request( + _request = build_table_resources_delete_table_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27111,14 +29867,14 @@ def _migrate_gremlin_graph_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 [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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -27129,7 +29885,6 @@ def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-lon "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -27139,38 +29894,34 @@ def _migrate_gremlin_graph_to_autoscale_initial( # pylint: disable=name-too-lon return deserialized # type: ignore @distributed_trace - def begin_migrate_gremlin_graph_to_autoscale( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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_gremlin_graph_to_autoscale_initial( + raw_result = self._delete_table_role_assignment_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + role_assignment_id=role_assignment_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -27179,12 +29930,9 @@ def begin_migrate_gremlin_graph_to_autoscale( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -27199,19 +29947,34 @@ 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 + + @distributed_trace + def list_table_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_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 TableRoleAssignmentResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.TableRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.TableRoleAssignmentResource]] = kwargs.pop("cls", None) - 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27220,149 +29983,115 @@ def _migrate_gremlin_graph_to_manual_throughput_initial( # pylint: disable=name } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_gremlin_resources_migrate_gremlin_graph_to_manual_throughput_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def prepare_request(next_link=None): + if not next_link: - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _request = build_table_resources_list_table_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return _request - response_headers = {} - if response.status_code == 202: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.TableRoleAssignmentResource], + deserialized.get("value", []), ) - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + def get_next(next_link=None): + _request = prepare_request(next_link) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - return deserialized # type: ignore + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace - def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller[_models.ThroughputSettingsGetResults]: - """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. + return pipeline_response - :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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The - ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return ItemPaged(get_next, extract_data) - 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_gremlin_graph_to_manual_throughput_initial( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - graph_name=graph_name, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized +class CassandraResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_resources` attribute. + """ - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get_gremlin_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> _models.GremlinDatabaseGetResults: - """Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided - name. + def get_cassandra_keyspace_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: The name of the resource group. The name is case insensitive. 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: GremlinDatabaseGetResults. The GremlinDatabaseGetResults is compatible with + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27376,12 +30105,12 @@ def get_gremlin_database( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_database_request( + _request = build_cassandra_resources_get_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27416,20 +30145,20 @@ def get_gremlin_database( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_gremlin_database_initial( + def _update_cassandra_keyspace_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: Union[ - _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + keyspace_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -27449,15 +30178,15 @@ def _create_update_gremlin_database_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_database_parameters, (IOBase, bytes)): - _content = create_update_gremlin_database_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_database_request( + _request = build_cassandra_resources_update_cassandra_keyspace_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -27506,148 +30235,148 @@ def _create_update_gremlin_database_initial( return deserialized # type: ignore @overload - def begin_create_update_gremlin_database( + def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters, + keyspace_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. 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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_database( + def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: _types.GremlinDatabaseCreateUpdateParameters, + keyspace_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_database( + def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: IO[bytes], + keyspace_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Required. - :type create_update_gremlin_database_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. 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 GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_gremlin_database( + def begin_update_cassandra_keyspace_throughput( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - create_update_gremlin_database_parameters: Union[ - _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + keyspace_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.GremlinDatabaseGetResults]: - """Create or update an Azure Cosmos DB Gremlin database. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 create_update_gremlin_database_parameters: The parameters to provide for the current - Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_gremlin_database_parameters: - ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns GremlinDatabaseGetResults. The - GremlinDatabaseGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra Keyspace. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinDatabaseGetResults] = 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._create_update_gremlin_database_initial( + raw_result = self._update_cassandra_keyspace_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + keyspace_name=keyspace_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -27659,7 +30388,7 @@ def begin_create_update_gremlin_database( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -27677,18 +30406,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.GremlinDatabaseGetResults].from_continuation_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.GremlinDatabaseGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_gremlin_database_initial( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -27703,10 +30432,10 @@ def _delete_gremlin_database_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_database_request( + _request = build_cassandra_resources_migrate_cassandra_keyspace_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27725,14 +30454,14 @@ def _delete_gremlin_database_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -27743,6 +30472,7 @@ def _delete_gremlin_database_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -27752,34 +30482,35 @@ def _delete_gremlin_database_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_gremlin_database( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin database. + def begin_migrate_cassandra_keyspace_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_gremlin_database_initial( + raw_result = self._migrate_cassandra_keyspace_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, + keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -27788,9 +30519,12 @@ def begin_delete_gremlin_database( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -27805,34 +30539,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_databases( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.GremlinDatabaseGetResults"]: - """Lists the Gremlin databases under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 GremlinDatabaseGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinDatabaseGetResults]] = kwargs.pop("cls", None) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -27841,97 +30560,147 @@ def list_gremlin_databases( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_gremlin_resources_list_gremlin_databases_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_resources_migrate_cassandra_keyspace_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinDatabaseGetResults], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_migrate_cassandra_keyspace_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra Keyspace from autoscale to manual throughput. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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_keyspace_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + keyspace_name=keyspace_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) @distributed_trace - def get_gremlin_graph( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> _models.GremlinGraphGetResults: - """Gets the Gremlin graph under an existing Azure Cosmos DB database account. + def get_cassandra_table_throughput( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database + 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 database_name: Cosmos DB database name. Required. - :type database_name: str - :param graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: GremlinGraphGetResults. The GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -27945,13 +30714,13 @@ def get_gremlin_graph( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_graph_request( + _request = build_cassandra_resources_get_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -27986,21 +30755,21 @@ def get_gremlin_graph( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_gremlin_graph_initial( + def _update_cassandra_table_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: Union[ - _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -28020,16 +30789,16 @@ def _create_update_gremlin_graph_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_graph_parameters, (IOBase, bytes)): - _content = create_update_gremlin_graph_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_graph_request( + _request = build_cassandra_resources_update_cassandra_table_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28078,161 +30847,161 @@ def _create_update_gremlin_graph_initial( return deserialized # type: ignore @overload - def begin_create_update_gremlin_graph( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters, + keyspace_name: str, + table_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. 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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_graph( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: _types.GremlinGraphCreateUpdateParameters, + keyspace_name: str, + table_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_graph( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: IO[bytes], + keyspace_name: str, + table_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Required. - :type create_update_gremlin_graph_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. 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 GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_gremlin_graph( + def begin_update_cassandra_table_throughput( self, resource_group_name: str, account_name: str, - database_name: str, - graph_name: str, - create_update_gremlin_graph_parameters: Union[ - _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.GremlinGraphGetResults]: - """Create or update an Azure Cosmos DB Gremlin graph. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Cassandra table. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param create_update_gremlin_graph_parameters: The parameters to provide for the current - Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type. - Required. - :type create_update_gremlin_graph_parameters: - ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns GremlinGraphGetResults. The - GremlinGraphGetResults is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Cassandra table. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinGraphGetResults] = 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._create_update_gremlin_graph_initial( + raw_result = self._update_cassandra_table_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, + keyspace_name=keyspace_name, + table_name=table_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -28244,7 +31013,7 @@ def begin_create_update_gremlin_graph( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28262,18 +31031,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.GremlinGraphGetResults].from_continuation_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.GremlinGraphGetResults]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_gremlin_graph_initial( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -28288,11 +31057,11 @@ def _delete_gremlin_graph_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_graph_request( + _request = build_cassandra_resources_migrate_cassandra_table_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28311,14 +31080,14 @@ def _delete_gremlin_graph_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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -28329,6 +31098,7 @@ def _delete_gremlin_graph_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -28338,37 +31108,38 @@ def _delete_gremlin_graph_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_gremlin_graph( - self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin graph. + def begin_migrate_cassandra_table_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra table from manual throughput to autoscale. :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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_gremlin_graph_initial( + raw_result = self._migrate_cassandra_table_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -28377,9 +31148,12 @@ def begin_delete_gremlin_graph( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -28394,36 +31168,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_graphs( - self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any - ) -> ItemPaged["_models.GremlinGraphGetResults"]: - """Lists the Gremlin graph under an existing Azure Cosmos DB database account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 GremlinGraphGetResults - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinGraphGetResults]] = kwargs.pop("cls", None) + return LROPoller[_models.ThroughputSettingsGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + 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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -28432,120 +31189,18 @@ def list_gremlin_graphs( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_gremlin_resources_list_gremlin_graphs_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinGraphGetResults], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, 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 = kwargs.pop("params", {}) or {} - - 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" - _content = None - if isinstance(location, (IOBase, bytes)): - _content = location - else: - _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_gremlin_resources_retrieve_continuous_backup_information_request( + _request = build_cassandra_resources_migrate_cassandra_table_to_manual_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -28576,6 +31231,9 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -28586,154 +31244,39 @@ def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too return deserialized # type: ignore - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: _models.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: _types.ContinuousBackupRestoreLocation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation - :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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Required. - :type location: 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 BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long - self, - resource_group_name: str, - account_name: str, - database_name: str, - graph_name: str, - location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.BackupInformation]: - """Retrieves continuous backup information for a gremlin graph. + def begin_migrate_cassandra_table_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Cassandra table from autoscale to manual throughput. :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 graph_name: Cosmos DB graph name. Required. - :type graph_name: str - :param location: The name of the continuous backup restore location. Is either a - ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. - :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or - ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] - :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.BackupInformation] = 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._retrieve_continuous_backup_information_initial( + raw_result = self._migrate_cassandra_table_to_manual_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - database_name=database_name, - graph_name=graph_name, - location=location, - content_type=content_type, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -28744,7 +31287,7 @@ def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-lo def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.BackupInformation, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -28762,33 +31305,35 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.BackupInformation].from_continuation_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.BackupInformation]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) @distributed_trace - def get_gremlin_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> _models.GremlinRoleDefinitionResource: - """Retrieves the properties of an existing Azure Cosmos DB Gremlin Role Definition with the given - Id. + 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :return: GremlinRoleDefinitionResource. The GremlinRoleDefinitionResource is compatible with + :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. The ThroughputSettingsGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -28802,12 +31347,13 @@ def get_gremlin_role_definition( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinRoleDefinitionResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_role_definition_request( + _request = build_cassandra_resources_get_cassandra_view_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -28842,20 +31388,21 @@ def get_gremlin_role_definition( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too-long + def _update_cassandra_view_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: Union[ - _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -28875,15 +31422,16 @@ def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too- content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_role_definition_parameters, (IOBase, bytes)): - _content = create_update_gremlin_role_definition_parameters + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters else: - _content = json.dumps(create_update_gremlin_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_role_definition_request( + _request = build_cassandra_resources_update_cassandra_view_throughput_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -28932,152 +31480,161 @@ def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too- return deserialized # type: ignore @overload - def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: _models.GremlinRoleDefinitionResource, + keyspace_name: str, + view_name: str, + update_throughput_parameters: _models.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: _types.GremlinRoleDefinitionResource, + keyspace_name: str, + view_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource + :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.types.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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: IO[bytes], + keyspace_name: str, + view_name: str, + update_throughput_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Required. - :type create_update_gremlin_role_definition_parameters: IO[bytes] + :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 GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + def begin_update_cassandra_view_throughput( self, resource_group_name: str, account_name: str, - role_definition_id: str, - create_update_gremlin_role_definition_parameters: Union[ - _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + keyspace_name: str, + view_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.GremlinRoleDefinitionResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Definition. + ) -> 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :param create_update_gremlin_role_definition_parameters: The properties required to create or - update a Role Definition. Is either a GremlinRoleDefinitionResource type or a IO[bytes] type. - Required. - :type create_update_gremlin_role_definition_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource or - ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource or IO[bytes] - :return: An instance of LROPoller that returns GremlinRoleDefinitionResource. The - GremlinRoleDefinitionResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinRoleDefinitionResource] = 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._create_update_gremlin_role_definition_initial( + raw_result = self._update_cassandra_view_throughput_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, - create_update_gremlin_role_definition_parameters=create_update_gremlin_role_definition_parameters, + keyspace_name=keyspace_name, + view_name=view_name, + update_throughput_parameters=update_throughput_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29089,7 +31646,7 @@ def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-lon def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29107,18 +31664,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.GremlinRoleDefinitionResource].from_continuation_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.GremlinRoleDefinitionResource]( + return LROPoller[_models.ThroughputSettingsGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_gremlin_role_definition_initial( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + 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, @@ -29133,10 +31690,11 @@ def _delete_gremlin_role_definition_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_role_definition_request( + _request = build_cassandra_resources_migrate_cassandra_view_to_autoscale_request( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29155,14 +31713,14 @@ def _delete_gremlin_role_definition_initial( response = pipeline_response.http_response - if response.status_code not in [200, 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.ErrorResponse, + _models.CloudError, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -29173,6 +31731,7 @@ def _delete_gremlin_role_definition_initial( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -29182,34 +31741,38 @@ def _delete_gremlin_role_definition_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_gremlin_role_definition( - self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin Role Definition. + 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 role_definition_id: The GUID for the Role Definition. Required. - :type role_definition_id: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = 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._delete_gremlin_role_definition_initial( + raw_result = self._migrate_cassandra_view_to_autoscale_initial( resource_group_name=resource_group_name, account_name=account_name, - role_definition_id=role_definition_id, + keyspace_name=keyspace_name, + view_name=view_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -29218,9 +31781,12 @@ def begin_delete_gremlin_role_definition( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -29235,34 +31801,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_gremlin_role_definitions( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.GremlinRoleDefinitionResource"]: - """Retrieves the list of all Azure Cosmos DB Gremlin 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 GremlinRoleDefinitionResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.GremlinRoleDefinitionResource]] = kwargs.pop("cls", None) + 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, @@ -29271,97 +31822,149 @@ def list_gremlin_role_definitions( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_gremlin_resources_list_gremlin_role_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - return _request + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.GremlinRoleDefinitionResource], - deserialized.get("value", []), + _request = build_cassandra_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) @distributed_trace - def get_gremlin_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any - ) -> _models.GremlinRoleAssignmentResource: - """Retrieves the properties of an existing Azure Cosmos DB Gremlin Role Assignment with the given - Id. + def get_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> _models.CassandraKeyspaceGetResults: + """Gets the Cassandra keyspaces 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 role_assignment_id: The GUID for the Role Assignment. Required. - :type role_assignment_id: str - :return: GremlinRoleAssignmentResource. The GremlinRoleAssignmentResource is compatible with + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: CassandraKeyspaceGetResults. The CassandraKeyspaceGetResults is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :rtype: ~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -29375,12 +31978,12 @@ def get_gremlin_role_assignment( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraKeyspaceGetResults] = kwargs.pop("cls", None) - _request = build_gremlin_resources_get_gremlin_role_assignment_request( + _request = build_cassandra_resources_get_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29415,20 +32018,20 @@ def get_gremlin_role_assignment( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too-long + def _create_update_cassandra_keyspace_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: Union[ - _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + keyspace_name: str, + create_update_cassandra_keyspace_parameters: Union[ + _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -29448,15 +32051,15 @@ def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too- content_type = content_type or "application/json" _content = None - if isinstance(create_update_gremlin_role_assignment_parameters, (IOBase, bytes)): - _content = create_update_gremlin_role_assignment_parameters + if isinstance(create_update_cassandra_keyspace_parameters, (IOBase, bytes)): + _content = create_update_cassandra_keyspace_parameters else: - _content = json.dumps(create_update_gremlin_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_keyspace_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_gremlin_resources_create_update_gremlin_role_assignment_request( + _request = build_cassandra_resources_create_update_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -29505,152 +32108,148 @@ def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too- return deserialized # type: ignore @overload - def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: _models.GremlinRoleAssignmentResource, + keyspace_name: str, + create_update_cassandra_keyspace_parameters: _models.CassandraKeyspaceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters :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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :return: An instance of LROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: _types.GremlinRoleAssignmentResource, + keyspace_name: str, + create_update_cassandra_keyspace_parameters: _types.CassandraKeyspaceCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters :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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :return: An instance of LROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: IO[bytes], + keyspace_name: str, + create_update_cassandra_keyspace_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Required. - :type create_update_gremlin_role_assignment_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Required. + :type create_update_cassandra_keyspace_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 GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :return: An instance of LROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long + def begin_create_update_cassandra_keyspace( self, resource_group_name: str, account_name: str, - role_assignment_id: str, - create_update_gremlin_role_assignment_parameters: Union[ - _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + keyspace_name: str, + create_update_cassandra_keyspace_parameters: Union[ + _models.CassandraKeyspaceCreateUpdateParameters, _types.CassandraKeyspaceCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.GremlinRoleAssignmentResource]: - """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. + ) -> LROPoller[_models.CassandraKeyspaceGetResults]: + """Create or update an Azure Cosmos DB Cassandra keyspace. :param resource_group_name: The name of the resource group. The name is case insensitive. 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_gremlin_role_assignment_parameters: The properties required to create or - update a Role Assignment. Is either a GremlinRoleAssignmentResource type or a IO[bytes] type. - Required. - :type create_update_gremlin_role_assignment_parameters: - ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource or - ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource or IO[bytes] - :return: An instance of LROPoller that returns GremlinRoleAssignmentResource. The - GremlinRoleAssignmentResource is compatible with MutableMapping - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param create_update_cassandra_keyspace_parameters: The parameters to provide for the current + Cassandra keyspace. Is either a CassandraKeyspaceCreateUpdateParameters type or a IO[bytes] + type. Required. + :type create_update_cassandra_keyspace_parameters: + ~azure.mgmt.cosmosdb.models.CassandraKeyspaceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraKeyspaceCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns CassandraKeyspaceGetResults. The + CassandraKeyspaceGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraKeyspaceGetResults] = 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_gremlin_role_assignment_initial( + raw_result = self._create_update_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, - create_update_gremlin_role_assignment_parameters=create_update_gremlin_role_assignment_parameters, + keyspace_name=keyspace_name, + create_update_cassandra_keyspace_parameters=create_update_cassandra_keyspace_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -29662,7 +32261,7 @@ def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-lon def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) + deserialized = _deserialize(_models.CassandraKeyspaceGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -29680,18 +32279,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.GremlinRoleAssignmentResource].from_continuation_token( + return LROPoller[_models.CassandraKeyspaceGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.GremlinRoleAssignmentResource]( + return LROPoller[_models.CassandraKeyspaceGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_gremlin_role_assignment_initial( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + def _delete_cassandra_keyspace_initial( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29706,10 +32305,10 @@ def _delete_gremlin_role_assignment_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_gremlin_resources_delete_gremlin_role_assignment_request( + _request = build_cassandra_resources_delete_cassandra_keyspace_request( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -29728,7 +32327,7 @@ def _delete_gremlin_role_assignment_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -29755,18 +32354,18 @@ def _delete_gremlin_role_assignment_initial( return deserialized # type: ignore @distributed_trace - def begin_delete_gremlin_role_assignment( - self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + def begin_delete_cassandra_keyspace( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes an existing Azure Cosmos DB Gremlin Role Assignment. + """Deletes an existing Azure Cosmos DB Cassandra keyspace. :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 keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -29779,10 +32378,10 @@ def begin_delete_gremlin_role_assignment( 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_gremlin_role_assignment_initial( + raw_result = self._delete_cassandra_keyspace_initial( resource_group_name=resource_group_name, account_name=account_name, - role_assignment_id=role_assignment_id, + keyspace_name=keyspace_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -29817,24 +32416,24 @@ 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 @distributed_trace - def list_gremlin_role_assignments( + def list_cassandra_keyspaces( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.GremlinRoleAssignmentResource"]: - """Retrieves the list of all Azure Cosmos DB Gremlin Role Assignments. + ) -> ItemPaged["_models.CassandraKeyspaceGetResults"]: + """Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 GremlinRoleAssignmentResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :return: An iterator like instance of CassandraKeyspaceGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraKeyspaceGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.GremlinRoleAssignmentResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraKeyspaceGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -29847,7 +32446,7 @@ def list_gremlin_role_assignments( def prepare_request(next_link=None): if not next_link: - _request = build_gremlin_resources_list_gremlin_role_assignments_request( + _request = build_cassandra_resources_list_cassandra_keyspaces_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -29890,7 +32489,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.GremlinRoleAssignmentResource], + List[_models.CassandraKeyspaceGetResults], deserialized.get("value", []), ) if cls: @@ -29918,44 +32517,24 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class NotebookWorkspacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`notebook_workspaces` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any - ) -> _models.NotebookWorkspace: - """Gets the notebook workspace for a Cosmos DB account. + def get_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any + ) -> _models.CassandraTableGetResults: + """Gets the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: NotebookWorkspace. The NotebookWorkspace is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :return: CassandraTableGetResults. The CassandraTableGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraTableGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -29969,12 +32548,13 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraTableGetResults] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_get_request( + _request = build_cassandra_resources_get_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30009,20 +32589,21 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + def _create_update_cassandra_table_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: Union[ - _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: Union[ + _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] ], **kwargs: Any ) -> Iterator[bytes]: @@ -30042,15 +32623,16 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(notebook_create_update_parameters, (IOBase, bytes)): - _content = notebook_create_update_parameters + if isinstance(create_update_cassandra_table_parameters, (IOBase, bytes)): + _content = create_update_cassandra_table_parameters else: - _content = json.dumps(notebook_create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_table_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_notebook_workspaces_create_or_update_request( + _request = build_cassandra_resources_create_update_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -30071,7 +32653,7 @@ def _create_or_update_initial( 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): @@ -30084,7 +32666,12 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -30094,152 +32681,161 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: _models.CassandraTableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters :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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :return: An instance of LROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: _types.NotebookWorkspaceCreateUpdateParameters, + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: _types.CassandraTableCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters :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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :return: An instance of LROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: IO[bytes], + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Required. - :type notebook_create_update_parameters: IO[bytes] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Required. + :type create_update_cassandra_table_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 NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ + :return: An instance of LROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def begin_create_or_update( + def begin_create_update_cassandra_table( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - notebook_create_update_parameters: Union[ - _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] + keyspace_name: str, + table_name: str, + create_update_cassandra_table_parameters: Union[ + _models.CassandraTableCreateUpdateParameters, _types.CassandraTableCreateUpdateParameters, IO[bytes] ], **kwargs: Any - ) -> LROPoller[_models.NotebookWorkspace]: - """Creates the notebook workspace for a Cosmos DB account. + ) -> LROPoller[_models.CassandraTableGetResults]: + """Create or update an Azure Cosmos DB Cassandra Table. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :param notebook_create_update_parameters: The notebook workspace to create for the current - database account. Is either a NotebookWorkspaceCreateUpdateParameters type or a IO[bytes] type. + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str + :param create_update_cassandra_table_parameters: The parameters to provide for the current + Cassandra Table. Is either a CassandraTableCreateUpdateParameters type or a IO[bytes] type. Required. - :type notebook_create_update_parameters: - ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns NotebookWorkspace. The NotebookWorkspace is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :type create_update_cassandra_table_parameters: + ~azure.mgmt.cosmosdb.models.CassandraTableCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraTableCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns CassandraTableGetResults. The + CassandraTableGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraTableGetResults] = 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( + raw_result = self._create_update_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, - notebook_create_update_parameters=notebook_create_update_parameters, + keyspace_name=keyspace_name, + table_name=table_name, + create_update_cassandra_table_parameters=create_update_cassandra_table_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -30250,13 +32846,10 @@ def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + deserialized = _deserialize(_models.CassandraTableGetResults, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -30272,22 +32865,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.NotebookWorkspace].from_continuation_token( + return LROPoller[_models.CassandraTableGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.NotebookWorkspace]( + return LROPoller[_models.CassandraTableGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -30302,10 +32891,11 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_delete_request( + _request = build_cassandra_resources_delete_cassandra_table_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30338,8 +32928,10 @@ def _delete_initial( 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -30349,23 +32941,20 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + def begin_delete_cassandra_table( + self, resource_group_name: str, account_name: str, keyspace_name: str, table_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the notebook workspace for a Cosmos DB account. + """Deletes an existing Azure Cosmos DB Cassandra table. :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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :param table_name: Cosmos DB table name. Required. + :type table_name: str :return: An instance of LROPoller that returns None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30378,10 +32967,11 @@ def begin_delete( 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( + raw_result = self._delete_cassandra_table_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + table_name=table_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -30416,24 +33006,26 @@ 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 @distributed_trace - def list_by_database_account( - self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.NotebookWorkspace"]: - """Gets the notebook workspace resources of an existing Cosmos DB account. + def list_cassandra_tables( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> ItemPaged["_models.CassandraTableGetResults"]: + """Lists the Cassandra table under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 NotebookWorkspace - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :param keyspace_name: Cosmos DB keyspace name. Required. + :type keyspace_name: str + :return: An iterator like instance of CassandraTableGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraTableGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.NotebookWorkspace]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraTableGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -30446,9 +33038,10 @@ def list_by_database_account( def prepare_request(next_link=None): if not next_link: - _request = build_notebook_workspaces_list_by_database_account_request( + _request = build_cassandra_resources_list_cassandra_tables_request( resource_group_name=resource_group_name, account_name=account_name, + keyspace_name=keyspace_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30489,7 +33082,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.NotebookWorkspace], + List[_models.CassandraTableGetResults], deserialized.get("value", []), ) if cls: @@ -30518,26 +33111,22 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list_connection_info( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any - ) -> _models.NotebookWorkspaceConnectionInfoResult: - """Retrieves the connection info for the notebook workspace. + 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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: NotebookWorkspaceConnectionInfoResult. The NotebookWorkspaceConnectionInfoResult is - compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult + :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. The CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraViewGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -30551,12 +33140,13 @@ def list_connection_info( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraViewGetResults] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_list_connection_info_request( + _request = build_cassandra_resources_get_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30591,18 +33181,22 @@ def list_connection_info( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.NotebookWorkspaceConnectionInfoResult, response.json()) + deserialized = _deserialize(_models.CassandraViewGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _regenerate_auth_token_initial( + def _create_update_cassandra_view_initial( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + keyspace_name: str, + view_name: str, + create_update_cassandra_view_parameters: Union[ + _models.CassandraViewCreateUpdateParameters, _types.CassandraViewCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -30613,17 +33207,28 @@ def _regenerate_auth_token_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_regenerate_auth_token_request( + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_cassandra_view_parameters, (IOBase, bytes)): + _content = create_update_cassandra_view_parameters + else: + _content = json.dumps(create_update_cassandra_view_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_resources_create_update_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -30654,8 +33259,11 @@ def _regenerate_auth_token_initial( response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -30664,40 +33272,163 @@ def _regenerate_auth_token_initial( 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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :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: _types.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.types.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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :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 CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - def begin_regenerate_auth_token( + def begin_create_update_cassandra_view( self, resource_group_name: str, account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + keyspace_name: str, + view_name: str, + create_update_cassandra_view_parameters: Union[ + _models.CassandraViewCreateUpdateParameters, _types.CassandraViewCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[None]: - """Regenerates the auth token for the notebook workspace. + ) -> 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 notebook_workspace_name: The name of the notebook workspace resource. "default" + :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 notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :type create_update_cassandra_view_parameters: + ~azure.mgmt.cosmosdb.models.CassandraViewCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.CassandraViewCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns CassandraViewGetResults. The + CassandraViewGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + 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._regenerate_auth_token_initial( + raw_result = self._create_update_cassandra_view_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, + create_update_cassandra_view_parameters=create_update_cassandra_view_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -30706,9 +33437,12 @@ def begin_regenerate_auth_token( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CassandraViewGetResults, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -30723,20 +33457,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_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[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + return LROPoller[_models.CassandraViewGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _start_initial( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + 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, @@ -30751,10 +33483,11 @@ def _start_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_notebook_workspaces_start_request( + _request = build_cassandra_resources_delete_cassandra_view_request( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30773,7 +33506,7 @@ def _start_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -30787,8 +33520,11 @@ def _start_initial( response_headers = {} if response.status_code == 202: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -30798,23 +33534,20 @@ def _start_initial( return deserialized # type: ignore @distributed_trace - def begin_start( - self, - resource_group_name: str, - account_name: str, - notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], - **kwargs: Any + def begin_delete_cassandra_view( + self, resource_group_name: str, account_name: str, keyspace_name: str, view_name: str, **kwargs: Any ) -> LROPoller[None]: - """Starts the notebook workspace. + """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 notebook_workspace_name: The name of the notebook workspace resource. "default" - Required. - :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -30827,10 +33560,11 @@ def begin_start( 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._start_initial( + raw_result = self._delete_cassandra_view_initial( resource_group_name=resource_group_name, account_name=account_name, - notebook_workspace_name=notebook_workspace_name, + keyspace_name=keyspace_name, + view_name=view_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -30864,40 +33598,128 @@ 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 + @distributed_trace + def list_cassandra_views( + self, resource_group_name: str, account_name: str, keyspace_name: str, **kwargs: Any + ) -> ItemPaged["_models.CassandraViewGetResults"]: + """Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :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 CassandraViewGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraViewGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ + cls: ClsType[List[_models.CassandraViewGetResults]] = kwargs.pop("cls", None) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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_cassandra_resources_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CassandraViewGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + 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, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. + def get_cassandra_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.CassandraRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :return: CassandraRoleDefinitionResource. The CassandraRoleDefinitionResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -30911,12 +33733,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleDefinitionResource] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_get_request( + _request = build_cassandra_resources_get_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -30951,19 +33773,21 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_or_update_initial( + def _create_update_cassandra_role_definition_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: Union[ + _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -30982,15 +33806,15 @@ def _create_or_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(create_update_cassandra_role_definition_parameters, (IOBase, bytes)): + _content = create_update_cassandra_role_definition_parameters else: - _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_cassandra_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_private_endpoint_connections_create_or_update_request( + _request = build_cassandra_resources_create_update_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -31025,6 +33849,9 @@ def _create_or_update_initial( 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -31036,138 +33863,152 @@ def _create_or_update_initial( return deserialized # type: ignore @overload - def begin_create_or_update( + def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, + role_definition_id: str, + create_update_cassandra_role_definition_parameters: _models.CassandraRoleDefinitionResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> LROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource :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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :return: An instance of LROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: _types.PrivateEndpointConnection, + role_definition_id: str, + create_update_cassandra_role_definition_parameters: _types.CassandraRoleDefinitionResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> LROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource :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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :return: An instance of LROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_or_update( + def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> LROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: IO[bytes] + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_cassandra_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 PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :return: An instance of LROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_or_update( + def begin_create_update_cassandra_role_definition( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + role_definition_id: str, + create_update_cassandra_role_definition_parameters: Union[ + _models.CassandraRoleDefinitionResource, _types.CassandraRoleDefinitionResource, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. + ) -> LROPoller[_models.CassandraRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection or - ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns PrivateEndpointConnection. The - PrivateEndpointConnection is compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :param role_definition_id: The GUID for the Role Definition. Required. + :type role_definition_id: str + :param create_update_cassandra_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a CassandraRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_cassandra_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource or + ~azure.mgmt.cosmosdb.types.CassandraRoleDefinitionResource or IO[bytes] + :return: An instance of LROPoller that returns CassandraRoleDefinitionResource. The + CassandraRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleDefinitionResource] = 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( + raw_result = self._create_update_cassandra_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, - parameters=parameters, + role_definition_id=role_definition_id, + create_update_cassandra_role_definition_parameters=create_update_cassandra_role_definition_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -31179,7 +34020,7 @@ def begin_create_or_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + deserialized = _deserialize(_models.CassandraRoleDefinitionResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -31197,18 +34038,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + return LROPoller[_models.CassandraRoleDefinitionResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.PrivateEndpointConnection]( + return LROPoller[_models.CassandraRoleDefinitionResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + def _delete_cassandra_role_definition_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31223,10 +34064,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_private_endpoint_connections_delete_request( + _request = build_cassandra_resources_delete_cassandra_role_definition_request( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31245,7 +34086,7 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [202, 204]: + if response.status_code not in [200, 202, 204]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -31259,8 +34100,10 @@ def _delete_initial( 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -31270,18 +34113,18 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - def begin_delete( - self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + def begin_delete_cassandra_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. + """Deletes an existing Azure Cosmos DB Cassandra 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -31294,10 +34137,10 @@ def begin_delete( 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( + raw_result = self._delete_cassandra_role_definition_initial( resource_group_name=resource_group_name, account_name=account_name, - private_endpoint_connection_name=private_endpoint_connection_name, + role_definition_id=role_definition_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -31332,24 +34175,25 @@ 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 @distributed_trace - def list_by_database_account( + def list_cassandra_role_definitions( self, resource_group_name: str, account_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """List all private endpoint connections on a Cosmos DB account. + ) -> ItemPaged["_models.CassandraRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Cassandra 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 PrivateEndpointConnection - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :return: An iterator like instance of CassandraRoleDefinitionResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraRoleDefinitionResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31362,7 +34206,7 @@ def list_by_database_account( def prepare_request(next_link=None): if not next_link: - _request = build_private_endpoint_connections_list_by_database_account_request( + _request = build_cassandra_resources_list_cassandra_role_definitions_request( resource_group_name=resource_group_name, account_name=account_name, subscription_id=self._config.subscription_id, @@ -31405,7 +34249,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.PrivateEndpointConnection], + List[_models.CassandraRoleDefinitionResource], deserialized.get("value", []), ) if cls: @@ -31433,39 +34277,23 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`private_link_resources` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get( - self, resource_group_name: str, account_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Cosmos DB account. + def get_cassandra_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.CassandraRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Cassandra 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 group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: CassandraRoleAssignmentResource. The CassandraRoleAssignmentResource is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -31479,12 +34307,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + cls: ClsType[_models.CassandraRoleAssignmentResource] = kwargs.pop("cls", None) - _request = build_private_link_resources_get_request( + _request = build_cassandra_resources_get_cassandra_role_assignment_request( resource_group_name=resource_group_name, account_name=account_name, - group_name=group_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31519,33 +34347,23 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) 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 - ) -> ItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Cosmos DB account. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - 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 PrivateLinkResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) - + def _create_update_cassandra_role_assignment_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: Union[ + _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + ], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31554,125 +34372,259 @@ def list_by_database_account( } 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 = kwargs.pop("params", {}) or {} - _request = build_private_link_resources_list_by_database_account_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_cassandra_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_cassandra_role_assignment_parameters + else: + _content = json.dumps(create_update_cassandra_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_cassandra_resources_create_update_cassandra_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, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PrivateLinkResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class DatabaseOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: _models.CassandraRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra Role Assignment. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`database` attribute. - """ + :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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource + :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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: _types.CassandraRoleAssignmentResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource + :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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_cassandra_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 CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_metrics( - self, resource_group_name: str, account_name: str, database_rid: str, *, filter: str, **kwargs: Any - ) -> ItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and - database. + def begin_create_update_cassandra_role_assignment( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_assignment_id: str, + create_update_cassandra_role_assignment_parameters: Union[ + _models.CassandraRoleAssignmentResource, _types.CassandraRoleAssignmentResource, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.CassandraRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Cassandra 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 database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :param create_update_cassandra_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a CassandraRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_cassandra_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.CassandraRoleAssignmentResource or IO[bytes] + :return: An instance of LROPoller that returns CassandraRoleAssignmentResource. The + CassandraRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CassandraRoleAssignmentResource] = 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_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_cassandra_role_assignment_parameters=create_update_cassandra_role_assignment_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CassandraRoleAssignmentResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CassandraRoleAssignmentResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CassandraRoleAssignmentResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + def _delete_cassandra_role_assignment_initial( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -31681,219 +34633,141 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_database_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_cassandra_resources_delete_cassandra_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Metric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def list_usages( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - *, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.Usage"]: - """Retrieves the usages (most recent data) for the given database. + def begin_delete_cassandra_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Cassandra 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 database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :param role_assignment_id: The GUID for the Role Assignment. Required. + :type role_assignment_id: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Usage]] = 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_database_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Usage], - deserialized.get("value", []), + 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_role_assignment_initial( + resource_group_name=resource_group_name, + account_name=account_name, + role_assignment_id=role_assignment_id, + 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: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, None, {}) # type: ignore - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _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, path_format_arguments=path_format_arguments, **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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + 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_metric_definitions( - self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any - ) -> ItemPaged["_models.MetricDefinition"]: - """Retrieves metric definitions for the given database. + def list_cassandra_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.CassandraRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Cassandra 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 - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :return: An iterator like instance of MetricDefinition - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :return: An iterator like instance of CassandraRoleAssignmentResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CassandraRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.MetricDefinition]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.CassandraRoleAssignmentResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -31906,10 +34780,9 @@ def list_metric_definitions( def prepare_request(next_link=None): if not next_link: - _request = build_database_list_metric_definitions_request( + _request = build_cassandra_resources_list_cassandra_role_assignments_request( resource_group_name=resource_group_name, account_name=account_name, - database_rid=database_rid, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -31950,7 +34823,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.MetricDefinition], + List[_models.CassandraRoleAssignmentResource], deserialized.get("value", []), ) if cls: @@ -31979,14 +34852,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class CollectionOperations: +class GremlinResourcesOperations: # pylint: disable=docstring-missing-param,too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`collection` attribute. + :attr:`gremlin_resources` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -31997,41 +34870,24 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_metrics( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: str, - **kwargs: Any - ) -> ItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and - collection. + def get_gremlin_database_throughput( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database + account with the provided name. :param resource_group_name: 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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Metric]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32040,118 +34896,66 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_collection_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.ThroughputSettingsGetResults] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_get_gremlin_database_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Metric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore - @distributed_trace - def list_usages( + def _update_gremlin_database_throughput_initial( # pylint: disable=name-too-long self, resource_group_name: str, account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: Optional[str] = None, + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> ItemPaged["_models.Usage"]: - """Retrieves the usages (most recent storage data) for the given collection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of Usage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.Usage]] = kwargs.pop("cls", None) - + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32160,378 +34964,388 @@ def list_usages( } 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 = kwargs.pop("params", {}) or {} - _request = build_collection_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_gremlin_resources_update_gremlin_database_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Usage], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - @distributed_trace - def list_metric_definitions( - self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any - ) -> ItemPaged["_models.MetricDefinition"]: - """Retrieves metric definitions for the given collection. + return deserialized # type: ignore + + @overload + def begin_update_gremlin_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_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 Gremlin 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_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :return: An iterator like instance of MetricDefinition - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.MetricDefinition]] = 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_collection_list_metric_definitions_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.MetricDefinition], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + @overload + def begin_update_gremlin_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin database. -class CollectionRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`collection_region` attribute. - """ + @overload + def begin_update_gremlin_database_throughput( + self, + resource_group_name: str, + account_name: str, + database_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 Gremlin database. - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + :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 update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list_metrics( + def begin_update_gremlin_database_throughput( self, resource_group_name: str, account_name: str, - region: str, - database_rid: str, - collection_rid: str, - *, - filter: str, + database_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> ItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account, collection - and region. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin database. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] + type. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = 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_collection_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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_gremlin_database_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + update_throughput_parameters=update_throughput_parameters, + 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) - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - return _request + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Metric], - deserialized.get("value", []), + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + 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 get_next(next_link=None): - _request = prepare_request(next_link) + 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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - return pipeline_response + _request = build_gremlin_resources_migrate_gremlin_database_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return ItemPaged(get_next, extract_data) + _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 -class DatabaseAccountRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`database_account_region` attribute. - """ + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_metrics( - self, resource_group_name: str, account_name: str, region: str, *, filter: str, **kwargs: Any - ) -> ItemPaged["_models.Metric"]: - """Retrieves the metrics determined by the given filter for the given database account and region. + def begin_migrate_gremlin_database_to_autoscale( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin database from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of Metric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.Metric]] = 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_gremlin_database_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32540,138 +35354,149 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_database_account_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_migrate_gremlin_database_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.Metric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.CloudError, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class PercentileSourceTargetOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`percentile_source_target` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore @distributed_trace - def list_metrics( - self, - resource_group_name: str, - account_name: str, - source_region: str, - target_region: str, - *, - filter: str, - **kwargs: Any - ) -> ItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given account, source and target - region. This url is only for PBS and Replication Latency data. + def begin_migrate_gremlin_database_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin database from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param source_region: Source region from which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type source_region: str - :param target_region: Target region to which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type target_region: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PercentileMetric]] = 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_gremlin_database_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def get_gremlin_graph_throughput( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> _models.ThroughputSettingsGetResults: + """Gets the Gremlin graph throughput 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: ThroughputSettingsGetResults. The ThroughputSettingsGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32680,129 +35505,68 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_percentile_source_target_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - source_region=source_region, - target_region=target_region, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.ThroughputSettingsGetResults] = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + _request = build_gremlin_resources_get_gremlin_graph_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PercentileMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class PercentileTargetOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`percentile_target` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - @distributed_trace - def list_metrics( - self, resource_group_name: str, account_name: str, target_region: str, *, filter: str, **kwargs: Any - ) -> ItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given account target region. This - url is only for PBS and Replication Latency data. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) - :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 target_region: Target region to which data is written. Cosmos DB region, with spaces - between words and each word capitalized. Required. - :type target_region: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - cls: ClsType[List[_models.PercentileMetric]] = kwargs.pop("cls", None) + return deserialized # type: ignore + def _update_gremlin_graph_throughput_initial( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -32811,405 +35575,406 @@ def list_metrics( } 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 = kwargs.pop("params", {}) or {} - _request = build_percentile_target_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - target_region=target_region, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(update_throughput_parameters, (IOBase, bytes)): + _content = update_throughput_parameters + else: + _content = json.dumps(update_throughput_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_gremlin_resources_update_gremlin_graph_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PercentileMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) -class PercentileOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`percentile` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list_metrics( - self, resource_group_name: str, account_name: str, *, filter: str, **kwargs: Any - ) -> ItemPaged["_models.PercentileMetric"]: - """Retrieves the metrics determined by the given filter for the given database account. This url - is only for PBS and Replication Latency data. + @overload + def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_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 Gremlin 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 - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PercentileMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PercentileMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class CollectionPartitionRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`collection_partition_region` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list_metrics( + @overload + def begin_update_gremlin_graph_throughput( self, resource_group_name: str, account_name: str, - region: str, - database_rid: str, - collection_rid: str, + database_name: str, + graph_name: str, + update_throughput_parameters: _types.ThroughputSettingsUpdateParameters, *, - filter: str, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given collection and region, split - by partition. + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.types.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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) + @overload + def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_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 Gremlin graph. - 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 + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. 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 ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def prepare_request(next_link=None): - if not next_link: + @distributed_trace + def begin_update_gremlin_graph_throughput( + self, + resource_group_name: str, + account_name: str, + database_name: str, + graph_name: str, + update_throughput_parameters: Union[ + _models.ThroughputSettingsUpdateParameters, _types.ThroughputSettingsUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Update RUs per second of an Azure Cosmos DB Gremlin graph. - _request = build_collection_partition_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param update_throughput_parameters: The RUs per second of the parameters to provide for the + current Gremlin graph. Is either a ThroughputSettingsUpdateParameters type or a IO[bytes] type. + Required. + :type update_throughput_parameters: + ~azure.mgmt.cosmosdb.models.ThroughputSettingsUpdateParameters or + ~azure.mgmt.cosmosdb.types.ThroughputSettingsUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), + 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_gremlin_graph_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + update_throughput_parameters=update_throughput_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized - def get_next(next_link=None): - _request = prepare_request(next_link) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - _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, path_format_arguments=path_format_arguments, **kwargs) ) - response = pipeline_response.http_response + 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 + ) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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 = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - return pipeline_response + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - return ItemPaged(get_next, extract_data) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + _request = build_gremlin_resources_migrate_gremlin_graph_to_autoscale_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) -class CollectionPartitionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`collection_partition` attribute. - """ + response = pipeline_response.http_response - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 = _failsafe_deserialize( + _models.CloudError, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_metrics( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: str, - **kwargs: Any - ) -> ItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given collection, split by - partition. + def begin_migrate_gremlin_graph_to_autoscale( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin graph from manual throughput to autoscale. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = 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_gremlin_graph_to_autoscale_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_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 = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33218,118 +35983,151 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_collection_partition_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_gremlin_resources_migrate_gremlin_graph_to_manual_throughput_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + response = pipeline_response.http_response - def get_next(next_link=None): - _request = prepare_request(next_link) + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return pipeline_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return ItemPaged(get_next, extract_data) + return deserialized # type: ignore @distributed_trace - def list_usages( - self, - resource_group_name: str, - account_name: str, - database_rid: str, - collection_rid: str, - *, - filter: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.PartitionUsage"]: - """Retrieves the usages (most recent storage data) for the given collection, split by partition. + def begin_migrate_gremlin_graph_to_manual_throughput( # pylint: disable=name-too-long + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> LROPoller[_models.ThroughputSettingsGetResults]: + """Migrate an Azure Cosmos DB Gremlin graph from autoscale to manual throughput. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :keyword filter: An OData filter expression that describes a subset of usages to return. The - supported parameter is name.value (name of the metric, can have an or of multiple names). - Default value is None. - :paramtype filter: str - :return: An iterator like instance of PartitionUsage - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of LROPoller that returns ThroughputSettingsGetResults. The + ThroughputSettingsGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputSettingsGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionUsage]] = 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_gremlin_graph_to_manual_throughput_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputSettingsGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + ) + + @distributed_trace + def get_gremlin_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.GremlinDatabaseGetResults: + """Gets the Gremlin databases 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 database_name: Cosmos DB database name. Required. + :type database_name: str + :return: GremlinDatabaseGetResults. The GremlinDatabaseGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33338,139 +36136,66 @@ def list_usages( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_collection_partition_list_usages_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.GremlinDatabaseGetResults] = kwargs.pop("cls", None) - return _request + _request = build_gremlin_resources_get_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionUsage], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) -class PartitionKeyRangeIdOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`partition_key_range_id` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list_metrics( + def _create_update_gremlin_database_initial( self, resource_group_name: str, account_name: str, - database_rid: str, - collection_rid: str, - partition_key_range_id: str, - *, - filter: str, + database_name: str, + create_update_gremlin_database_parameters: Union[ + _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> ItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given partition key range id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param account_name: Cosmos DB database account name. Required. - :type account_name: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :param partition_key_range_id: Partition Key Range Id for which to get data. Required. - :type partition_key_range_id: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) - + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33479,144 +36204,255 @@ def list_metrics( } 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 = kwargs.pop("params", {}) or {} - _request = build_partition_key_range_id_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - database_rid=database_rid, - collection_rid=collection_rid, - partition_key_range_id=partition_key_range_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_gremlin_database_parameters, (IOBase, bytes)): + _content = create_update_gremlin_database_parameters + else: + _content = json.dumps(create_update_gremlin_database_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_gremlin_resources_create_update_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.ErrorResponse, - 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class PartitionKeyRangeIdRegionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @overload + def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: _models.GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`partition_key_range_id_region` attribute. - """ + :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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters + :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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: _types.GremlinDatabaseCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. - @distributed_trace - def list_metrics( + :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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters + :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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_gremlin_database( self, resource_group_name: str, account_name: str, - region: str, - database_rid: str, - collection_rid: str, - partition_key_range_id: str, + database_name: str, + create_update_gremlin_database_parameters: IO[bytes], *, - filter: str, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.PartitionMetric"]: - """Retrieves the metrics determined by the given filter for the given partition key range id and - region. + ) -> LROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param account_name: Cosmos DB database account name. Required. :type account_name: str - :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type region: str - :param database_rid: Cosmos DB database rid. Required. - :type database_rid: str - :param collection_rid: Cosmos DB collection rid. Required. - :type collection_rid: str - :param partition_key_range_id: Partition Key Range Id for which to get data. Required. - :type partition_key_range_id: str - :keyword filter: An OData filter expression that describes a subset of metrics to return. The - parameters that can be filtered are name.value (name of the metric, can have an or of multiple - names), startTime, endTime, and timeGrain. The supported operator is eq. Required. - :paramtype filter: str - :return: An iterator like instance of PartitionMetric - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :param database_name: Cosmos DB database name. Required. + :type database_name: str + :param create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Required. + :type create_update_gremlin_database_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 GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @distributed_trace + def begin_create_update_gremlin_database( + self, + resource_group_name: str, + account_name: str, + database_name: str, + create_update_gremlin_database_parameters: Union[ + _models.GremlinDatabaseCreateUpdateParameters, _types.GremlinDatabaseCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.GremlinDatabaseGetResults]: + """Create or update an Azure Cosmos DB Gremlin database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 create_update_gremlin_database_parameters: The parameters to provide for the current + Gremlin database. Is either a GremlinDatabaseCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_gremlin_database_parameters: + ~azure.mgmt.cosmosdb.models.GremlinDatabaseCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.GremlinDatabaseCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns GremlinDatabaseGetResults. The + GremlinDatabaseGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.PartitionMetric]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinDatabaseGetResults] = 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_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + create_update_gremlin_database_parameters=create_update_gremlin_database_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinDatabaseGetResults, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GremlinDatabaseGetResults].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GremlinDatabaseGetResults]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_gremlin_database_initial( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -33625,129 +36461,15 @@ def list_metrics( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_partition_key_range_id_region_list_metrics_request( - resource_group_name=resource_group_name, - account_name=account_name, - region=region, - database_rid=database_rid, - collection_rid=collection_rid, - partition_key_range_id=partition_key_range_id, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.PartitionMetric], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.ErrorResponse, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - -class LocationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`locations` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: - """Get the properties of an existing Cosmos DB location. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - Required. - :type location: str - :return: LocationGetResult. The LocationGetResult is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult - :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 = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) - - _request = build_locations_get_request( - location=location, + _request = build_gremlin_resources_delete_gremlin_database_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33759,48 +36481,120 @@ def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: _request.url = self._client.format_url(_request.url, **path_format_arguments) _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) + _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 _stream: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.LocationGetResult, response.json()) + 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.iter_bytes() if _decompress else response.iter_raw() if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.LocationGetResult"]: - """List Cosmos DB locations and their properties. + def begin_delete_gremlin_database( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin database. - :return: An iterator like instance of LocationGetResult - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult] + :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 instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.LocationGetResult]] = 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._delete_gremlin_database_initial( + resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_gremlin_databases( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.GremlinDatabaseGetResults"]: + """Lists the Gremlin databases under an existing Azure Cosmos DB database account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 GremlinDatabaseGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinDatabaseGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinDatabaseGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -33813,7 +36607,9 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.LocationGetResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_locations_list_request( + _request = build_gremlin_resources_list_gremlin_databases_request( + resource_group_name=resource_group_name, + account_name=account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33854,7 +36650,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.LocationGetResult], + List[_models.GremlinDatabaseGetResults], deserialized.get("value", []), ) if cls: @@ -33873,7 +36669,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -33882,35 +36678,23 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class CassandraClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`cassandra_clusters` attribute. - """ - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: - """Get the properties of a managed Cassandra cluster. + def get_gremlin_graph( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> _models.GremlinGraphGetResults: + """Gets the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :return: ClusterResource. The ClusterResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: GremlinGraphGetResults. The GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinGraphGetResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -33924,11 +36708,13 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.GremlinGraphGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_get_request( + _request = build_gremlin_resources_get_gremlin_graph_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -33955,7 +36741,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -33963,18 +36749,22 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ClusterResource, response.json()) + deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_initial( + def _create_update_gremlin_graph_initial( self, resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: Union[ + _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -33993,14 +36783,16 @@ def _create_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(create_update_gremlin_graph_parameters, (IOBase, bytes)): + _content = create_update_gremlin_graph_parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_gremlin_graph_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_clusters_create_update_request( + _request = build_gremlin_resources_create_update_gremlin_graph_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34021,20 +36813,23 @@ def _create_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -34046,133 +36841,161 @@ def _create_update_initial( return deserialized # type: ignore @overload - def begin_create_update( + def begin_create_update_gremlin_graph( self, resource_group_name: str, - cluster_name: str, - body: _models.ClusterResource, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: _models.GremlinGraphCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. - Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of LROPoller that returns GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update( + def begin_create_update_gremlin_graph( self, resource_group_name: str, - cluster_name: str, - body: _types.ClusterResource, + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: _types.GremlinGraphCreateUpdateParameters, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. - Required. - :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of LROPoller that returns GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update( + def begin_create_update_gremlin_graph( self, resource_group_name: str, - cluster_name: str, - body: IO[bytes], + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. - Required. - :type body: IO[bytes] + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Required. + :type create_update_gremlin_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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :return: An instance of LROPoller that returns GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update( + def begin_create_update_gremlin_graph( self, resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + account_name: str, + database_name: str, + graph_name: str, + create_update_gremlin_graph_parameters: Union[ + _models.GremlinGraphCreateUpdateParameters, _types.GremlinGraphCreateUpdateParameters, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Create or update a managed Cassandra cluster. When updating, you must specify all writable - properties. To update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinGraphGetResults]: + """Create or update an Azure Cosmos DB Gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: The properties specifying the desired state of the managed Cassandra cluster. Is - either a ClusterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or - ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] - :return: An instance of LROPoller that returns ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param create_update_gremlin_graph_parameters: The parameters to provide for the current + Gremlin graph. Is either a GremlinGraphCreateUpdateParameters type or a IO[bytes] type. + Required. + :type create_update_gremlin_graph_parameters: + ~azure.mgmt.cosmosdb.models.GremlinGraphCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.GremlinGraphCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns GremlinGraphGetResults. The + GremlinGraphGetResults is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.GremlinGraphGetResults] = 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_initial( + raw_result = self._create_update_gremlin_graph_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - body=body, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + create_update_gremlin_graph_parameters=create_update_gremlin_graph_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34184,7 +37007,7 @@ def begin_create_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ClusterResource, response.json()) + deserialized = _deserialize(_models.GremlinGraphGetResults, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -34202,22 +37025,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ClusterResource].from_continuation_token( + return LROPoller[_models.GremlinGraphGetResults].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.ClusterResource]( + return LROPoller[_models.GremlinGraphGetResults]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], - **kwargs: Any + 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 = { 401: ClientAuthenticationError, @@ -34227,26 +37046,18 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_cassandra_clusters_update_request( + _request = build_gremlin_resources_delete_gremlin_graph_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -34263,22 +37074,24 @@ def _update_initial( 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): pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -34287,249 +37100,38 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - body: _models.ClusterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. + @distributed_trace + def begin_delete_gremlin_graph( + self, resource_group_name: str, account_name: str, database_name: str, graph_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin graph. :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: Parameters to provide for specifying the managed Cassandra cluster. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource - :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - body: _types.ClusterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: Parameters to provide for specifying the managed Cassandra cluster. Required. - :type body: ~azure.mgmt.cosmosdb.types.ClusterResource - :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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: Parameters to provide for specifying the managed Cassandra cluster. 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 ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ClusterResource]: - """Updates some of the properties of a managed Cassandra cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param body: Parameters to provide for specifying the managed Cassandra cluster. Is either a - ClusterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or - ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] - :return: An instance of LROPoller that returns ClusterResource. The ClusterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = kwargs.pop("params", {}) or {} - - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ClusterResource] = 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, - cluster_name=cluster_name, - body=body, - 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): - response = pipeline_response.http_response - deserialized = _deserialize(_models.ClusterResource, response.json()) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ClusterResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ClusterResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} - - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_cassandra_clusters_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - _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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - - 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, cluster_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a managed Cassandra cluster. - - :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 instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} 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( + raw_result = self._delete_gremlin_graph_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -34564,20 +37166,26 @@ 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 @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.ClusterResource"]: - """List all managed Cassandra clusters in this resource group. + def list_gremlin_graphs( + self, resource_group_name: str, account_name: str, database_name: str, **kwargs: Any + ) -> ItemPaged["_models.GremlinGraphGetResults"]: + """Lists the Gremlin graph under an existing Azure Cosmos DB database account. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :return: An iterator like instance of ClusterResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] + :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 GremlinGraphGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinGraphGetResults] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ClusterResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.GremlinGraphGetResults]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -34590,8 +37198,10 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_clusters_list_by_resource_group_request( + _request = build_gremlin_resources_list_gremlin_graphs_request( resource_group_name=resource_group_name, + account_name=account_name, + database_name=database_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -34632,100 +37242,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ClusterResource], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ClusterResource"]: - """List all managed Cassandra clusters in this subscription. - - :return: An iterator like instance of ClusterResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.ClusterResource]] = 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_cassandra_clusters_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) - - return _request - - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.ClusterResource], + List[_models.GremlinGraphGetResults], deserialized.get("value", []), ) if cls: @@ -34744,7 +37261,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -34753,11 +37270,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - def _invoke_command_initial( + def _retrieve_continuous_backup_information_initial( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + account_name: str, + database_name: str, + graph_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -34776,14 +37295,16 @@ def _invoke_command_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(location, (IOBase, bytes)): + _content = location else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(location, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_clusters_invoke_command_request( + _request = build_gremlin_resources_retrieve_continuous_backup_information_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -34804,7 +37325,7 @@ def _invoke_command_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + if response.status_code not in [200, 202]: try: response.read() # Load the body in memory and close the socket except (StreamConsumedError, StreamClosedError): @@ -34817,8 +37338,9 @@ def _invoke_command_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -34828,126 +37350,152 @@ def _invoke_command_initial( return deserialized # type: ignore @overload - def begin_invoke_command( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - body: _models.CommandPostBody, + account_name: str, + database_name: str, + graph_name: str, + location: _models.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.CommandPostBody + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation :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 CommandOutput. The CommandOutput is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_invoke_command( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - body: _types.CommandPostBody, + account_name: str, + database_name: str, + graph_name: str, + location: _types.ContinuousBackupRestoreLocation, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. 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.types.CommandPostBody + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation :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 CommandOutput. The CommandOutput is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_invoke_command( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - body: IO[bytes], + account_name: str, + database_name: str, + graph_name: str, + location: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. 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] + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Required. + :type location: 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 CommandOutput. The CommandOutput is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_invoke_command( + def begin_retrieve_continuous_backup_information( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + account_name: str, + database_name: str, + graph_name: str, + location: Union[_models.ContinuousBackupRestoreLocation, _types.ContinuousBackupRestoreLocation, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.CommandOutput]: - """Invoke a command like nodetool for cassandra maintenance. + ) -> LROPoller[_models.BackupInformation]: + """Retrieves continuous backup information for a gremlin graph. :param resource_group_name: The name of the resource group. The name is case insensitive. 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 CommandPostBody type or a - IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or - ~azure.mgmt.cosmosdb.types.CommandPostBody or IO[bytes] - :return: An instance of LROPoller that returns CommandOutput. The CommandOutput is compatible - with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :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 graph_name: Cosmos DB graph name. Required. + :type graph_name: str + :param location: The name of the continuous backup restore location. Is either a + ContinuousBackupRestoreLocation type or a IO[bytes] type. Required. + :type location: ~azure.mgmt.cosmosdb.models.ContinuousBackupRestoreLocation or + ~azure.mgmt.cosmosdb.types.ContinuousBackupRestoreLocation or IO[bytes] + :return: An instance of LROPoller that returns BackupInformation. The BackupInformation is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.BackupInformation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommandOutput] = kwargs.pop("cls", None) + cls: ClsType[_models.BackupInformation] = 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_initial( + raw_result = self._retrieve_continuous_backup_information_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - body=body, + account_name=account_name, + database_name=database_name, + graph_name=graph_name, + location=location, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -34958,14 +37506,10 @@ def begin_invoke_command( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - response_headers = {} response = pipeline_response.http_response - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = _deserialize(_models.CommandOutput, response.json()) + deserialized = _deserialize(_models.BackupInformation, response.json()) if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized path_format_arguments = { @@ -34981,38 +37525,132 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.CommandOutput].from_continuation_token( + return LROPoller[_models.BackupInformation].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.CommandOutput]( + return LROPoller[_models.BackupInformation]( self._client, raw_result, get_long_running_output, polling_method # 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, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + @distributed_trace + def get_gremlin_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> _models.GremlinRoleDefinitionResource: + """Retrieves the properties of an existing Azure Cosmos DB Gremlin 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: GremlinRoleDefinitionResource. The GremlinRoleDefinitionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 = kwargs.pop("params", {}) or {} + cls: ClsType[_models.GremlinRoleDefinitionResource] = kwargs.pop("cls", None) + + _request = build_gremlin_resources_get_gremlin_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_gremlin_role_definition_initial( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: Union[ + _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_deallocate_request( + content_type = content_type or "application/json" + _content = None + if isinstance(create_update_gremlin_role_definition_parameters, (IOBase, bytes)): + _content = create_update_gremlin_role_definition_parameters + else: + _content = json.dumps(create_update_gremlin_role_definition_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_gremlin_resources_create_update_gremlin_role_definition_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, - x_ms_force_deallocate=x_ms_force_deallocate, + content_type=content_type, api_version=self._config.api_version, + content=_content, headers=_headers, params=_params, ) @@ -35029,21 +37667,25 @@ def _deallocate_initial( response = pipeline_response.http_response - if response.status_code not in [202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -35052,39 +37694,154 @@ def _deallocate_initial( return deserialized # type: ignore + @overload + def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: _models.GremlinRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: _types.GremlinRoleDefinitionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource + :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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin 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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Required. + :type create_update_gremlin_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 GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + @distributed_trace - 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. + def begin_create_update_gremlin_role_definition( # pylint: disable=name-too-long + self, + resource_group_name: str, + account_name: str, + role_definition_id: str, + create_update_gremlin_role_definition_parameters: Union[ + _models.GremlinRoleDefinitionResource, _types.GremlinRoleDefinitionResource, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.GremlinRoleDefinitionResource]: + """Creates or updates an Azure Cosmos DB Gremlin Role Definition. :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 - :keyword 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. - :paramtype x_ms_force_deallocate: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] + :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_gremlin_role_definition_parameters: The properties required to create or + update a Role Definition. Is either a GremlinRoleDefinitionResource type or a IO[bytes] type. + Required. + :type create_update_gremlin_role_definition_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource or + ~azure.mgmt.cosmosdb.types.GremlinRoleDefinitionResource or IO[bytes] + :return: An instance of LROPoller that returns GremlinRoleDefinitionResource. The + GremlinRoleDefinitionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GremlinRoleDefinitionResource] = 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._deallocate_initial( + raw_result = self._create_update_gremlin_role_definition_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - x_ms_force_deallocate=x_ms_force_deallocate, + account_name=account_name, + role_definition_id=role_definition_id, + create_update_gremlin_role_definition_parameters=create_update_gremlin_role_definition_parameters, + content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35093,9 +37850,12 @@ def begin_deallocate( 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GremlinRoleDefinitionResource, response.json()) if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35110,15 +37870,19 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller[None].from_continuation_token( + return LROPoller[_models.GremlinRoleDefinitionResource].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.GremlinRoleDefinitionResource]( + 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]: + def _delete_gremlin_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, @@ -35132,9 +37896,10 @@ def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_cassandra_clusters_start_request( + _request = build_gremlin_resources_delete_gremlin_role_definition_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + role_definition_id=role_definition_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -35153,21 +37918,24 @@ def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: response = pipeline_response.http_response - if response.status_code not in [202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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.iter_bytes() if _decompress else response.iter_raw() @@ -35177,16 +37945,18 @@ def _start_initial(self, resource_group_name: str, cluster_name: str, **kwargs: return deserialized # type: ignore @distributed_trace - def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: - """Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host - virtual machine of this cluster with reserved data disk. This won't do anything on an already - running cluster. Use Deallocate to deallocate the cluster. + def begin_delete_gremlin_role_definition( + self, resource_group_name: str, account_name: str, role_definition_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin Role Definition. :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 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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -35199,9 +37969,10 @@ def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any 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._start_initial( + raw_result = self._delete_gremlin_role_definition_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, + account_name=account_name, + role_definition_id=role_definition_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35236,21 +38007,25 @@ 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 @distributed_trace - def status( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> _models.CassandraClusterPublicStatus: - """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + def list_gremlin_role_definitions( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.GremlinRoleDefinitionResource"]: + """Retrieves the list of all Azure Cosmos DB Gremlin Role Definitions. :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: CassandraClusterPublicStatus. The CassandraClusterPublicStatus is compatible with - MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of GremlinRoleDefinitionResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleDefinitionResource] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinRoleDefinitionResource]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35259,88 +38034,97 @@ def status( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) + def prepare_request(next_link=None): + if not next_link: - _request = build_cassandra_clusters_status_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_gremlin_resources_list_gremlin_role_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response = pipeline_response.http_response + return _request - if response.status_code not in [200]: - if _stream: - 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 = _failsafe_deserialize( - _models.CloudError, - response, + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinRoleDefinitionResource], + deserialized.get("value", []), ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.CassandraClusterPublicStatus, response.json()) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - return deserialized # type: ignore + 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 -class CassandraDataCentersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`cassandra_data_centers` attribute. - """ + return pipeline_response - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return ItemPaged(get_next, extract_data) @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> _models.DataCenterResource: - """Get the properties of a managed Cassandra data center. + def get_gremlin_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> _models.GremlinRoleAssignmentResource: + """Retrieves the properties of an existing Azure Cosmos DB Gremlin 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 cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :return: DataCenterResource. The DataCenterResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource + :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: GremlinRoleAssignmentResource. The GremlinRoleAssignmentResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -35354,12 +38138,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.GremlinRoleAssignmentResource] = kwargs.pop("cls", None) - _request = build_cassandra_data_centers_get_request( + _request = build_gremlin_resources_get_gremlin_role_assignment_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, + account_name=account_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -35386,7 +38170,7 @@ def get( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -35394,19 +38178,21 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.DataCenterResource, response.json()) + deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _create_update_initial( + def _create_update_gremlin_role_assignment_initial( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: Union[ + _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + ], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -35425,15 +38211,15 @@ def _create_update_initial( content_type = content_type or "application/json" _content = None - if isinstance(body, (IOBase, bytes)): - _content = body + if isinstance(create_update_gremlin_role_assignment_parameters, (IOBase, bytes)): + _content = create_update_gremlin_role_assignment_parameters else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(create_update_gremlin_role_assignment_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_cassandra_data_centers_create_update_request( + _request = build_gremlin_resources_create_update_gremlin_role_assignment_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, + account_name=account_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -35454,20 +38240,23 @@ def _create_update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 201]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 201: + 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")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) @@ -35479,143 +38268,152 @@ def _create_update_initial( return deserialized # type: ignore @overload - def begin_create_update( + def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _models.DataCenterResource, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: _models.GremlinRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource + :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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource :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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :return: An instance of LROPoller that returns GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update( + def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _types.DataCenterResource, + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: _types.GremlinRoleAssignmentResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource + :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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource :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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :return: An instance of LROPoller that returns GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_create_update( + def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: IO[bytes], + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Required. - :type body: IO[bytes] + :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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Required. + :type create_update_gremlin_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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :return: An instance of LROPoller that returns GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_create_update( + def begin_create_update_gremlin_role_assignment( # pylint: disable=name-too-long self, resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + account_name: str, + role_assignment_id: str, + create_update_gremlin_role_assignment_parameters: Union[ + _models.GremlinRoleAssignmentResource, _types.GremlinRoleAssignmentResource, IO[bytes] + ], **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Create or update a managed Cassandra data center. When updating, overwrite all properties. To - update only some properties, use PATCH. + ) -> LROPoller[_models.GremlinRoleAssignmentResource]: + """Creates or updates an Azure Cosmos DB Gremlin Role Assignment. :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters specifying the managed Cassandra data center. Is either a - DataCenterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or - ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] - :return: An instance of LROPoller that returns DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :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_gremlin_role_assignment_parameters: The properties required to create or + update a Role Assignment. Is either a GremlinRoleAssignmentResource type or a IO[bytes] type. + Required. + :type create_update_gremlin_role_assignment_parameters: + ~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource or + ~azure.mgmt.cosmosdb.types.GremlinRoleAssignmentResource or IO[bytes] + :return: An instance of LROPoller that returns GremlinRoleAssignmentResource. The + GremlinRoleAssignmentResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + cls: ClsType[_models.GremlinRoleAssignmentResource] = 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_initial( + raw_result = self._create_update_gremlin_role_assignment_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - body=body, + account_name=account_name, + role_assignment_id=role_assignment_id, + create_update_gremlin_role_assignment_parameters=create_update_gremlin_role_assignment_parameters, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -35627,7 +38425,7 @@ def begin_create_update( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.DataCenterResource, response.json()) + deserialized = _deserialize(_models.GremlinRoleAssignmentResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -35645,23 +38443,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DataCenterResource].from_continuation_token( + return LROPoller[_models.GremlinRoleAssignmentResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller[_models.DataCenterResource]( + return LROPoller[_models.GremlinRoleAssignmentResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], - **kwargs: Any + def _delete_gremlin_role_assignment_initial( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -35671,27 +38464,17 @@ def _update_initial( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - 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" - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - - _request = build_cassandra_data_centers_update_request( + _request = build_gremlin_resources_delete_gremlin_role_assignment_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, + account_name=account_name, + role_assignment_id=role_assignment_id, subscription_id=self._config.subscription_id, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -35708,22 +38491,24 @@ def _update_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, 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")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -35732,141 +38517,35 @@ def _update_initial( return deserialized # type: ignore - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _models.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource - :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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: _types.DataCenterResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Required. - :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource - :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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :param data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. 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 DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - data_center_name: str, - body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DataCenterResource]: - """Update some of the properties of a managed Cassandra data center. + def begin_delete_gremlin_role_assignment( + self, resource_group_name: str, account_name: str, role_assignment_id: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB Gremlin Role Assignment. :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :param body: Parameters to provide for specifying the managed Cassandra data center. Is either - a DataCenterResource type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or - ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] - :return: An instance of LROPoller that returns DataCenterResource. The DataCenterResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :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 None + :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DataCenterResource] = 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._update_initial( + raw_result = self._delete_gremlin_role_assignment_initial( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, - body=body, - content_type=content_type, + account_name=account_name, + role_assignment_id=role_assignment_id, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -35875,12 +38554,9 @@ def begin_update( raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = _deserialize(_models.DataCenterResource, response.json()) + 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 path_format_arguments = { "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), @@ -35895,19 +38571,166 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.DataCenterResource].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.DataCenterResource]( - 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 _delete_initial( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> Iterator[bytes]: + @distributed_trace + def list_gremlin_role_assignments( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.GremlinRoleAssignmentResource"]: + """Retrieves the list of all Azure Cosmos DB Gremlin 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 GremlinRoleAssignmentResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GremlinRoleAssignmentResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GremlinRoleAssignmentResource]] = 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_gremlin_resources_list_gremlin_role_assignments_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GremlinRoleAssignmentResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DataTransferJobsOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -35919,12 +38742,12 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) - _request = build_cassandra_data_centers_delete_request( + _request = build_data_transfer_jobs_get_request( resource_group_name=resource_group_name, - cluster_name=cluster_name, - data_center_name=data_center_name, + account_name=account_name, + job_name=job_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -35935,119 +38758,11858 @@ def _delete_initial( } _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @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. The DataTransferJobGetResults is compatible with + MutableMapping + :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: _types.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.types.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. The DataTransferJobGetResults is compatible with + MutableMapping + :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. The DataTransferJobGetResults is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.DataTransferJobGetResults + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def create( + self, + resource_group_name: str, + account_name: str, + job_name: str, + job_create_parameters: Union[_models.CreateJobRequest, _types.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 + ~azure.mgmt.cosmosdb.types.CreateJobRequest or IO[bytes] + :return: DataTransferJobGetResults. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(job_create_parameters, (IOBase, bytes)): + _content = job_create_parameters + else: + _content = json.dumps(job_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_data_transfer_jobs_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_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 DataTransferJobGetResults + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataTransferJobGetResults] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DataTransferJobGetResults]] = 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_data_transfer_jobs_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DataTransferJobGetResults], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_pause_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_resume_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_cancel_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "job_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The DataTransferJobGetResults is compatible with + MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataTransferJobGetResults] = kwargs.pop("cls", None) + + _request = build_data_transfer_jobs_complete_request( + resource_group_name=resource_group_name, + account_name=account_name, + job_name=job_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataTransferJobGetResults, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class GarnetClustersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`garnet_clusters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.GarnetClusterResource: + """Get the properties of a Garnet cache cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :return: GarnetClusterResource. The GarnetClusterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.GarnetClusterResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GarnetClusterResource] = kwargs.pop("cls", None) + + _request = build_garnet_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _create_update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResource, _types.GarnetClusterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_garnet_clusters_create_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResource + :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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.GarnetClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Required. + :type body: ~azure.mgmt.cosmosdb.types.GarnetClusterResource + :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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. 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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResource, _types.GarnetClusterResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Create or update a Garnet cache cluster. When updating, you must specify all writable + properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: Resource create parameters. Is either a GarnetClusterResource type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResource or + ~azure.mgmt.cosmosdb.types.GarnetClusterResource or IO[bytes] + :return: An instance of LROPoller that returns GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GarnetClusterResource] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GarnetClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GarnetClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResourcePatch, _types.GarnetClusterResourcePatch, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_garnet_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch + :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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.GarnetClusterResourcePatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Required. + :type body: ~azure.mgmt.cosmosdb.types.GarnetClusterResourcePatch + :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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. 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 GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.GarnetClusterResourcePatch, _types.GarnetClusterResourcePatch, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GarnetClusterResource]: + """Updates some of the properties of a garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :param body: The resource properties to be updated. Is either a GarnetClusterResourcePatch type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.GarnetClusterResourcePatch or + ~azure.mgmt.cosmosdb.types.GarnetClusterResourcePatch or IO[bytes] + :return: An instance of LROPoller that returns GarnetClusterResource. The GarnetClusterResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GarnetClusterResource] = 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, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.GarnetClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GarnetClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GarnetClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _delete_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_garnet_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Garnet cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the GarnetClusterResource. Required. + :type cluster_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cluster_name=cluster_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.GarnetClusterResource"]: + """List all Garnet clusters in this 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 GarnetClusterResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GarnetClusterResource]] = 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_garnet_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GarnetClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.GarnetClusterResource"]: + """List all Garnet clusters in this subscription. + + :return: An iterator like instance of GarnetClusterResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.GarnetClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.GarnetClusterResource]] = 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_garnet_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.GarnetClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=docstring-missing-param,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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "account_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_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 NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "account_name", + "network_security_perimeter_configuration_name", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class NotebookWorkspacesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`notebook_workspaces` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> _models.NotebookWorkspace: + """Gets the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: NotebookWorkspace. The NotebookWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspace + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotebookWorkspace] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: Union[ + _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(notebook_create_update_parameters, (IOBase, bytes)): + _content = notebook_create_update_parameters + else: + _content = json.dumps(notebook_create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_notebook_workspaces_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: _models.NotebookWorkspaceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters + :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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: _types.NotebookWorkspaceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters + :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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Required. + :type notebook_create_update_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 NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + notebook_create_update_parameters: Union[ + _models.NotebookWorkspaceCreateUpdateParameters, _types.NotebookWorkspaceCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.NotebookWorkspace]: + """Creates the notebook workspace for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :param notebook_create_update_parameters: The notebook workspace to create for the current + database account. Is either a NotebookWorkspaceCreateUpdateParameters type or a IO[bytes] type. + Required. + :type notebook_create_update_parameters: + ~azure.mgmt.cosmosdb.models.NotebookWorkspaceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.NotebookWorkspaceCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns NotebookWorkspace. The NotebookWorkspace is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotebookWorkspace] = 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, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + notebook_create_update_parameters=notebook_create_update_parameters, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.NotebookWorkspace, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.NotebookWorkspace].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NotebookWorkspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the notebook workspace for a 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 + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.NotebookWorkspace"]: + """Gets the notebook workspace resources of an existing Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 NotebookWorkspace + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.NotebookWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NotebookWorkspace]] = 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_notebook_workspaces_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NotebookWorkspace], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_connection_info( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> _models.NotebookWorkspaceConnectionInfoResult: + """Retrieves the connection info for the notebook workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: NotebookWorkspaceConnectionInfoResult. The NotebookWorkspaceConnectionInfoResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.NotebookWorkspaceConnectionInfoResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotebookWorkspaceConnectionInfoResult] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_list_connection_info_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NotebookWorkspaceConnectionInfoResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _regenerate_auth_token_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_regenerate_auth_token_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_regenerate_auth_token( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> LROPoller[None]: + """Regenerates the auth token for the notebook workspace. + + :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 notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._regenerate_auth_token_initial( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _start_initial( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_notebook_workspaces_start_request( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + account_name: str, + notebook_workspace_name: Union[str, _models.NotebookWorkspaceName], + **kwargs: Any + ) -> LROPoller[None]: + """Starts the notebook workspace. + + :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 notebook_workspace_name: The name of the notebook workspace resource. "default" + Required. + :type notebook_workspace_name: str or ~azure.mgmt.cosmosdb.models.NotebookWorkspaceName + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._start_initial( + resource_group_name=resource_group_name, + account_name=account_name, + notebook_workspace_name=notebook_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class PrivateEndpointConnectionsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :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 private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: _types.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection + :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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, _types.PrivateEndpointConnection, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.cosmosdb.models.PrivateEndpointConnection or + ~azure.mgmt.cosmosdb.types.PrivateEndpointConnection or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = 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, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + parameters=parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, private_endpoint_connection_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, account_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection with a given 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 private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_database_account( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections on a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = 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_private_endpoint_connections_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateLinkResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link resources that need to be created for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.PrivateLinkResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_private_link_resources_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + 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 + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a Cosmos DB account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = 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_private_link_resources_list_by_database_account_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SoftDeletedDatabaseAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`soft_deleted_database_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def get( + self, resource_group_name: str, location: str, account_name: str, **kwargs: Any + ) -> _models.SoftDeletedDatabaseAccountGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB database account by location and + accountName. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: SoftDeletedDatabaseAccountGetResult. The SoftDeletedDatabaseAccountGetResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={"2026-04-01-preview": ["api_version", "subscription_id", "location", "accept"]}, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_location(self, location: str, **kwargs: Any) -> _models.SoftDeletedDatabaseAccountsListResult: + """Lists all the soft-deleted Azure Cosmos DB database accounts available under the subscription + and in a region. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param location: The name of the Azure region. Required. + :type location: str + :return: SoftDeletedDatabaseAccountsListResult. The SoftDeletedDatabaseAccountsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountsListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["subscription_id", "resource_group_name", "location", "api_version", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_by_resource_group_and_location( + self, resource_group_name: str, location: str, **kwargs: Any + ) -> _models.SoftDeletedDatabaseAccountsListResult: + """Lists all the soft-deleted Azure Cosmos DB database accounts available under the given resource + group and in a region. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/read' permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :return: SoftDeletedDatabaseAccountsListResult. The SoftDeletedDatabaseAccountsListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedDatabaseAccountsListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedDatabaseAccountsListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_list_by_resource_group_and_location_request( + resource_group_name=resource_group_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedDatabaseAccountsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Restores a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_database_accounts_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Permanently deletes (purges) a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class SoftDeletedSqlDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`soft_deleted_sql_databases` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def get( + self, resource_group_name: str, location: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlDatabaseGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB SQL database. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :return: SoftDeletedSqlDatabaseGetResult. The SoftDeletedSqlDatabaseGetResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabaseGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlDatabaseGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlDatabaseGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list( + self, resource_group_name: str, location: str, account_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlDatabasesListResult: + """Lists all the soft-deleted Azure Cosmos DB SQL databases under a soft-deleted database account. + This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: SoftDeletedSqlDatabasesListResult. The SoftDeletedSqlDatabasesListResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlDatabasesListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlDatabasesListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_list_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlDatabasesListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Restores a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_databases_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Permanently deletes a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class SoftDeletedSqlContainersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`soft_deleted_sql_containers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def get( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + **kwargs: Any + ) -> _models.SoftDeletedSqlContainerGetResult: + """Retrieves the properties of a soft-deleted Azure Cosmos DB SQL container. This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/softDeletedSqlContainers/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :return: SoftDeletedSqlContainerGetResult. The SoftDeletedSqlContainerGetResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainerGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlContainerGetResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_get_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlContainerGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list( + self, resource_group_name: str, location: str, account_name: str, database_name: str, **kwargs: Any + ) -> _models.SoftDeletedSqlContainersListResult: + """Lists all the soft-deleted Azure Cosmos DB SQL containers under a soft-deleted SQL database. + This call requires + 'Microsoft.DocumentDB/locations/softDeletedDatabaseAccounts/softDeletedSqlDatabases/softDeletedSqlContainers/read' + permission. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :return: SoftDeletedSqlContainersListResult. The SoftDeletedSqlContainersListResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.SoftDeletedSqlContainersListResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SoftDeletedSqlContainersListResult] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_list_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SoftDeletedSqlContainersListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _restore_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_restore_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_restore( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Restores a soft-deleted Azure Cosmos DB SQL container to active state. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._restore_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _purge_initial( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = 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 = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_soft_deleted_sql_containers_purge_request( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + subscription_id=self._config.subscription_id, + soft_delete_action_kind=soft_delete_action_kind, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "subscription_id", + "resource_group_name", + "location", + "account_name", + "database_name", + "container_name", + "api_version", + "soft_delete_action_kind", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_purge( + self, + resource_group_name: str, + location: str, + account_name: str, + database_name: str, + container_name: str, + *, + soft_delete_action_kind: Optional[Union[str, _models.SoftDeleteActionKind]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Permanently deletes a soft-deleted 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 location: The name of the Azure region. Required. + :type location: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_name: Cosmos DB SQL database name. Required. + :type database_name: str + :param container_name: Cosmos DB SQL container name. Required. + :type container_name: str + :keyword soft_delete_action_kind: The kind of soft delete action to perform. Known values are: + "RestoreSoftDeletedResource" and "PermanentDeleteResource". Default value is None. + :paramtype soft_delete_action_kind: str or ~azure.mgmt.cosmosdb.models.SoftDeleteActionKind + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._purge_initial( + resource_group_name=resource_group_name, + location=location, + account_name=account_name, + database_name=database_name, + container_name=container_name, + soft_delete_action_kind=soft_delete_action_kind, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + +class ChaosFaultOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The ChaosFaultResource is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChaosFaultResource] = kwargs.pop("cls", None) + + _request = build_chaos_fault_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChaosFaultResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _enable_disable_initial( + self, + resource_group_name: str, + account_name: str, + chaos_fault: str, + chaos_fault_request: Union[_models.ChaosFaultResource, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(chaos_fault_request, (IOBase, bytes)): + _content = chaos_fault_request + else: + _content = json.dumps(chaos_fault_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_chaos_fault_enable_disable_request( + resource_group_name=resource_group_name, + account_name=account_name, + chaos_fault=chaos_fault, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # 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 ChaosFaultResource. The ChaosFaultResource is + compatible with MutableMapping + :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: _types.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.types.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 ChaosFaultResource. The ChaosFaultResource is + compatible with MutableMapping + :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 ChaosFaultResource. The ChaosFaultResource is + compatible with MutableMapping + :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, _types.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 + ~azure.mgmt.cosmosdb.types.ChaosFaultResource or IO[bytes] + :return: An instance of LROPoller that returns ChaosFaultResource. The ChaosFaultResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ChaosFaultResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 list( + self, resource_group_name: str, account_name: str, **kwargs: Any + ) -> ItemPaged["_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 ChaosFaultResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ChaosFaultResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChaosFaultResource]] = 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_chaos_fault_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChaosFaultResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DatabaseOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`database` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, database_rid: str, *, filter: str, **kwargs: Any + ) -> ItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and + 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_database_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.Usage"]: + """Retrieves the usages (most recent data) for the given database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = 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_database_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_metric_definitions( + self, resource_group_name: str, account_name: str, database_rid: str, **kwargs: Any + ) -> ItemPaged["_models.MetricDefinition"]: + """Retrieves metric definitions for the given 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :return: An iterator like instance of MetricDefinition + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricDefinition]] = 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_database_list_metric_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MetricDefinition], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CollectionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and + 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_collection_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.Usage"]: + """Retrieves the usages (most recent storage data) for the given collection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of Usage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Usage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Usage]] = 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_collection_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Usage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_metric_definitions( + self, resource_group_name: str, account_name: str, database_rid: str, collection_rid: str, **kwargs: Any + ) -> ItemPaged["_models.MetricDefinition"]: + """Retrieves metric definitions for the given 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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :return: An iterator like instance of MetricDefinition + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.MetricDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MetricDefinition]] = 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_collection_list_metric_definitions_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.MetricDefinition], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CollectionRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account, collection + and region. + + :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 region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_collection_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class DatabaseAccountRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`database_account_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, region: str, *, filter: str, **kwargs: Any + ) -> ItemPaged["_models.Metric"]: + """Retrieves the metrics determined by the given filter for the given database account and region. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of Metric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.Metric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Metric]] = 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_database_account_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Metric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PercentileSourceTargetOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile_source_target` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + source_region: str, + target_region: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given account, source and target + region. This url is only for PBS and Replication Latency data. + + :param resource_group_name: 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 source_region: Source region from which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type source_region: str + :param target_region: Target region to which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type target_region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_source_target_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + source_region=source_region, + target_region=target_region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PercentileMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PercentileTargetOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile_target` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, target_region: str, *, filter: str, **kwargs: Any + ) -> ItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given account target region. This + url is only for PBS and Replication Latency data. + + :param resource_group_name: 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 target_region: Target region to which data is written. Cosmos DB region, with spaces + between words and each word capitalized. Required. + :type target_region: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_target_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + target_region=target_region, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PercentileMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PercentileOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`percentile` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, resource_group_name: str, account_name: str, *, filter: str, **kwargs: Any + ) -> ItemPaged["_models.PercentileMetric"]: + """Retrieves the metrics determined by the given filter for the given database account. This url + is only for PBS and Replication Latency data. + + :param resource_group_name: 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 + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PercentileMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PercentileMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PercentileMetric]] = 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_percentile_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PercentileMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CollectionPartitionRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_partition_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given collection and region, split + by partition. + + :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 region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_collection_partition_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CollectionPartitionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`collection_partition` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given collection, split by + partition. + + :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_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_collection_partition_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + *, + filter: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.PartitionUsage"]: + """Retrieves the usages (most recent storage data) for the given collection, split by partition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :keyword filter: An OData filter expression that describes a subset of usages to return. The + supported parameter is name.value (name of the metric, can have an or of multiple names). + Default value is None. + :paramtype filter: str + :return: An iterator like instance of PartitionUsage + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionUsage] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionUsage]] = 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_collection_partition_list_usages_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionUsage], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PartitionKeyRangeIdOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`partition_key_range_id` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + database_rid: str, + collection_rid: str, + partition_key_range_id: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given partition key range id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get data. Required. + :type partition_key_range_id: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_partition_key_range_id_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + database_rid=database_rid, + collection_rid=collection_rid, + partition_key_range_id=partition_key_range_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PartitionKeyRangeIdRegionOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`partition_key_range_id_region` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_metrics( + self, + resource_group_name: str, + account_name: str, + region: str, + database_rid: str, + collection_rid: str, + partition_key_range_id: str, + *, + filter: str, + **kwargs: Any + ) -> ItemPaged["_models.PartitionMetric"]: + """Retrieves the metrics determined by the given filter for the given partition key range id and + region. + + :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 region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :type region: str + :param database_rid: Cosmos DB database rid. Required. + :type database_rid: str + :param collection_rid: Cosmos DB collection rid. Required. + :type collection_rid: str + :param partition_key_range_id: Partition Key Range Id for which to get data. Required. + :type partition_key_range_id: str + :keyword filter: An OData filter expression that describes a subset of metrics to return. The + parameters that can be filtered are name.value (name of the metric, can have an or of multiple + names), startTime, endTime, and timeGrain. The supported operator is eq. Required. + :paramtype filter: str + :return: An iterator like instance of PartitionMetric + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.PartitionMetric] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PartitionMetric]] = 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_partition_key_range_id_region_list_metrics_request( + resource_group_name=resource_group_name, + account_name=account_name, + region=region, + database_rid=database_rid, + collection_rid=collection_rid, + partition_key_range_id=partition_key_range_id, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PartitionMetric], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class LocationsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`locations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, location: str, **kwargs: Any) -> _models.LocationGetResult: + """Get the properties of an existing Cosmos DB location. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :return: LocationGetResult. The LocationGetResult is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.LocationGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.LocationGetResult] = kwargs.pop("cls", None) + + _request = build_locations_get_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LocationGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.LocationGetResult"]: + """List Cosmos DB locations and their properties. + + :return: An iterator like instance of LocationGetResult + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.LocationGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LocationGetResult]] = 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_locations_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.LocationGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CassandraClustersOperations: # pylint: disable=docstring-missing-param,too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_clusters` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ClusterResource: + """Get the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: ClusterResource. The ClusterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ClusterResource] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ClusterResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_create_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + Required. + :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. + 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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Create or update a managed Cassandra cluster. When updating, you must specify all writable + properties. To update only some properties, use PATCH. + + :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: The properties specifying the desired state of the managed Cassandra cluster. Is + either a ClusterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or + ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] + :return: An instance of LROPoller that returns ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _models.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: _types.ClusterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. Required. + :type body: ~azure.mgmt.cosmosdb.types.ClusterResource + :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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. 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 ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.ClusterResource, _types.ClusterResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ClusterResource]: + """Updates some of the properties of a managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param body: Parameters to provide for specifying the managed Cassandra cluster. Is either a + ClusterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.ClusterResource or + ~azure.mgmt.cosmosdb.types.ClusterResource or IO[bytes] + :return: An instance of LROPoller that returns ClusterResource. The ClusterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ClusterResource] = 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, + cluster_name=cluster_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ClusterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ClusterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ClusterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a managed Cassandra cluster. + + :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 instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cluster_name=cluster_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.ClusterResource"]: + """List all managed Cassandra clusters in this 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 ClusterResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterResource]] = 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_cassandra_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.ClusterResource"]: + """List all managed Cassandra clusters in this subscription. + + :return: An iterator like instance of ClusterResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ClusterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ClusterResource]] = 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_cassandra_clusters_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ClusterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _invoke_command_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandPostBody, _types.CommandPostBody, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_invoke_command_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: _models.CommandPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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.CommandPostBody + :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 CommandOutput. The CommandOutput is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: _types.CommandPostBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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.types.CommandPostBody + :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 CommandOutput. The CommandOutput is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 CommandOutput. The CommandOutput is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_invoke_command( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandPostBody, _types.CommandPostBody, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CommandOutput]: + """Invoke a command like nodetool for cassandra maintenance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + 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 CommandPostBody type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.CommandPostBody or + ~azure.mgmt.cosmosdb.types.CommandPostBody or IO[bytes] + :return: An instance of LROPoller that returns CommandOutput. The CommandOutput is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandOutput] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommandOutput] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + body=body, + 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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.CommandOutput, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CommandOutput].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CommandOutput]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def _invoke_command_async_initial( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, _types.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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_clusters_invoke_command_async_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 CommandPublicResource. The CommandPublicResource + is compatible with MutableMapping + :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: _types.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.types.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 CommandPublicResource. The CommandPublicResource + is compatible with MutableMapping + :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 CommandPublicResource. The CommandPublicResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + def begin_invoke_command_async( + self, + resource_group_name: str, + cluster_name: str, + body: Union[_models.CommandAsyncPostBody, _types.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 + ~azure.mgmt.cosmosdb.types.CommandAsyncPostBody or IO[bytes] + :return: An instance of LROPoller that returns CommandPublicResource. The CommandPublicResource + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommandPublicResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_command( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> ItemPaged["_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 CommandPublicResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.CommandPublicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommandPublicResource]] = 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_cassandra_clusters_list_command_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommandPublicResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "command_id", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The CommandPublicResource is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommandPublicResource] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommandPublicResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": ["api_version", "subscription_id", "resource_group_name", "cluster_name", "accept"] + }, + api_versions_list=["2026-04-01-preview"], + ) + def list_backups( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> ItemPaged["_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 BackupResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.BackupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.BackupResource]] = 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_cassandra_clusters_list_backups_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.BackupResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-04-01-preview", + params_added_on={ + "2026-04-01-preview": [ + "api_version", + "subscription_id", + "resource_group_name", + "cluster_name", + "backup_id", + "accept", + ] + }, + api_versions_list=["2026-04-01-preview"], + ) + 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. The BackupResource is compatible with MutableMapping + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.BackupResource] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.BackupResource, response.json()) + + 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, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_deallocate_request( + 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=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + 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. + + :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 + :keyword 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. + :paramtype x_ms_force_deallocate: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._deallocate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + x_ms_force_deallocate=x_ms_force_deallocate, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 _start_initial(self, resource_group_name: str, cluster_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_start_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host + virtual machine of this cluster with reserved data disk. This won't do anything on an already + running cluster. Use Deallocate to deallocate the cluster. + + :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 instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 status( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> _models.CassandraClusterPublicStatus: + """Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: CassandraClusterPublicStatus. The CassandraClusterPublicStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.CassandraClusterPublicStatus + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CassandraClusterPublicStatus] = kwargs.pop("cls", None) + + _request = build_cassandra_clusters_status_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CassandraClusterPublicStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CassandraDataCentersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`cassandra_data_centers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any + ) -> _models.DataCenterResource: + """Get the properties of a managed Cassandra data center. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :return: DataCenterResource. The DataCenterResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.DataCenterResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.DataCenterResource] = kwargs.pop("cls", None) + + _request = build_cassandra_data_centers_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.DataCenterResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_update_initial( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_data_centers_create_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: _models.DataCenterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. + + :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 data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource + :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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: _types.DataCenterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. + + :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 data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource + :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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. + + :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 data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. 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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Create or update a managed Cassandra data center. When updating, overwrite all properties. To + update only some properties, use PATCH. + + :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 data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters specifying the managed Cassandra data center. Is either a + DataCenterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or + ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] + :return: An instance of LROPoller that returns DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = 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_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DataCenterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DataCenterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DataCenterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cassandra_data_centers_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: _models.DataCenterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource + :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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: _types.DataCenterResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Required. + :type body: ~azure.mgmt.cosmosdb.types.DataCenterResource + :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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. 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 DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + data_center_name: str, + body: Union[_models.DataCenterResource, _types.DataCenterResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DataCenterResource]: + """Update some of the properties of a managed Cassandra data center. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :param data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :param body: Parameters to provide for specifying the managed Cassandra data center. Is either + a DataCenterResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.DataCenterResource or + ~azure.mgmt.cosmosdb.types.DataCenterResource or IO[bytes] + :return: An instance of LROPoller that returns DataCenterResource. The DataCenterResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DataCenterResource] = 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, + cluster_name=cluster_name, + data_center_name=data_center_name, + body=body, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.DataCenterResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DataCenterResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DataCenterResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, data_center_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cassandra_data_centers_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + data_center_name=data_center_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, cluster_name: str, data_center_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a managed Cassandra data center. + + :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 data_center_name: Data center name in a managed Cassandra cluster. Required. + :type data_center_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cluster_name=cluster_name, + data_center_name=data_center_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> ItemPaged["_models.DataCenterResource"]: + """List all data centers in a particular managed Cassandra cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: Managed Cassandra cluster name. Required. + :type cluster_name: str + :return: An iterator like instance of DataCenterResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.DataCenterResource]] = 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_cassandra_data_centers_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DataCenterResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorableDatabaseAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_database_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get_by_location( + self, location: str, instance_id: str, **kwargs: Any + ) -> _models.RestorableDatabaseAccountGetResult: + """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: RestorableDatabaseAccountGetResult. The RestorableDatabaseAccountGetResult is + compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) + + _request = build_restorable_database_accounts_get_by_location_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.RestorableDatabaseAccountGetResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.RestorableDatabaseAccountGetResult"]: + """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and + in a region. This call requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :return: An iterator like instance of RestorableDatabaseAccountGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = 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_restorable_database_accounts_list_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableDatabaseAccountGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.RestorableDatabaseAccountGetResult"]: + """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. + This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + + :return: An iterator like instance of RestorableDatabaseAccountGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = 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_restorable_database_accounts_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableDatabaseAccountGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorableSqlDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_databases` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, location: str, instance_id: str, **kwargs: Any + ) -> ItemPaged["_models.RestorableSqlDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the + restorable account. This helps in scenario where database was accidentally deleted to get the + deletion time. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: An iterator like instance of RestorableSqlDatabaseGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableSqlDatabaseGetResult]] = 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_restorable_sql_databases_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlDatabaseGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorableSqlContainersOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_containers` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + location: str, + instance_id: str, + *, + restorable_sql_database_rid: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableSqlContainerGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a + specific database. This helps in scenario where container was accidentally deleted. This API + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restorable_sql_database_rid: The resource ID of the SQL database. Default value is + None. + :paramtype restorable_sql_database_rid: str + :keyword start_time: Restorable Sql containers event feed start time. Default value is None. + :paramtype start_time: str + :keyword end_time: Restorable Sql containers event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableSqlContainerGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableSqlContainerGetResult]] = 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_restorable_sql_containers_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + restorable_sql_database_rid=restorable_sql_database_rid, + start_time=start_time, + end_time=end_time, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlContainerGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RestorableSqlResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_sql_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + location: str, + instance_id: str, + *, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableSqlResourcesGetResult"]: + """Return a list of database and container combo that exist on the account at the given timestamp + and location. This helps in scenarios to validate what resources exist at given timestamp and + location. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableSqlResourcesGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableSqlResourcesGetResult]] = 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: - response = pipeline_response.http_response + _request = build_restorable_sql_resources_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + return _request - deserialized = response.iter_bytes() if _decompress else response.iter_raw() + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableSqlResourcesGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore + def get_next(next_link=None): + _request = prepare_request(next_link) - return deserialized # type: ignore + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - @distributed_trace - def begin_delete( - self, resource_group_name: str, cluster_name: str, data_center_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Delete a managed Cassandra data center. + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - :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 data_center_name: Data center name in a managed Cassandra cluster. Required. - :type data_center_name: str - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + return pipeline_response - 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, - cluster_name=cluster_name, - data_center_name=data_center_name, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) + return ItemPaged(get_next, extract_data) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } +class RestorableMongodbDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_databases` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> ItemPaged["_models.DataCenterResource"]: - """List all data centers in a particular managed Cassandra cluster. + self, location: str, instance_id: str, **kwargs: Any + ) -> ItemPaged["_models.RestorableMongodbDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under + the restorable account. This helps in scenario where database was accidentally deleted to get + the deletion time. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :param resource_group_name: The name of the resource group. The name is case insensitive. + :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. - :type resource_group_name: str - :param cluster_name: Managed Cassandra cluster name. Required. - :type cluster_name: str - :return: An iterator like instance of DataCenterResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.DataCenterResource] + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: An iterator like instance of RestorableMongodbDatabaseGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.DataCenterResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableMongodbDatabaseGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36060,9 +50622,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_cassandra_data_centers_list_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, + _request = build_restorable_mongodb_databases_list_request( + location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36103,7 +50665,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.DataCenterResource], + List[_models.RestorableMongodbDatabaseGetResult], deserialized.get("value", []), ) if cls: @@ -36132,14 +50694,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableDatabaseAccountsOperations: +class RestorableMongodbCollectionsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_database_accounts` attribute. + :attr:`restorable_mongodb_collections` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36150,22 +50712,43 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get_by_location( - self, location: str, instance_id: str, **kwargs: Any - ) -> _models.RestorableDatabaseAccountGetResult: - """Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' permission. + def list( + self, + location: str, + instance_id: str, + *, + restorable_mongodb_database_rid: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableMongodbCollectionGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under + a specific database. This helps in scenario where container was accidentally deleted. This + API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: RestorableDatabaseAccountGetResult. The RestorableDatabaseAccountGetResult is - compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult + :keyword restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default + value is None. + :paramtype restorable_mongodb_database_rid: str + :keyword start_time: Restorable MongoDB collections event feed start time. Default value is + None. + :paramtype start_time: str + :keyword end_time: Restorable MongoDB collections event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableMongodbCollectionGetResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.RestorableMongodbCollectionGetResult]] = kwargs.pop("cls", None) + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -36174,73 +50757,136 @@ def get_by_location( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} + def prepare_request(next_link=None): + if not next_link: - cls: ClsType[_models.RestorableDatabaseAccountGetResult] = kwargs.pop("cls", None) + _request = build_restorable_mongodb_collections_list_request( + location=location, + instance_id=instance_id, + subscription_id=self._config.subscription_id, + restorable_mongodb_database_rid=restorable_mongodb_database_rid, + start_time=start_time, + end_time=end_time, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _request = build_restorable_database_accounts_get_by_location_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _decompress = kwargs.pop("decompress", True) - _stream = kwargs.pop("stream", False) - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.RestorableMongodbCollectionGetResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) - if response.status_code not in [200]: - if _stream: - 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 = _failsafe_deserialize( - _models.CloudError, - response, + 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 ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response = pipeline_response.http_response - if _stream: - deserialized = response.iter_bytes() if _decompress else response.iter_raw() - else: - deserialized = _deserialize(_models.RestorableDatabaseAccountGetResult, response.json()) + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return pipeline_response - return deserialized # type: ignore + return ItemPaged(get_next, extract_data) + + +class RestorableMongodbResourcesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_mongodb_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.RestorableDatabaseAccountGetResult"]: - """Lists all the restorable Azure Cosmos DB database accounts available under the subscription and - in a region. This call requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + def list( + self, + location: str, + instance_id: str, + *, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableMongodbResourcesGetResult"]: + """Return a list of database and collection combo that exist on the account at the given timestamp + and location. This helps in scenarios to validate what resources exist at given timestamp and + location. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str - :return: An iterator like instance of RestorableDatabaseAccountGetResult + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableMongodbResourcesGetResult :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableMongodbResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36253,9 +50899,12 @@ def list_by_location(self, location: str, **kwargs: Any) -> ItemPaged["_models.R def prepare_request(next_link=None): if not next_link: - _request = build_restorable_database_accounts_list_by_location_request( + _request = build_restorable_mongodb_resources_list_request( location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36295,7 +50944,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableDatabaseAccountGetResult], + List[_models.RestorableMongodbResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -36323,20 +50972,47 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) + +class RestorableGremlinDatabasesOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`restorable_gremlin_databases` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.RestorableDatabaseAccountGetResult"]: - """Lists all the restorable Azure Cosmos DB database accounts available under the subscription. - This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read' permission. + def list( + self, location: str, instance_id: str, **kwargs: Any + ) -> ItemPaged["_models.RestorableGremlinDatabaseGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under + the restorable account. This helps in scenario where database was accidentally deleted to get + the deletion time. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - :return: An iterator like instance of RestorableDatabaseAccountGetResult + :param location: Cosmos DB region, with spaces between words and each word capitalized. + Required. + :type location: str + :param instance_id: The instanceId GUID of a restorable database account. Required. + :type instance_id: str + :return: An iterator like instance of RestorableGremlinDatabaseGetResult :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableDatabaseAccountGetResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableDatabaseAccountGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinDatabaseGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36349,7 +51025,9 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.RestorableDatabaseAccountGet def prepare_request(next_link=None): if not next_link: - _request = build_restorable_database_accounts_list_request( + _request = build_restorable_gremlin_databases_list_request( + location=location, + instance_id=instance_id, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -36390,7 +51068,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableDatabaseAccountGetResult], + List[_models.RestorableGremlinDatabaseGetResult], deserialized.get("value", []), ) if cls: @@ -36419,14 +51097,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableSqlDatabasesOperations: +class RestorableGremlinGraphsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_sql_databases` attribute. + :attr:`restorable_gremlin_graphs` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36438,27 +51116,40 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( - self, location: str, instance_id: str, **kwargs: Any - ) -> ItemPaged["_models.RestorableSqlDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the - restorable account. This helps in scenario where database was accidentally deleted to get the - deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + self, + location: str, + instance_id: str, + *, + restorable_gremlin_database_rid: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableGremlinGraphGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a + specific database. This helps in scenario where container was accidentally deleted. This API + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: An iterator like instance of RestorableSqlDatabaseGetResult + :keyword restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default + value is None. + :paramtype restorable_gremlin_database_rid: str + :keyword start_time: Restorable Gremlin graphs event feed start time. Default value is None. + :paramtype start_time: str + :keyword end_time: Restorable Gremlin graphs event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableGremlinGraphGetResult :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlDatabaseGetResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlDatabaseGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinGraphGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36471,10 +51162,13 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_databases_list_request( + _request = build_restorable_gremlin_graphs_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, + restorable_gremlin_database_rid=restorable_gremlin_database_rid, + start_time=start_time, + end_time=end_time, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36514,7 +51208,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlDatabaseGetResult], + List[_models.RestorableGremlinGraphGetResult], deserialized.get("value", []), ) if cls: @@ -36543,14 +51237,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableSqlContainersOperations: +class RestorableGremlinResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_sql_containers` attribute. + :attr:`restorable_gremlin_resources` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36566,36 +51260,35 @@ def list( location: str, instance_id: str, *, - restorable_sql_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.RestorableSqlContainerGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a - specific database. This helps in scenario where container was accidentally deleted. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> ItemPaged["_models.RestorableGremlinResourcesGetResult"]: + """Return a list of gremlin database and graphs combo that exist on the account at the given + timestamp and location. This helps in scenarios to validate what resources exist at given + timestamp and location. This API requires + 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :keyword restorable_sql_database_rid: The resource ID of the SQL database. Default value is - None. - :paramtype restorable_sql_database_rid: str - :keyword start_time: Restorable Sql containers event feed start time. Default value is None. - :paramtype start_time: str - :keyword end_time: Restorable Sql containers event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableSqlContainerGetResult + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableGremlinResourcesGetResult :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlContainerGetResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlContainerGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableGremlinResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36608,13 +51301,12 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_containers_list_request( + _request = build_restorable_gremlin_resources_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, - restorable_sql_database_rid=restorable_sql_database_rid, - start_time=start_time, - end_time=end_time, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36654,7 +51346,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlContainerGetResult], + List[_models.RestorableGremlinResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -36683,14 +51375,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableSqlResourcesOperations: +class RestorableTablesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_sql_resources` attribute. + :attr:`restorable_tables` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36706,13 +51398,12 @@ def list( location: str, instance_id: str, *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.RestorableSqlResourcesGetResult"]: - """Return a list of database and container combo that exist on the account at the given timestamp - and location. This helps in scenarios to validate what resources exist at given timestamp and - location. This API requires + ) -> ItemPaged["_models.RestorableTableGetResult"]: + """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in + scenario where table was accidentally deleted. This API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. @@ -36720,21 +51411,18 @@ def list( :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableSqlResourcesGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableSqlResourcesGetResult] + :keyword start_time: Restorable Tables event feed start time. Default value is None. + :paramtype start_time: str + :keyword end_time: Restorable Tables event feed end time. Default value is None. + :paramtype end_time: str + :return: An iterator like instance of RestorableTableGetResult + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableSqlResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableTableGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36747,12 +51435,12 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_sql_resources_list_request( + _request = build_restorable_tables_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, + start_time=start_time, + end_time=end_time, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36792,7 +51480,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableSqlResourcesGetResult], + List[_models.RestorableTableGetResult], deserialized.get("value", []), ) if cls: @@ -36821,14 +51509,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableMongodbDatabasesOperations: +class RestorableTableResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_databases` attribute. + :attr:`restorable_table_resources` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36840,27 +51528,38 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list( - self, location: str, instance_id: str, **kwargs: Any - ) -> ItemPaged["_models.RestorableMongodbDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + self, + location: str, + instance_id: str, + *, + restore_location: Optional[str] = None, + restore_timestamp_in_utc: Optional[str] = None, + **kwargs: Any + ) -> ItemPaged["_models.RestorableTableResourcesGetResult"]: + """Return a list of tables that exist on the account at the given timestamp and location. This + helps in scenarios to validate what resources exist at given timestamp and location. This API + requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. :param location: Cosmos DB region, with spaces between words and each word capitalized. Required. :type location: str :param instance_id: The instanceId GUID of a restorable database account. Required. :type instance_id: str - :return: An iterator like instance of RestorableMongodbDatabaseGetResult + :keyword restore_location: The location where the restorable resources are located. Default + value is None. + :paramtype restore_location: str + :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default + value is None. + :paramtype restore_timestamp_in_utc: str + :return: An iterator like instance of RestorableTableResourcesGetResult :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbDatabaseGetResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbDatabaseGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.RestorableTableResourcesGetResult]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -36873,10 +51572,12 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_mongodb_databases_list_request( + _request = build_restorable_table_resources_list_request( location=location, instance_id=instance_id, subscription_id=self._config.subscription_id, + restore_location=restore_location, + restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -36916,7 +51617,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableMongodbDatabaseGetResult], + List[_models.RestorableTableResourcesGetResult], deserialized.get("value", []), ) if cls: @@ -36945,14 +51646,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableMongodbCollectionsOperations: +class ServiceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_collections` attribute. + :attr:`service` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -36963,43 +51664,340 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( + def get( + self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + ) -> _models.ServiceResource: + """Gets the status of service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + + _request = build_service_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( self, - location: str, - instance_id: str, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: Union[ + _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(create_update_parameters, (IOBase, bytes)): + _content = create_update_parameters + else: + _content = json.dumps(create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_service_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: _models.ServiceResourceCreateUpdateParameters, *, - restorable_mongodb_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.RestorableMongodbCollectionGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under - a specific database. This helps in scenario where container was accidentally deleted. This - API requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> LROPoller[_models.ServiceResource]: + """Creates a service. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restorable_mongodb_database_rid: The resource ID of the MongoDB database. Default - value is None. - :paramtype restorable_mongodb_database_rid: str - :keyword start_time: Restorable MongoDB collections event feed start time. Default value is - None. - :paramtype start_time: str - :keyword end_time: Restorable MongoDB collections event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableMongodbCollectionGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbCollectionGetResult] + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :param service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: _types.ServiceResourceCreateUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Required. + :type create_update_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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + service_name: str, + create_update_parameters: Union[ + _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] + ], + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Creates a service. + + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :param create_update_parameters: The Service resource parameters. Is either a + ServiceResourceCreateUpdateParameters type or a IO[bytes] type. Required. + :type create_update_parameters: + ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters or + ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters or IO[bytes] + :return: An instance of LROPoller that returns ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbCollectionGetResult]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ServiceResource] = 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, + account_name=account_name, + service_name=service_name, + create_update_parameters=create_update_parameters, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ServiceResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37008,136 +52006,138 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_restorable_mongodb_collections_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - restorable_mongodb_database_rid=restorable_mongodb_database_rid, - start_time=start_time, - end_time=end_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_service_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableMongodbCollectionGetResult], - deserialized.get("value", []), + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - def get_next(next_link=None): - _request = prepare_request(next_link) + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + return deserialized # type: ignore - return pipeline_response + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes service with the given serviceName. - return ItemPaged(get_next, extract_data) + :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 service_name: Cosmos DB service name. Required. + :type service_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + 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, + account_name=account_name, + service_name=service_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) -class RestorableMongodbResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_mongodb_resources` attribute. - """ + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( - self, - location: str, - instance_id: str, - *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.RestorableMongodbResourcesGetResult"]: - """Return a list of database and collection combo that exist on the account at the given timestamp - and location. This helps in scenarios to validate what resources exist at given timestamp and - location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> ItemPaged["_models.ServiceResource"]: + """Gets the status of service. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableMongodbResourcesGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableMongodbResourcesGetResult] + :type resource_group_name: str + :param account_name: Cosmos DB database account name. Required. + :type account_name: str + :return: An iterator like instance of ServiceResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ServiceResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableMongodbResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ServiceResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -37150,12 +52150,10 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_mongodb_resources_list_request( - location=location, - instance_id=instance_id, + _request = build_service_list_request( + resource_group_name=resource_group_name, + account_name=account_name, subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -37195,7 +52193,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableMongodbResourcesGetResult], + List[_models.ServiceResource], deserialized.get("value", []), ) if cls: @@ -37224,14 +52222,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class RestorableGremlinDatabasesOperations: +class ThroughputPoolOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_databases` attribute. + :attr:`throughput_pool` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -37242,29 +52240,18 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, location: str, instance_id: str, **kwargs: Any - ) -> ItemPaged["_models.RestorableGremlinDatabaseGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin databases under - the restorable account. This helps in scenario where database was accidentally deleted to get - the deletion time. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + 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 location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :return: An iterator like instance of RestorableGremlinDatabaseGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinDatabaseGetResult] + :type resource_group_name: str + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: ThroughputPoolResource. The ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolResource :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.RestorableGremlinDatabaseGetResult]] = kwargs.pop("cls", None) - error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37273,135 +52260,62 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: - - _request = build_restorable_gremlin_databases_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _headers = kwargs.pop("headers", {}) or {} + _params = 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + cls: ClsType[_models.ThroughputPoolResource] = kwargs.pop("cls", None) - return _request + _request = build_throughput_pool_get_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinDatabaseGetResult], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + if response.status_code not in [200]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - 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 = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) -class RestorableGremlinGraphsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_graphs` attribute. - """ + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + return deserialized # type: ignore - @distributed_trace - def list( + def _create_or_update_initial( self, - location: str, - instance_id: str, - *, - restorable_gremlin_database_rid: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + resource_group_name: str, + throughput_pool_name: str, + body: Union[_models.ThroughputPoolResource, _types.ThroughputPoolResource, IO[bytes]], **kwargs: Any - ) -> ItemPaged["_models.RestorableGremlinGraphGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Gremlin graphs under a - specific database. This helps in scenario where container was accidentally deleted. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. - - :param location: Cosmos DB region, with spaces between words and each word capitalized. - Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restorable_gremlin_database_rid: The resource ID of the Gremlin database. Default - value is None. - :paramtype restorable_gremlin_database_rid: str - :keyword start_time: Restorable Gremlin graphs event feed start time. Default value is None. - :paramtype start_time: str - :keyword end_time: Restorable Gremlin graphs event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableGremlinGraphGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinGraphGetResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = kwargs.pop("params", {}) or {} - - cls: ClsType[List[_models.RestorableGremlinGraphGetResult]] = kwargs.pop("cls", None) - + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37410,137 +52324,239 @@ def list( } 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 = kwargs.pop("params", {}) or {} - _request = build_restorable_gremlin_graphs_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - restorable_gremlin_database_rid=restorable_gremlin_database_rid, - start_time=start_time, - end_time=end_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - return _request + _request = build_throughput_pool_create_or_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinGraphGetResult], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class RestorableGremlinResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @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. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_gremlin_resources` attribute. - """ + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def begin_create_or_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: _types.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. - @distributed_trace - def list( + :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.types.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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( self, - location: str, - instance_id: str, + resource_group_name: str, + throughput_pool_name: str, + body: IO[bytes], *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, + 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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :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, _types.ThroughputPoolResource, IO[bytes]], **kwargs: Any - ) -> ItemPaged["_models.RestorableGremlinResourcesGetResult"]: - """Return a list of gremlin database and graphs combo that exist on the account at the given - timestamp and location. This helps in scenarios to validate what resources exist at given - timestamp and location. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> LROPoller[_models.ThroughputPoolResource]: + """Creates or updates an Azure Cosmos DB ThroughputPool account. The "Update" method is preferred + when performing updates on an account. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableGremlinResourcesGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableGremlinResourcesGetResult] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolResource or IO[bytes] + :return: An instance of LROPoller that returns ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableGremlinResourcesGetResult]] = kwargs.pop("cls", None) + 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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, _types.ThroughputPoolUpdate, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -37549,132 +52565,235 @@ def list( } 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 = kwargs.pop("params", {}) or {} - _request = build_restorable_gremlin_resources_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else None + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" if body else None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _content = None - return _request + _request = build_throughput_pool_update_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableGremlinResourcesGetResult], - deserialized.get("value", []), - ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def get_next(next_link=None): - _request = prepare_request(next_link) + response = pipeline_response.http_response - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - response = pipeline_response.http_response + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return pipeline_response + deserialized = response.iter_bytes() if _decompress else response.iter_raw() - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized # type: ignore -class RestorableTablesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + @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. - Instead, you should access the following operations through - :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_tables` attribute. - """ + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @overload + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[_types.ThroughputPoolUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. - @distributed_trace - def list( + :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.types.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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( self, - location: str, - instance_id: str, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[IO[bytes]] = None, *, - start_time: Optional[str] = None, - end_time: Optional[str] = None, + content_type: str = "application/json", **kwargs: Any - ) -> ItemPaged["_models.RestorableTableGetResult"]: - """Show the event feed of all mutations done on all the Azure Cosmos DB Tables. This helps in - scenario where table was accidentally deleted. This API requires - 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + ) -> LROPoller[_models.ThroughputPoolResource]: + """Updates the properties of an existing Azure Cosmos DB Throughput Pool. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword start_time: Restorable Tables event feed start time. Default value is None. - :paramtype start_time: str - :keyword end_time: Restorable Tables event feed end time. Default value is None. - :paramtype end_time: str - :return: An iterator like instance of RestorableTableGetResult - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableGetResult] + :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 ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + throughput_pool_name: str, + body: Optional[Union[_models.ThroughputPoolUpdate, _types.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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolUpdate or IO[bytes] + :return: An instance of LROPoller that returns ThroughputPoolResource. The + ThroughputPoolResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableTableGetResult]] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if body else 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, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ThroughputPoolResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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, @@ -37683,91 +52802,124 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - _request = build_restorable_tables_list_request( - location=location, - instance_id=instance_id, - subscription_id=self._config.subscription_id, - start_time=start_time, - end_time=end_time, - api_version=self._config.api_version, - headers=_headers, - params=_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + 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), - headers=_headers, - params=_next_request_params, - ) - path_format_arguments = { - "endpoint": self._serialize.url( - "self._config.base_url", self._config.base_url, "str", skip_quote=True - ), - } - _request.url = self._client.format_url(_request.url, **path_format_arguments) + _request = build_throughput_pool_delete_request( + resource_group_name=resource_group_name, + throughput_pool_name=throughput_pool_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - return _request + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - def extract_data(pipeline_response): - deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize( - List[_models.RestorableTableGetResult], - deserialized.get("value", []), + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, ) - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.get("nextLink") or None, iter(list_of_elem) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - def get_next(next_link=None): - _request = prepare_request(next_link) + 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")) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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 None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs ) - response = pipeline_response.http_response + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize( - _models.CloudError, - response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - return pipeline_response + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } - return ItemPaged(get_next, extract_data) + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 -class RestorableTableResourcesOperations: +class ThroughputPoolsOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`restorable_table_resources` attribute. + :attr:`throughput_pools` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -37778,39 +52930,22 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list( - self, - location: str, - instance_id: str, - *, - restore_location: Optional[str] = None, - restore_timestamp_in_utc: Optional[str] = None, - **kwargs: Any - ) -> ItemPaged["_models.RestorableTableResourcesGetResult"]: - """Return a list of tables that exist on the account at the given timestamp and location. This - helps in scenarios to validate what resources exist at given timestamp and location. This API - requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/.../read' permission. + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ThroughputPoolResource"]: + """List all the ThroughputPools in a given resource group. - :param location: Cosmos DB region, with spaces between words and each word capitalized. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. - :type location: str - :param instance_id: The instanceId GUID of a restorable database account. Required. - :type instance_id: str - :keyword restore_location: The location where the restorable resources are located. Default - value is None. - :paramtype restore_location: str - :keyword restore_timestamp_in_utc: The timestamp when the restorable resources existed. Default - value is None. - :paramtype restore_timestamp_in_utc: str - :return: An iterator like instance of RestorableTableResourcesGetResult - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.RestorableTableResourcesGetResult] + :type resource_group_name: str + :return: An iterator like instance of ThroughputPoolResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.RestorableTableResourcesGetResult]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ThroughputPoolResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -37823,12 +52958,9 @@ def list( def prepare_request(next_link=None): if not next_link: - _request = build_restorable_table_resources_list_request( - location=location, - instance_id=instance_id, + _request = build_throughput_pools_list_by_resource_group_request( + resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - restore_location=restore_location, - restore_timestamp_in_utc=restore_timestamp_in_utc, api_version=self._config.api_version, headers=_headers, params=_params, @@ -37868,7 +53000,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.RestorableTableResourcesGetResult], + List[_models.ThroughputPoolResource], deserialized.get("value", []), ) if cls: @@ -37887,7 +53019,100 @@ 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ThroughputPoolResource"]: + """Lists all the Azure Cosmos DB Throughput Pools available under the subscription. + + :return: An iterator like instance of ThroughputPoolResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ThroughputPoolResource]] = 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_throughput_pools_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ThroughputPoolResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -37897,14 +53122,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class ServiceOperations: +class ThroughputPoolAccountOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s - :attr:`service` attribute. + :attr:`throughput_pool_account` attribute. """ def __init__(self, *args, **kwargs) -> None: @@ -37916,19 +53141,21 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def get( - self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any - ) -> _models.ServiceResource: - """Gets the status of service. + 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :return: ServiceResource. The ServiceResource is compatible with MutableMapping - :rtype: ~azure.mgmt.cosmosdb.models.ServiceResource + :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. The ThroughputPoolAccountResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -37942,12 +53169,12 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", None) + cls: ClsType[_models.ThroughputPoolAccountResource] = kwargs.pop("cls", None) - _request = build_service_get_request( + _request = build_throughput_pool_account_get_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -37974,7 +53201,7 @@ def get( pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -37982,7 +53209,7 @@ def get( if _stream: deserialized = response.iter_bytes() if _decompress else response.iter_raw() else: - deserialized = _deserialize(_models.ServiceResource, response.json()) + deserialized = _deserialize(_models.ThroughputPoolAccountResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -37992,11 +53219,9 @@ def get( def _create_initial( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: Union[ - _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] - ], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, _types.ThroughputPoolAccountResource, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { @@ -38015,15 +53240,15 @@ def _create_initial( content_type = content_type or "application/json" _content = None - if isinstance(create_update_parameters, (IOBase, bytes)): - _content = create_update_parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _content = json.dumps(create_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_service_create_request( + _request = build_throughput_pool_account_create_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, content_type=content_type, api_version=self._config.api_version, @@ -38044,21 +53269,23 @@ def _create_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) deserialized = response.iter_bytes() if _decompress else response.iter_raw() @@ -38072,31 +53299,33 @@ def _create_initial( def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: _models.ServiceResourceCreateUpdateParameters, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _models.ThroughputPoolAccountResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters + :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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of LROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -38104,31 +53333,33 @@ def begin_create( def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: _types.ServiceResourceCreateUpdateParameters, + throughput_pool_name: str, + throughput_pool_account_name: str, + body: _types.ThroughputPoolAccountResource, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters + :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.types.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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of LROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -38136,30 +53367,33 @@ def begin_create( def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: IO[bytes], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Required. - :type create_update_parameters: IO[bytes] + :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 ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :return: An instance of LROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -38167,46 +53401,46 @@ def begin_create( def begin_create( self, resource_group_name: str, - account_name: str, - service_name: str, - create_update_parameters: Union[ - _models.ServiceResourceCreateUpdateParameters, _types.ServiceResourceCreateUpdateParameters, IO[bytes] - ], + throughput_pool_name: str, + throughput_pool_account_name: str, + body: Union[_models.ThroughputPoolAccountResource, _types.ThroughputPoolAccountResource, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates a service. + ) -> 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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_name: str - :param create_update_parameters: The Service resource parameters. Is either a - ServiceResourceCreateUpdateParameters type or a IO[bytes] type. Required. - :type create_update_parameters: - ~azure.mgmt.cosmosdb.models.ServiceResourceCreateUpdateParameters or - ~azure.mgmt.cosmosdb.types.ServiceResourceCreateUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns ServiceResource. The ServiceResource is - compatible with MutableMapping - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ServiceResource] + :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 + ~azure.mgmt.cosmosdb.types.ThroughputPoolAccountResource or IO[bytes] + :return: An instance of LROPoller that returns ThroughputPoolAccountResource. The + ThroughputPoolAccountResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = kwargs.pop("params", {}) or {} content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ServiceResource] = kwargs.pop("cls", 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, - account_name=account_name, - service_name=service_name, - create_update_parameters=create_update_parameters, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, + body=body, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, @@ -38218,7 +53452,7 @@ def begin_create( def get_long_running_output(pipeline_response): response = pipeline_response.http_response - deserialized = _deserialize(_models.ServiceResource, response.json()) + deserialized = _deserialize(_models.ThroughputPoolAccountResource, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -38236,18 +53470,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller[_models.ServiceResource].from_continuation_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.ServiceResource]( + return LROPoller[_models.ThroughputPoolAccountResource]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) def _delete_initial( - self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any ) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -38262,10 +53496,10 @@ def _delete_initial( cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - _request = build_service_delete_request( + _request = build_throughput_pool_account_delete_request( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38284,14 +53518,14 @@ def _delete_initial( response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + 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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -38312,17 +53546,18 @@ def _delete_initial( @distributed_trace def begin_delete( - self, resource_group_name: str, account_name: str, service_name: str, **kwargs: Any + self, resource_group_name: str, throughput_pool_name: str, throughput_pool_account_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes service with the given serviceName. + """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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :param service_name: Cosmos DB service name. Required. - :type service_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 None :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -38337,8 +53572,8 @@ def begin_delete( if cont_token is None: raw_result = self._delete_initial( resource_group_name=resource_group_name, - account_name=account_name, - service_name=service_name, + throughput_pool_name=throughput_pool_name, + throughput_pool_account_name=throughput_pool_account_name, cls=lambda x, y, z: x, headers=_headers, params=_params, @@ -38372,23 +53607,43 @@ 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 + +class ThroughputPoolAccountsOperations: # pylint: disable=docstring-missing-param + """ + .. 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. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = 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) -> ItemPaged["_models.ServiceResource"]: - """Gets the status of service. + def list( + self, resource_group_name: str, throughput_pool_name: str, **kwargs: Any + ) -> ItemPaged["_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 account_name: Cosmos DB database account name. Required. - :type account_name: str - :return: An iterator like instance of ServiceResource - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ServiceResource] + :param throughput_pool_name: Cosmos DB Throughput Pool name. Required. + :type throughput_pool_name: str + :return: An iterator like instance of ThroughputPoolAccountResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.ThroughputPoolAccountResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - cls: ClsType[List[_models.ServiceResource]] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ThroughputPoolAccountResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -38401,9 +53656,9 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It def prepare_request(next_link=None): if not next_link: - _request = build_service_list_request( + _request = build_throughput_pool_accounts_list_request( resource_group_name=resource_group_name, - account_name=account_name, + throughput_pool_name=throughput_pool_name, subscription_id=self._config.subscription_id, api_version=self._config.api_version, headers=_headers, @@ -38444,7 +53699,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() list_of_elem = _deserialize( - List[_models.ServiceResource], + List[_models.ThroughputPoolAccountResource], deserialized.get("value", []), ) if cls: @@ -38463,7 +53718,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 = _failsafe_deserialize( - _models.CloudError, + _models.ErrorResponse, response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -38473,7 +53728,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class MongoMIResourcesOperations: +class MongoMIResourcesOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -39637,7 +54892,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class FleetOperations: +class FleetOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -40376,7 +55631,513 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class FleetspaceOperations: +class FleetAnalyticsOperations: # pylint: disable=docstring-missing-param + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cosmosdb.CosmosDBManagementClient`'s + :attr:`fleet_analytics` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: CosmosDBManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, fleet_name: str, fleet_analytics_name: str, **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Retrieves the properties of an existing Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FleetAnalyticsResource] = kwargs.pop("cls", None) + + _request = build_fleet_analytics_get_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FleetAnalyticsResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: _models.FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Required. + :type body: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: _types.FleetAnalyticsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Required. + :type body: ~azure.mgmt.cosmosdb.types.FleetAnalyticsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. 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: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + fleet_name: str, + fleet_analytics_name: str, + body: Union[_models.FleetAnalyticsResource, _types.FleetAnalyticsResource, IO[bytes]], + **kwargs: Any + ) -> _models.FleetAnalyticsResource: + """Creates an Azure Cosmos DB FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :param body: The parameters to provide for the current FleetAnalytics. Is either a + FleetAnalyticsResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource or + ~azure.mgmt.cosmosdb.types.FleetAnalyticsResource or IO[bytes] + :return: FleetAnalyticsResource. The FleetAnalyticsResource is compatible with MutableMapping + :rtype: ~azure.mgmt.cosmosdb.models.FleetAnalyticsResource + :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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FleetAnalyticsResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_fleet_analytics_create_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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, 201]: + if _stream: + 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FleetAnalyticsResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, fleet_name: str, fleet_analytics_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_fleet_analytics_delete_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, fleet_name: str, fleet_analytics_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an existing Azure Cosmos DB FleetAnalytics. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :param fleet_analytics_name: Cosmos DB fleetAnalytics name. Required. + :type fleet_analytics_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + fleet_name=fleet_name, + fleet_analytics_name=fleet_analytics_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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( + self, resource_group_name: str, fleet_name: str, **kwargs: Any + ) -> ItemPaged["_models.FleetAnalyticsResource"]: + """Lists all the FleetAnalytics under a fleet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param fleet_name: Cosmos DB fleet name. Needs to be unique under a subscription. Required. + :type fleet_name: str + :return: An iterator like instance of FleetAnalyticsResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cosmosdb.models.FleetAnalyticsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FleetAnalyticsResource]] = 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_fleet_analytics_list_request( + resource_group_name=resource_group_name, + fleet_name=fleet_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FleetAnalyticsResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FleetspaceOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. @@ -41206,7 +56967,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) -class FleetspaceAccountOperations: +class FleetspaceAccountOperations: # pylint: disable=docstring-missing-param """ .. warning:: **DO NOT** instantiate this class directly. diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py index 87676c65a8f0..ea765788358a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/types.py b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/types.py index 14072205b1b7..8686527dc1a9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/types.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/types.py @@ -10,46 +10,50 @@ from typing import Any, Literal, TYPE_CHECKING, Union from typing_extensions import Required, TypedDict -from .models._enums import BackupPolicyType, ServiceType +from .models._enums import BackupPolicyType, CopyJobType, DataTransferComponent, ServiceType if TYPE_CHECKING: from .models import ( + AllocationState, AnalyticalStorageSchemaType, - ApiType, AuthenticationMethod, AutoReplicate, AzureConnectionType, BackupPolicyMigrationStatus, BackupPolicyType, BackupStorageRedundancy, + CapacityMode, + ClusterType, CompositePathSortOrder, ConflictResolutionMode, - ConnectionState, ConnectorOffer, ContinuousTier, + CopyJobMode, + CopyJobStatus, CreateMode, CreatedByType, + DataTransferJobMode, DataType, DatabaseAccountKind, DedicatedGatewayType, DefaultConsistencyLevel, DefaultPriorityLevel, DistanceFunction, + EnableFullTextQuery, + FleetAnalyticsPropertiesStorageLocationType, FleetspacePropertiesFleetspaceApiKind, FleetspacePropertiesServiceTier, + GarnetAuthenticationType, + GarnetCacheProvisioningState, IndexKind, IndexingMode, KeyKind, - Kind, ManagedCassandraProvisioningState, ManagedCassandraResourceIdentityType, MinimalTlsVersion, MongoRoleDefinitionType, NetworkAclBypass, - NodeState, - OperationType, PartitionKind, - PrimaryAggregationType, PublicNetworkAccess, ResourceIdentityType, RestoreMode, @@ -57,13 +61,12 @@ ScheduledEventStrategy, ServerVersion, ServiceSize, - ServiceStatus, SpatialType, Status, + SupportedActions, + ThroughputPolicyType, TriggerOperation, TriggerType, - Type, - UnitType, VectorDataType, VectorIndexType, ) @@ -72,23 +75,30 @@ class AccountKeyMetadata(TypedDict, total=False): """The metadata related to an access key for a given database account. - :ivar generation_time: Generation time in UTC of the key in ISO-8601 format. If the value is + :ivar generationTime: Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18. - :vartype generation_time: str + :vartype generationTime: str + :ivar approximateLastUsageTime: Approximate time in UTC of the most recent usage of the key in + ISO-8601 format. If the value is missing from the object, it means there is no recorded data + plane usage for this key. + :vartype approximateLastUsageTime: str """ generationTime: str """Generation time in UTC of the key in ISO-8601 format. If the value is missing from the object, it means that the last key regeneration was triggered before 2022-06-18.""" + approximateLastUsageTime: str + """Approximate time in UTC of the most recent usage of the key in ISO-8601 format. If the value is + missing from the object, it means there is no recorded data plane usage for this key.""" class AnalyticalStorageConfiguration(TypedDict, total=False): """Analytical storage specific properties. - :ivar schema_type: Describes the types of schema for analytical storage. Known values are: + :ivar schemaType: Describes the types of schema for analytical storage. Known values are: "WellDefined" and "FullFidelity". - :vartype schema_type: Union[str, "AnalyticalStorageSchemaType"] + :vartype schemaType: Union[str, "AnalyticalStorageSchemaType"] """ schemaType: Union[str, "AnalyticalStorageSchemaType"] @@ -99,9 +109,9 @@ class AnalyticalStorageConfiguration(TypedDict, total=False): class ApiProperties(TypedDict, total=False): """ApiProperties. - :ivar server_version: Describes the version of the MongoDB account. Known values are: "3.2", + :ivar serverVersion: Describes the version of the MongoDB account. Known values are: "3.2", "3.6", "4.0", "4.2", "5.0", "6.0", and "7.0". - :vartype server_version: Union[str, "ServerVersion"] + :vartype serverVersion: Union[str, "ServerVersion"] """ serverVersion: Union[str, "ServerVersion"] @@ -173,26 +183,26 @@ class ARMResourceProperties(TypedDict, total=False): class AuthenticationMethodLdapProperties(TypedDict, total=False): """Ldap authentication method properties. This feature is in preview. - :ivar server_hostname: Hostname of the LDAP server. - :vartype server_hostname: str - :ivar server_port: Port of the LDAP server. - :vartype server_port: int - :ivar service_user_distinguished_name: Distinguished name of the look up user account, who can + :ivar serverHostname: Hostname of the LDAP server. + :vartype serverHostname: str + :ivar serverPort: Port of the LDAP server. + :vartype serverPort: int + :ivar serviceUserDistinguishedName: Distinguished name of the look up user account, who can look up user details on authentication. - :vartype service_user_distinguished_name: str - :ivar service_user_password: Password of the look up user. - :vartype service_user_password: str - :ivar search_base_distinguished_name: Distinguished name of the object to start the recursive + :vartype serviceUserDistinguishedName: str + :ivar serviceUserPassword: Password of the look up user. + :vartype serviceUserPassword: str + :ivar searchBaseDistinguishedName: Distinguished name of the object to start the recursive search of users from. - :vartype search_base_distinguished_name: str - :ivar search_filter_template: Template to use for searching. Defaults to (cn=%s) where %s will - be replaced by the username used to login. - :vartype search_filter_template: str - :ivar server_certificates: - :vartype server_certificates: list["Certificate"] - :ivar connection_timeout_in_ms: Timeout for connecting to the LDAP server in miliseconds. The + :vartype searchBaseDistinguishedName: str + :ivar searchFilterTemplate: Template to use for searching. Defaults to (cn=%s) where %s will be + replaced by the username used to login. + :vartype searchFilterTemplate: str + :ivar serverCertificates: + :vartype serverCertificates: list["Certificate"] + :ivar connectionTimeoutInMs: Timeout for connecting to the LDAP server in miliseconds. The default is 5000 ms. - :vartype connection_timeout_in_ms: int + :vartype connectionTimeoutInMs: int """ serverHostname: str @@ -216,8 +226,8 @@ class AuthenticationMethodLdapProperties(TypedDict, total=False): class AutoscaleSettings(TypedDict, total=False): """AutoscaleSettings. - :ivar max_throughput: Represents maximum throughput, the resource can scale up to. - :vartype max_throughput: int + :ivar maxThroughput: Represents maximum throughput, the resource can scale up to. + :vartype maxThroughput: int """ maxThroughput: int @@ -227,13 +237,13 @@ class AutoscaleSettings(TypedDict, total=False): class AutoscaleSettingsResource(TypedDict, total=False): """Cosmos DB provisioned throughput settings object. - :ivar max_throughput: Represents maximum throughput container can scale up to. Required. - :vartype max_throughput: int - :ivar auto_upgrade_policy: Cosmos DB resource auto-upgrade policy. - :vartype auto_upgrade_policy: "AutoUpgradePolicyResource" - :ivar target_max_throughput: Represents target maximum throughput container can scale up to - once offer is no longer in pending state. - :vartype target_max_throughput: int + :ivar maxThroughput: Represents maximum throughput container can scale up to. Required. + :vartype maxThroughput: int + :ivar autoUpgradePolicy: Cosmos DB resource auto-upgrade policy. + :vartype autoUpgradePolicy: "AutoUpgradePolicyResource" + :ivar targetMaxThroughput: Represents target maximum throughput container can scale up to once + offer is no longer in pending state. + :vartype targetMaxThroughput: int """ maxThroughput: Required[int] @@ -248,24 +258,53 @@ class AutoscaleSettingsResource(TypedDict, total=False): class AutoUpgradePolicyResource(TypedDict, total=False): """Cosmos DB resource auto-upgrade policy. - :ivar throughput_policy: Represents throughput policy which service must adhere to for + :ivar throughputPolicy: Represents throughput policy which service must adhere to for auto-upgrade. - :vartype throughput_policy: "ThroughputPolicyResource" + :vartype throughputPolicy: "ThroughputPolicyResource" """ throughputPolicy: "ThroughputPolicyResource" """Represents throughput policy which service must adhere to for auto-upgrade.""" -class BackupInformation(TypedDict, total=False): - """Backup information of a resource. +class AzureBlobContainer(TypedDict, total=False): + """An Azure Blob container. - :ivar continuous_backup_information: Information about the status of continuous backups. - :vartype continuous_backup_information: "ContinuousBackupInformation" + :ivar containerName: Azure Blob container. Required. + :vartype containerName: str """ - continuousBackupInformation: "ContinuousBackupInformation" - """Information about the status of continuous backups.""" + containerName: Required[str] + """Azure Blob container. Required.""" + + +class AzureBlobDataTransferDataSourceSink(TypedDict, total=False): + """An Azure Blob Storage data source/sink. + + :ivar containerName: Required. + :vartype containerName: str + :ivar endpointUrl: + :vartype endpointUrl: str + :ivar component: Required. AZURE_BLOB_STORAGE. + :vartype component: Literal[DataTransferComponent.AZURE_BLOB_STORAGE] + """ + + containerName: Required[str] + """Required.""" + endpointUrl: str + component: Required[Literal[DataTransferComponent.AZURE_BLOB_STORAGE]] + """Required. AZURE_BLOB_STORAGE.""" + + +class AzureBlobSourceSinkDetails(TypedDict, total=False): + """An Azure Blob Storage data source/sink. + + :ivar endpointUrl: Azure Blob container endpoint. Required. + :vartype endpointUrl: str + """ + + endpointUrl: Required[str] + """Azure Blob container endpoint. Required.""" class BackupPolicyMigrationState(TypedDict, total=False): @@ -274,11 +313,11 @@ class BackupPolicyMigrationState(TypedDict, total=False): :ivar status: Describes the status of migration between backup policy types. Known values are: "Invalid", "InProgress", "Completed", and "Failed". :vartype status: Union[str, "BackupPolicyMigrationStatus"] - :ivar target_type: Describes the target backup policy type of the backup policy migration. - Known values are: "Periodic" and "Continuous". - :vartype target_type: Union[str, "BackupPolicyType"] - :ivar start_time: Time at which the backup policy migration started (ISO-8601 format). - :vartype start_time: str + :ivar targetType: Describes the target backup policy type of the backup policy migration. Known + values are: "Periodic" and "Continuous". + :vartype targetType: Union[str, "BackupPolicyType"] + :ivar startTime: Time at which the backup policy migration started (ISO-8601 format). + :vartype startTime: str """ status: Union[str, "BackupPolicyMigrationStatus"] @@ -294,13 +333,13 @@ class BackupPolicyMigrationState(TypedDict, total=False): class BackupSchedule(TypedDict, total=False): """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 + :ivar scheduleName: The unique identifier of backup schedule. + :vartype scheduleName: str + :ivar cronExpression: The cron expression that defines when you want to back up your data. + :vartype cronExpression: str + :ivar retentionInHours: The retention period (hours) of the backups. If you want to retain data + forever, set retention to 0. + :vartype retentionInHours: int """ scheduleName: str @@ -312,6 +351,63 @@ class BackupSchedule(TypedDict, total=False): to 0.""" +class BaseCopyJobTask(TypedDict, total=False): + """The properties of a Copy Job Task. + + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + """ + + totalCount: int + """Task level Total Count.""" + processedCount: int + """Task level Processed Count.""" + + +class BlobToCassandraRUCopyJobProperties(TypedDict, total=False): + """Source Azure Blob Storage to Destination Cassandra copy job properties. + + :ivar sourceDetails: Azure Storage container DataStore details. Required. + :vartype sourceDetails: "AzureBlobSourceSinkDetails" + :ivar destinationDetails: Destination Cassandra DataStore details. + :vartype destinationDetails: "CosmosDBSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["BlobToCassandraRUCopyJobTask"] + :ivar jobType: Copy Job Type. Required. AZURE_BLOB_STORAGE_TO_CASSANDRA_RU. + :vartype jobType: Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU] + """ + + sourceDetails: Required["AzureBlobSourceSinkDetails"] + """Azure Storage container DataStore details. Required.""" + destinationDetails: "CosmosDBSourceSinkDetails" + """Destination Cassandra DataStore details.""" + tasks: Required[list["BlobToCassandraRUCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.AZURE_BLOB_STORAGE_TO_CASSANDRA_RU]] + """Copy Job Type. Required. AZURE_BLOB_STORAGE_TO_CASSANDRA_RU.""" + + +class BlobToCassandraRUCopyJobTask(BaseCopyJobTask): + """BlobToCassandraRUCopyJobTask. + + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source Azure Blob container. Required. + :vartype source: "AzureBlobContainer" + :ivar destination: Destination Cassandra table. Required. + :vartype destination: "CosmosDBCassandraTable" + """ + + source: Required["AzureBlobContainer"] + """Source Azure Blob container. Required.""" + destination: Required["CosmosDBCassandraTable"] + """Destination Cassandra table. Required.""" + + class Capability(TypedDict, total=False): """Cosmos DB capability object. @@ -328,11 +424,11 @@ class Capability(TypedDict, total=False): class Capacity(TypedDict, total=False): """The object that represents all properties related to capacity enforcement on an account. - :ivar total_throughput_limit: The total throughput limit imposed on the account. A + :ivar totalThroughputLimit: The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on that account to be 2000. A totalThroughputLimit of -1 indicates no limits on provisioning of throughput. - :vartype total_throughput_limit: int + :vartype totalThroughputLimit: int """ totalThroughputLimit: int @@ -341,136 +437,6 @@ class Capacity(TypedDict, total=False): totalThroughputLimit of -1 indicates no limits on provisioning of throughput.""" -class CassandraClusterDataCenterNodeItem(TypedDict, total=False): - """CassandraClusterDataCenterNodeItem. - - :ivar address: The node's IP address. - :vartype address: str - :ivar state: The state of the node in Cassandra ring. Known values are: "Normal", "Leaving", - "Joining", "Moving", and "Stopped". - :vartype state: Union[str, "NodeState"] - :ivar status: - :vartype status: str - :ivar cassandra_process_status: Cassandra service status on this node. - :vartype cassandra_process_status: str - :ivar load: The amount of file system data in the data directory (e.g., 47.66 kB), excluding - all content in the snapshots subdirectories. Because all SSTable data files are included, any - data that is not cleaned up (such as TTL-expired cells or tombstones) is counted. - :vartype load: str - :ivar tokens: List of tokens this node covers. - :vartype tokens: list[str] - :ivar size: - :vartype size: int - :ivar host_id: The network ID of the node. - :vartype host_id: str - :ivar rack: The rack this node is part of. - :vartype rack: str - :ivar timestamp: The timestamp when these statistics were captured. - :vartype timestamp: str - :ivar disk_used_kb: The amount of disk used, in kB, of the directory /var/lib/cassandra. - :vartype disk_used_kb: int - :ivar disk_free_kb: The amount of disk free, in kB, of the directory /var/lib/cassandra. - :vartype disk_free_kb: int - :ivar memory_used_kb: Used memory (calculated as total - free - buffers - cache), in kB. - :vartype memory_used_kb: int - :ivar memory_buffers_and_cached_kb: Memory used by kernel buffers (Buffers in /proc/meminfo) - and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. - :vartype memory_buffers_and_cached_kb: int - :ivar memory_free_kb: Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. - :vartype memory_free_kb: int - :ivar memory_total_kb: Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. - :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 - """ - - address: str - """The node's IP address.""" - state: Union[str, "NodeState"] - """The state of the node in Cassandra ring. Known values are: \"Normal\", \"Leaving\", - \"Joining\", \"Moving\", and \"Stopped\".""" - status: str - cassandraProcessStatus: str - """Cassandra service status on this node.""" - load: str - """The amount of file system data in the data directory (e.g., 47.66 kB), excluding all content in - the snapshots subdirectories. Because all SSTable data files are included, any data that is not - cleaned up (such as TTL-expired cells or tombstones) is counted.""" - tokens: list[str] - """List of tokens this node covers.""" - size: int - hostID: str - """The network ID of the node.""" - rack: str - """The rack this node is part of.""" - timestamp: str - """The timestamp when these statistics were captured.""" - diskUsedKB: int - """The amount of disk used, in kB, of the directory /var/lib/cassandra.""" - diskFreeKB: int - """The amount of disk free, in kB, of the directory /var/lib/cassandra.""" - memoryUsedKB: int - """Used memory (calculated as total - free - buffers - cache), in kB.""" - memoryBuffersAndCachedKB: int - """Memory used by kernel buffers (Buffers in /proc/meminfo) and page cache and slabs (Cached and - SReclaimable in /proc/meminfo), in kB.""" - memoryFreeKB: int - """Unused memory (MemFree and SwapFree in /proc/meminfo), in kB.""" - memoryTotalKB: int - """Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB.""" - cpuUsage: float - """A float representing the current system-wide CPU utilization as a percentage.""" - isLatestModel: bool - """If node has been updated to latest model.""" - - -class CassandraClusterPublicStatus(TypedDict, total=False): - """Properties of a managed Cassandra cluster public status. - - :ivar e_tag: - :vartype e_tag: str - :ivar reaper_status: - :vartype reaper_status: "ManagedCassandraReaperStatus" - :ivar connection_errors: List relevant information about any connection errors to the - Datacenters. - :vartype connection_errors: list["ConnectionError"] - :ivar errors: List relevant information about any errors about cluster, data center and - connection error. - :vartype errors: list["CassandraError"] - :ivar data_centers: List of the status of each datacenter in this cluster. - :vartype data_centers: list["CassandraClusterPublicStatusDataCentersItem"] - """ - - eTag: str - reaperStatus: "ManagedCassandraReaperStatus" - connectionErrors: list["ConnectionError"] - """List relevant information about any connection errors to the Datacenters.""" - errors: list["CassandraError"] - """List relevant information about any errors about cluster, data center and connection error.""" - dataCenters: list["CassandraClusterPublicStatusDataCentersItem"] - """List of the status of each datacenter in this cluster.""" - - -class CassandraClusterPublicStatusDataCentersItem(TypedDict, total=False): # pylint: disable=name-too-long - """CassandraClusterPublicStatusDataCentersItem. - - :ivar name: The name of this Datacenter. - :vartype name: str - :ivar seed_nodes: A list of all seed nodes in the cluster, managed and unmanaged. - :vartype seed_nodes: list[str] - :ivar nodes: - :vartype nodes: list["CassandraClusterDataCenterNodeItem"] - """ - - name: str - """The name of this Datacenter.""" - seedNodes: list[str] - """A list of all seed nodes in the cluster, managed and unmanaged.""" - nodes: list["CassandraClusterDataCenterNodeItem"] - - class CassandraError(TypedDict, total=False): """CassandraError. @@ -480,8 +446,8 @@ class CassandraError(TypedDict, total=False): :vartype message: str :ivar target: The target resource of the error. :vartype target: str - :ivar additional_error_info: Additional information about the error. - :vartype additional_error_info: str + :ivar additionalErrorInfo: Additional information about the error. + :vartype additionalErrorInfo: str """ code: str @@ -539,47 +505,6 @@ class CassandraKeyspaceCreateUpdateProperties(TypedDict, total=False): with the request.""" -class CassandraKeyspaceGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Cassandra keyspace. - - :ivar resource: - :vartype resource: "CassandraKeyspaceGetPropertiesResource" - :ivar options: - :vartype options: "CassandraKeyspaceGetPropertiesOptions" - """ - - resource: "CassandraKeyspaceGetPropertiesResource" - options: "CassandraKeyspaceGetPropertiesOptions" - - -class OptionsResource(TypedDict, total=False): - """Cosmos DB options resource object. - - :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: "AutoscaleSettings" - """ - - throughput: int - """Value of the Cosmos DB resource throughput or autoscaleSettings. Use the ThroughputSetting - resource when retrieving offer details.""" - autoscaleSettings: "AutoscaleSettings" - """Specifies the Autoscale settings.""" - - -class CassandraKeyspaceGetPropertiesOptions(OptionsResource): - """CassandraKeyspaceGetPropertiesOptions. - - :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: "AutoscaleSettings" - """ - - class CassandraKeyspaceResource(TypedDict, total=False): """Cosmos DB Cassandra keyspace resource object. @@ -591,29 +516,6 @@ class CassandraKeyspaceResource(TypedDict, total=False): """Name of the Cosmos DB Cassandra keyspace. Required.""" -class CassandraKeyspaceGetPropertiesResource(CassandraKeyspaceResource): - """CassandraKeyspaceGetPropertiesResource. - - :ivar id: Name of the Cosmos DB Cassandra keyspace. Required. - :vartype id: str - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - class Resource(TypedDict, total=False): """Resource. @@ -625,9 +527,9 @@ class Resource(TypedDict, total=False): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" """ id: str @@ -653,55 +555,11 @@ class ProxyResource(Resource): :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: "SystemData" - """ - - -class CassandraKeyspaceGetResults(ProxyResource): - """An Azure Cosmos DB Cassandra keyspace. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB Cassandra keyspace. - :vartype properties: "CassandraKeyspaceGetProperties" - :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: "ManagedServiceIdentity" + :vartype systemData: "SystemData" """ - properties: "CassandraKeyspaceGetProperties" - """The properties of an Azure Cosmos DB Cassandra keyspace.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - class CassandraPartitionKey(TypedDict, total=False): """Cosmos DB Cassandra table partition key. @@ -725,9 +583,9 @@ class CassandraRoleAssignmentResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Cassandra Role Assignment. :vartype properties: "CassandraRoleAssignmentResourceProperties" """ @@ -739,17 +597,17 @@ class CassandraRoleAssignmentResource(ProxyResource): class CassandraRoleAssignmentResourceProperties(TypedDict, total=False): # pylint: disable=name-too-long """Azure Cosmos DB Cassandra Role Assignment resource object. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str + :ivar roleDefinitionId: The unique identifier for the associated Role Definition. + :vartype roleDefinitionId: str :ivar scope: The data plane resource path for which access is being granted through this Cassandra Role Assignment. :vartype scope: str - :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + :ivar principalId: The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Cassandra 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 + :vartype principalId: str + :ivar provisioningState: Provisioning state of the resource. + :vartype provisioningState: str """ roleDefinitionId: str @@ -776,9 +634,9 @@ class CassandraRoleDefinitionResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Cassandra Role Definition. :vartype properties: "CassandraRoleDefinitionResourceProperties" """ @@ -792,18 +650,18 @@ class CassandraRoleDefinitionResourceProperties(TypedDict, total=False): # pyli :ivar id: The path id for the Role Definition. :vartype id: str - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "RoleDefinitionType"] - :ivar assignable_scopes: A set of fully qualified Scopes at or below which Cassandra Role + :ivar assignableScopes: A set of fully qualified Scopes at or below which Cassandra 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] + :vartype assignableScopes: list[str] :ivar permissions: The set of operations allowed through this Role Definition. :vartype permissions: list["Permission"] """ @@ -825,15 +683,99 @@ class CassandraRoleDefinitionResourceProperties(TypedDict, total=False): # pyli """The set of operations allowed through this Role Definition.""" +class CassandraRUToBlobCopyJobProperties(TypedDict, total=False): + """Source Cassandra to Destination Azure Blob Storage copy job properties. + + :ivar sourceDetails: Source Cassandra DataStore details. + :vartype sourceDetails: "CosmosDBSourceSinkDetails" + :ivar destinationDetails: Destination Cassandra DataStore details. Required. + :vartype destinationDetails: "AzureBlobSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["CassandraRUToBlobCopyJobTask"] + :ivar jobType: Copy Job Type. Required. CASSANDRA_RU_TO_AZURE_BLOB_STORAGE. + :vartype jobType: Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE] + """ + + sourceDetails: "CosmosDBSourceSinkDetails" + """Source Cassandra DataStore details.""" + destinationDetails: Required["AzureBlobSourceSinkDetails"] + """Destination Cassandra DataStore details. Required.""" + tasks: Required[list["CassandraRUToBlobCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.CASSANDRA_RU_TO_AZURE_BLOB_STORAGE]] + """Copy Job Type. Required. CASSANDRA_RU_TO_AZURE_BLOB_STORAGE.""" + + +class CassandraRUToBlobCopyJobTask(BaseCopyJobTask): + """CassandraRUToBlobCopyJobTask. + + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source Cassandra table. Required. + :vartype source: "CosmosDBCassandraTable" + :ivar destination: Destination Azure Blob container. Required. + :vartype destination: "AzureBlobContainer" + """ + + source: Required["CosmosDBCassandraTable"] + """Source Cassandra table. Required.""" + destination: Required["AzureBlobContainer"] + """Destination Azure Blob container. Required.""" + + +class CassandraRUToCassandraRUCopyJobProperties(TypedDict, total=False): # pylint: disable=name-too-long + """Source Cassandra to Destination Cassandra copy job properties. + + :ivar sourceDetails: Source Cassandra DataStore details. + :vartype sourceDetails: "CosmosDBSourceSinkDetails" + :ivar destinationDetails: Destination Cassandra DataStore details. + :vartype destinationDetails: "CosmosDBSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["CassandraRUToCassandraRUCopyJobTask"] + :ivar jobType: Copy Job Type. Required. CASSANDRA_RU_TO_CASSANDRA_RU. + :vartype jobType: Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU] + """ + + sourceDetails: "CosmosDBSourceSinkDetails" + """Source Cassandra DataStore details.""" + destinationDetails: "CosmosDBSourceSinkDetails" + """Destination Cassandra DataStore details.""" + tasks: Required[list["CassandraRUToCassandraRUCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.CASSANDRA_RU_TO_CASSANDRA_RU]] + """Copy Job Type. Required. CASSANDRA_RU_TO_CASSANDRA_RU.""" + + +class CassandraRUToCassandraRUCopyJobTask(BaseCopyJobTask): + """CassandraRUToCassandraRUCopyJobTask. + + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source Cassandra table. Required. + :vartype source: "CosmosDBCassandraTable" + :ivar destination: Destination Cassandra table. Required. + :vartype destination: "CosmosDBCassandraTable" + """ + + source: Required["CosmosDBCassandraTable"] + """Source Cassandra table. Required.""" + destination: Required["CosmosDBCassandraTable"] + """Destination Cassandra table. Required.""" + + class CassandraSchema(TypedDict, total=False): """Cosmos DB Cassandra table schema. :ivar columns: List of Cassandra table columns. :vartype columns: list["Column"] - :ivar partition_keys: List of partition key. - :vartype partition_keys: list["CassandraPartitionKey"] - :ivar cluster_keys: List of cluster key. - :vartype cluster_keys: list["ClusterKey"] + :ivar partitionKeys: List of partition key. + :vartype partitionKeys: list["CassandraPartitionKey"] + :ivar clusterKeys: List of cluster key. + :vartype clusterKeys: list["ClusterKey"] """ columns: list["Column"] @@ -889,41 +831,17 @@ class CassandraTableCreateUpdateProperties(TypedDict, total=False): with the request.""" -class CassandraTableGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Cassandra table. - - :ivar resource: - :vartype resource: "CassandraTableGetPropertiesResource" - :ivar options: - :vartype options: "CassandraTableGetPropertiesOptions" - """ - - resource: "CassandraTableGetPropertiesResource" - options: "CassandraTableGetPropertiesOptions" - - -class CassandraTableGetPropertiesOptions(OptionsResource): - """CassandraTableGetPropertiesOptions. - - :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: "AutoscaleSettings" - """ - - class CassandraTableResource(TypedDict, total=False): """Cosmos DB Cassandra table resource object. :ivar id: Name of the Cosmos DB Cassandra table. Required. :vartype id: str - :ivar default_ttl: Time to live of the Cosmos DB Cassandra table. - :vartype default_ttl: int + :ivar defaultTtl: Time to live of the Cosmos DB Cassandra table. + :vartype defaultTtl: int :ivar schema: Schema of the Cosmos DB Cassandra table. :vartype schema: "CassandraSchema" - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int + :ivar analyticalStorageTtl: Analytical TTL. + :vartype analyticalStorageTtl: int """ id: Required[str] @@ -936,77 +854,64 @@ class CassandraTableResource(TypedDict, total=False): """Analytical TTL.""" -class CassandraTableGetPropertiesResource(CassandraTableResource): - """CassandraTableGetPropertiesResource. - - :ivar id: Name of the Cosmos DB Cassandra table. Required. - :vartype id: str - :ivar default_ttl: Time to live of the Cosmos DB Cassandra table. - :vartype default_ttl: int - :ivar schema: Schema of the Cosmos DB Cassandra table. - :vartype schema: "CassandraSchema" - :ivar analytical_storage_ttl: Analytical TTL. - :vartype analytical_storage_ttl: int - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class CassandraTableGetResults(ProxyResource): - """An Azure Cosmos DB Cassandra table. +class CassandraViewCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Cassandra view. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB Cassandra table. - :vartype properties: "CassandraTableGetProperties" :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\\". + 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: "ManagedServiceIdentity" + :ivar properties: Properties to create and update Azure Cosmos DB Cassandra view. Required. + :vartype properties: "CassandraViewCreateUpdateProperties" """ - properties: "CassandraTableGetProperties" - """The properties of an Azure Cosmos DB Cassandra table.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" + properties: Required["CassandraViewCreateUpdateProperties"] + """Properties to create and update Azure Cosmos DB Cassandra view. Required.""" + + +class CassandraViewCreateUpdateProperties(TypedDict, total=False): + """Properties to create and update Azure Cosmos DB Cassandra view. + + :ivar resource: The standard JSON format of a Cassandra view. Required. + :vartype resource: "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: "CreateUpdateOptions" + """ + + resource: Required["CassandraViewResource"] + """The standard JSON format of a Cassandra view. Required.""" + options: "CreateUpdateOptions" + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" + + +class CassandraViewResource(TypedDict, total=False): + """Cosmos DB Cassandra view resource object. + + :ivar id: Name of the Cosmos DB Cassandra view. Required. + :vartype id: str + :ivar viewDefinition: View Definition of the Cosmos DB Cassandra view. Required. + :vartype viewDefinition: str + """ + + id: Required[str] + """Name of the Cosmos DB Cassandra view. Required.""" + viewDefinition: Required[str] + """View Definition of the Cosmos DB Cassandra view. Required.""" class Certificate(TypedDict, total=False): @@ -1020,20 +925,71 @@ class Certificate(TypedDict, total=False): """PEM formatted public key.""" +class ChaosFaultProperties(TypedDict, total=False): + """A request object to enable/disable the chaos fault. + + :ivar action: Indicates whether what action to take for the Chaos Fault. Known values are: + "Enable" and "Disable". + :vartype action: Union[str, "SupportedActions"] + :ivar region: Region of the account where the Chaos Fault is to be enabled/disabled. + :vartype region: str + :ivar databaseName: Database name. + :vartype databaseName: str + :ivar containerName: Container name. + :vartype containerName: str + :ivar provisioningState: A provisioning state of the Chaos Fault. + :vartype provisioningState: str + """ + + action: Union[str, "SupportedActions"] + """Indicates whether what action to take for the Chaos Fault. Known values are: \"Enable\" and + \"Disable\".""" + region: str + """Region of the account where the Chaos Fault is to be enabled/disabled.""" + databaseName: str + """Database name.""" + containerName: str + """Container name.""" + provisioningState: str + """A provisioning state of the Chaos Fault.""" + + +class ChaosFaultResource(ProxyResource): + """A request object to enable/disable the chaos fault. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar properties: A request object to enable/disable the chaos fault. + :vartype properties: "ChaosFaultProperties" + """ + + properties: "ChaosFaultProperties" + """A request object to enable/disable the chaos fault.""" + + class ClientEncryptionIncludedPath(TypedDict, total=False): """. :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. + :ivar clientEncryptionKeyId: The identifier of the Client Encryption Key to be used to encrypt + the path. Required. + :vartype clientEncryptionKeyId: str + :ivar encryptionType: 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 - + :vartype encryptionType: str + :ivar encryptionAlgorithm: The encryption algorithm which will be used. Eg - AEAD_AES_256_CBC_HMAC_SHA256. Required. - :vartype encryption_algorithm: str + :vartype encryptionAlgorithm: str """ path: Required[str] @@ -1068,30 +1024,20 @@ class ClientEncryptionKeyCreateUpdateProperties(TypedDict, total=False): # pyli """The standard JSON format of a ClientEncryptionKey. Required.""" -class ClientEncryptionKeyGetProperties(TypedDict, total=False): - """The properties of a ClientEncryptionKey resource. - - :ivar resource: - :vartype resource: "ClientEncryptionKeyGetPropertiesResource" - """ - - resource: "ClientEncryptionKeyGetPropertiesResource" - - class ClientEncryptionKeyResource(TypedDict, total=False): """Cosmos DB client encryption key resource object. :ivar id: Name of the ClientEncryptionKey. :vartype id: str - :ivar encryption_algorithm: Encryption algorithm that will be used along with this client + :ivar encryptionAlgorithm: 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 + :vartype encryptionAlgorithm: str + :ivar wrappedDataEncryptionKey: Wrapped (encrypted) form of the key represented as a byte array. - :vartype wrapped_data_encryption_key: str - :ivar key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the + :vartype wrappedDataEncryptionKey: str + :ivar keyWrapMetadata: Metadata for the wrapping provider that can be used to unwrap the wrapped client encryption key. - :vartype key_wrap_metadata: "KeyWrapMetadata" + :vartype keyWrapMetadata: "KeyWrapMetadata" """ id: str @@ -1106,69 +1052,15 @@ class ClientEncryptionKeyResource(TypedDict, total=False): key.""" -class ClientEncryptionKeyGetPropertiesResource(ClientEncryptionKeyResource): - """ClientEncryptionKeyGetPropertiesResource. - - :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: str - :ivar key_wrap_metadata: Metadata for the wrapping provider that can be used to unwrap the - wrapped client encryption key. - :vartype key_wrap_metadata: "KeyWrapMetadata" - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class ClientEncryptionKeyGetResults(ProxyResource): - """Client Encryption Key. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of a ClientEncryptionKey. - :vartype properties: "ClientEncryptionKeyGetProperties" - """ - - properties: "ClientEncryptionKeyGetProperties" - """The properties of a ClientEncryptionKey.""" - - class ClientEncryptionPolicy(TypedDict, total=False): """Cosmos DB client encryption policy. - :ivar included_paths: Paths of the item that need encryption along with path-specific settings. + :ivar includedPaths: Paths of the item that need encryption along with path-specific settings. Required. - :vartype included_paths: list["ClientEncryptionIncludedPath"] - :ivar policy_format_version: Version of the client encryption policy definition. Supported + :vartype includedPaths: list["ClientEncryptionIncludedPath"] + :ivar policyFormatVersion: 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 + :vartype policyFormatVersion: int """ includedPaths: Required[list["ClientEncryptionIncludedPath"]] @@ -1178,25 +1070,14 @@ class ClientEncryptionPolicy(TypedDict, total=False): supports id and partition key path encryption. Required.""" -class CloudError(TypedDict, total=False): - """An error response from the service. - - :ivar error: Error Response. - :vartype error: "ErrorResponseAutoGenerated" - """ - - error: "ErrorResponseAutoGenerated" - """Error Response.""" - - class ClusterKey(TypedDict, total=False): """Cosmos DB Cassandra table cluster key. :ivar name: Name of the Cosmos DB Cassandra table cluster key. :vartype name: str - :ivar order_by: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and + :ivar orderBy: Order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". - :vartype order_by: str + :vartype orderBy: str """ name: str @@ -1216,9 +1097,9 @@ class ClusterResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties of a managed Cassandra cluster. :vartype properties: "ClusterResourceProperties" :ivar location: The location of the resource group to which the resource belongs. @@ -1252,89 +1133,91 @@ class ClusterResource(ProxyResource): class ClusterResourceProperties(TypedDict, total=False): """Properties of a managed Cassandra cluster. - :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: Union[str, "ManagedCassandraProvisioningState"] - :ivar restore_from_backup_id: To create an empty cluster, omit this field or set it to null. To + :ivar provisioningState: The status of the resource at the time the operation was called. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioningState: Union[str, "ManagedCassandraProvisioningState"] + :ivar restoreFromBackupId: 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 + :vartype restoreFromBackupId: str + :ivar delegatedManagementSubnetId: 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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. - :vartype delegated_management_subnet_id: str - :ivar cassandra_version: Which version of Cassandra should this cluster converge to running + :vartype delegatedManagementSubnetId: str + :ivar cassandraVersion: 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 + :vartype cassandraVersion: str + :ivar clusterNameOverride: 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 + :vartype clusterNameOverride: str + :ivar authenticationMethod: 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: Union[str, "AuthenticationMethod"] - :ivar initial_cassandra_admin_password: Initial password for clients connecting as admin to the + :vartype authenticationMethod: Union[str, "AuthenticationMethod"] + :ivar initialCassandraAdminPassword: 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 + :vartype initialCassandraAdminPassword: str + :ivar prometheusEndpoint: Hostname or IP address where the Prometheus endpoint containing data about the managed Cassandra nodes can be reached. - :vartype prometheus_endpoint: "SeedNode" - :ivar repair_enabled: Should automatic repairs run on this cluster? If omitted, this is true, + :vartype prometheusEndpoint: "SeedNode" + :ivar repairEnabled: 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: Union[str, "AutoReplicate"] - :ivar client_certificates: List of TLS certificates used to authorize clients connecting to the + :vartype repairEnabled: bool + :ivar autoReplicate: The form of AutoReplicate that is being used by this cluster. Known values + are: "None", "SystemKeyspaces", and "AllKeyspaces". + :vartype autoReplicate: Union[str, "AutoReplicate"] + :ivar clientCertificates: 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["Certificate"] - :ivar external_gossip_certificates: List of TLS certificates used to authorize gossip from + :vartype clientCertificates: list["Certificate"] + :ivar externalGossipCertificates: 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["Certificate"] - :ivar gossip_certificates: List of TLS certificates that unmanaged nodes must trust for gossip + :vartype externalGossipCertificates: list["Certificate"] + :ivar gossipCertificates: 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["Certificate"] - :ivar external_seed_nodes: List of IP addresses of seed nodes in unmanaged data centers. These + :vartype gossipCertificates: list["Certificate"] + :ivar externalSeedNodes: 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["SeedNode"] - :ivar seed_nodes: List of IP addresses of seed nodes in the managed data centers. These should + :vartype externalSeedNodes: list["SeedNode"] + :ivar seedNodes: 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["SeedNode"] - :ivar external_data_centers: List of the data center names for unmanaged data centers in this + :vartype seedNodes: list["SeedNode"] + :ivar externalDataCenters: 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 + :vartype externalDataCenters: list[str] + :ivar hoursBetweenBackups: (Deprecated) Number of hours to wait between taking a backup of the + cluster. + :vartype hoursBetweenBackups: 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: "CassandraError" + :ivar cassandraAuditLoggingEnabled: Whether Cassandra audit logging is enabled. + :vartype cassandraAuditLoggingEnabled: bool + :ivar clusterType: Type of the cluster. If set to Production, some operations might not be + permitted on cluster. Known values are: "Production" and "NonProduction". + :vartype clusterType: Union[str, "ClusterType"] + :ivar provisionError: Error related to resource provisioning. + :vartype provisionError: "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["BackupSchedule"] - :ivar scheduled_event_strategy: How the nodes in the cluster react to scheduled events. Known + :ivar backupSchedules: List of backup schedules that define when you want to back up your data. + :vartype backupSchedules: list["BackupSchedule"] + :ivar scheduledEventStrategy: How the nodes in the cluster react to scheduled events. Known values are: "Ignore", "StopAny", and "StopByRack". - :vartype scheduled_event_strategy: Union[str, "ScheduledEventStrategy"] - :ivar azure_connection_method: How to connect to the azure services needed for running the + :vartype scheduledEventStrategy: Union[str, "ScheduledEventStrategy"] + :ivar azureConnectionMethod: How to connect to the azure services needed for running the cluster. Known values are: "None" and "VPN". - :vartype azure_connection_method: Union[str, "AzureConnectionType"] - :ivar private_link_resource_id: If the Connection Method is Vpn, this is the Id of the private + :vartype azureConnectionMethod: Union[str, "AzureConnectionType"] + :ivar privateLinkResourceId: 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 + :vartype privateLinkResourceId: str """ provisioningState: Union[str, "ManagedCassandraProvisioningState"] @@ -1401,6 +1284,9 @@ class ClusterResourceProperties(TypedDict, total=False): """Whether the cluster and associated data centers has been deallocated.""" cassandraAuditLoggingEnabled: bool """Whether Cassandra audit logging is enabled.""" + clusterType: Union[str, "ClusterType"] + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" provisionError: "CassandraError" """Error related to resource provisioning.""" extensions: list[str] @@ -1433,15 +1319,32 @@ class Column(TypedDict, total=False): """Type of the Cosmos DB Cassandra table column.""" -class CommandOutput(TypedDict, total=False): - """Response of /command api. - - :ivar command_output: Output of the command. - :vartype command_output: str - """ +CommandAsyncPostBody = TypedDict( + "CommandAsyncPostBody", + { + "command": Required[str], + "arguments": Any, + "host": Required[str], + "cassandra-stop-start": bool, + "readWrite": bool, + }, + total=False, +) +CommandAsyncPostBody.__doc__ = """Specification of which command to run where. - commandOutput: str - """Output of the command.""" +:ivar command: The command which should be run. Required. +:vartype command: str +:ivar arguments: The arguments for the command to be run. +:vartype arguments: Any +: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 +""" CommandPostBody = TypedDict( @@ -1463,9 +1366,9 @@ class CommandOutput(TypedDict, total=False): :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 +:ivar cassandra-stop-start: If true, stops cassandra before executing the command and then start it again. -:vartype cassandra_stop_start: bool +:vartype cassandra-stop-start: bool :ivar readwrite: If true, allows the command to *write* to the cassandra directory, otherwise read-only. :vartype readwrite: bool @@ -1512,12 +1415,11 @@ class ConflictResolutionPolicy(TypedDict, total=False): :ivar mode: Indicates the conflict resolution mode. Known values are: "LastWriterWins" and "Custom". :vartype mode: Union[str, "ConflictResolutionMode"] - :ivar conflict_resolution_path: The conflict resolution path in the case of LastWriterWins + :ivar conflictResolutionPath: The conflict resolution path in the case of LastWriterWins mode. + :vartype conflictResolutionPath: str + :ivar conflictResolutionProcedure: The procedure to resolve conflicts in the case of custom 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 + :vartype conflictResolutionProcedure: str """ mode: Union[str, "ConflictResolutionMode"] @@ -1528,52 +1430,21 @@ class ConflictResolutionPolicy(TypedDict, total=False): """The procedure to resolve conflicts in the case of custom mode.""" -class ConnectionError(TypedDict, total=False): - """ConnectionError. +class ConsistencyPolicy(TypedDict, total=False): + """The consistency policy for the Cosmos DB database account. - :ivar connection_state: The kind of connection error that occurred. Known values are: - "Unknown", "OK", "OperatorToDataCenterNetworkError", "DatacenterToDatacenterNetworkError", - "InternalOperatorToDataCenterCertificateError", and "InternalError". - :vartype connection_state: Union[str, "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 - """ - - connectionState: Union[str, "ConnectionState"] - """The kind of connection error that occurred. Known values are: \"Unknown\", \"OK\", - \"OperatorToDataCenterNetworkError\", \"DatacenterToDatacenterNetworkError\", - \"InternalOperatorToDataCenterCertificateError\", and \"InternalError\".""" - iPFrom: str - """The IP of host that originated the failed connection.""" - iPTo: str - """The IP that the connection attempted to reach.""" - port: int - """The TCP port the connection was attempted on.""" - exception: str - """Detailed error message about the failed connection.""" - - -class ConsistencyPolicy(TypedDict, total=False): - """The consistency policy for the Cosmos DB database account. - - :ivar default_consistency_level: The default consistency level and configuration settings of - the Cosmos DB account. Required. Known values are: "Eventual", "Session", "BoundedStaleness", + :ivar defaultConsistencyLevel: 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: Union[str, "DefaultConsistencyLevel"] - :ivar max_staleness_prefix: When used with the Bounded Staleness consistency level, this value + :vartype defaultConsistencyLevel: Union[str, "DefaultConsistencyLevel"] + :ivar maxStalenessPrefix: 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 + :vartype maxStalenessPrefix: int + :ivar maxIntervalInSeconds: 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 maxIntervalInSeconds: int """ defaultConsistencyLevel: Required[Union[str, "DefaultConsistencyLevel"]] @@ -1602,8 +1473,8 @@ class ContainerPartitionKey(TypedDict, total=False): :vartype kind: Union[str, "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 systemKey: Indicates if the container is using a system generated partition key. + :vartype systemKey: bool """ paths: list[str] @@ -1618,17 +1489,6 @@ class ContainerPartitionKey(TypedDict, total=False): """Indicates if the container is using a system generated partition key.""" -class ContinuousBackupInformation(TypedDict, total=False): - """Information about the status of continuous backups. - - :ivar latest_restorable_timestamp: The latest restorable timestamp for a resource. - :vartype latest_restorable_timestamp: str - """ - - latestRestorableTimestamp: str - """The latest restorable timestamp for a resource.""" - - class ContinuousBackupRestoreLocation(TypedDict, total=False): """Properties of the regional restorable account. @@ -1643,11 +1503,11 @@ class ContinuousBackupRestoreLocation(TypedDict, total=False): class ContinuousModeBackupPolicy(TypedDict, total=False): """The object representing continuous mode backup policy. - :ivar migration_state: The object representing the state of the migration between the backup + :ivar migrationState: The object representing the state of the migration between the backup policies. - :vartype migration_state: "BackupPolicyMigrationState" - :ivar continuous_mode_properties: Configuration values for continuous mode backup. - :vartype continuous_mode_properties: "ContinuousModeProperties" + :vartype migrationState: "BackupPolicyMigrationState" + :ivar continuousModeProperties: Configuration values for continuous mode backup. + :vartype continuousModeProperties: "ContinuousModeProperties" :ivar type: Describes the mode of backups. Required. CONTINUOUS. :vartype type: Literal[BackupPolicyType.CONTINUOUS] """ @@ -1663,34 +1523,101 @@ class ContinuousModeBackupPolicy(TypedDict, total=False): class ContinuousModeProperties(TypedDict, total=False): """Configuration values for periodic mode backup. - :ivar tier: Enum to indicate type of Continuos backup mode. Known values are: "Continuous7Days" - and "Continuous30Days". + :ivar tier: Enum to indicate type of Continuos backup mode. Known values are: + "Continuous7Days", "Continuous30Days", and "Continuous35Days". :vartype tier: Union[str, "ContinuousTier"] """ tier: Union[str, "ContinuousTier"] - """Enum to indicate type of Continuos backup mode. Known values are: \"Continuous7Days\" and - \"Continuous30Days\".""" + """Enum to indicate type of Continuos backup mode. Known values are: \"Continuous7Days\", + \"Continuous30Days\", and \"Continuous35Days\".""" + + +class CopyJobGetResults(ProxyResource): + """A Cosmos DB Copy Job. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar properties: The properties of a Copy Job. Required. + :vartype properties: "CopyJobProperties" + """ + + properties: Required["CopyJobProperties"] + """The properties of a Copy Job. Required.""" + + +class CopyJobProperties(TypedDict, total=False): + """The properties of a Copy Job. + + :ivar jobProperties: Job Properties. Required. + :vartype jobProperties: "BaseCopyJobProperties" + :ivar status: Job Status. Known values are: "Pending", "Partitioning", "Running", "Paused", + "Completed", "Faulted", and "Cancelled". + :vartype status: Union[str, "CopyJobStatus"] + :ivar processedCount: Processed Count. + :vartype processedCount: int + :ivar totalCount: Total Count. + :vartype totalCount: int + :ivar lastUpdatedUtcTime: Last Updated Time (ISO-8601 format). + :vartype lastUpdatedUtcTime: str + :ivar workerCount: Worker count. + :vartype workerCount: int + :ivar error: Error response for Faulted job. + :vartype error: "ErrorResponse" + :ivar duration: Total Duration of Job. + :vartype duration: str + :ivar mode: Mode of job execution. Known values are: "Offline" and "Online". + :vartype mode: Union[str, "CopyJobMode"] + """ + + jobProperties: Required["BaseCopyJobProperties"] + """Job Properties. Required.""" + status: Union[str, "CopyJobStatus"] + """Job Status. Known values are: \"Pending\", \"Partitioning\", \"Running\", \"Paused\", + \"Completed\", \"Faulted\", and \"Cancelled\".""" + processedCount: int + """Processed Count.""" + totalCount: int + """Total Count.""" + lastUpdatedUtcTime: str + """Last Updated Time (ISO-8601 format).""" + workerCount: int + """Worker count.""" + error: "ErrorResponse" + """Error response for Faulted job.""" + duration: str + """Total Duration of Job.""" + mode: Union[str, "CopyJobMode"] + """Mode of job execution. Known values are: \"Offline\" and \"Online\".""" class CorsPolicy(TypedDict, total=False): """The CORS policy for the Cosmos DB database account. - :ivar allowed_origins: The origin domains that are permitted to make a request against the + :ivar allowedOrigins: 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 + :vartype allowedOrigins: str + :ivar allowedMethods: 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 + :vartype allowedMethods: str + :ivar allowedHeaders: 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 + :vartype allowedHeaders: str + :ivar exposedHeaders: The response headers that may be sent in the response to the CORS request + and exposed by the browser to the request issuer. + :vartype exposedHeaders: str + :ivar maxAgeInSeconds: The maximum amount time that a browser should cache the preflight OPTIONS request. - :vartype max_age_in_seconds: int + :vartype maxAgeInSeconds: int """ allowedOrigins: Required[str] @@ -1706,15 +1633,194 @@ class CorsPolicy(TypedDict, total=False): """The maximum amount time that a browser should cache the preflight OPTIONS request.""" +class CosmosCassandraDataTransferDataSourceSink(TypedDict, total=False): # pylint: disable=name-too-long + """A CosmosDB Cassandra API data source/sink. + + :ivar remoteAccountName: + :vartype remoteAccountName: str + :ivar keyspaceName: Required. + :vartype keyspaceName: str + :ivar tableName: Required. + :vartype tableName: str + :ivar component: Required. COSMOS_DB_CASSANDRA. + :vartype component: Literal[DataTransferComponent.COSMOS_DB_CASSANDRA] + """ + + remoteAccountName: str + keyspaceName: Required[str] + """Required.""" + tableName: Required[str] + """Required.""" + component: Required[Literal[DataTransferComponent.COSMOS_DB_CASSANDRA]] + """Required. COSMOS_DB_CASSANDRA.""" + + +class CosmosDBCassandraTable(TypedDict, total=False): + """A CosmosDB Cassandra table. + + :ivar keyspaceName: Azure Cosmos DB for Apache Cassandra keyspace. Required. + :vartype keyspaceName: str + :ivar tableName: Azure Cosmos DB for Apache Cassandra table. Required. + :vartype tableName: str + """ + + keyspaceName: Required[str] + """Azure Cosmos DB for Apache Cassandra keyspace. Required.""" + tableName: Required[str] + """Azure Cosmos DB for Apache Cassandra table. Required.""" + + +class CosmosDBMongoCollection(TypedDict, total=False): + """A CosmosDB Mongo collection. + + :ivar databaseName: Azure Cosmos DB for MongoDB (RU) database. Required. + :vartype databaseName: str + :ivar collectionName: Azure Cosmos DB for MongoDB (RU) collection. Required. + :vartype collectionName: str + """ + + databaseName: Required[str] + """Azure Cosmos DB for MongoDB (RU) database. Required.""" + collectionName: Required[str] + """Azure Cosmos DB for MongoDB (RU) collection. Required.""" + + +class CosmosDBMongoVCoreCollection(TypedDict, total=False): + """A CosmosDB Mongo vCore collection. + + :ivar databaseName: Azure Cosmos DB for MongoDB (vCore) database. Required. + :vartype databaseName: str + :ivar collectionName: Azure Cosmos DB for MongoDB (vCore) collection. Required. + :vartype collectionName: str + """ + + databaseName: Required[str] + """Azure Cosmos DB for MongoDB (vCore) database. Required.""" + collectionName: Required[str] + """Azure Cosmos DB for MongoDB (vCore) collection. Required.""" + + +class CosmosDBNoSqlContainer(TypedDict, total=False): + """A CosmosDB NoSQL container. + + :ivar databaseName: Azure Cosmos DB for NoSQL database. Required. + :vartype databaseName: str + :ivar containerName: Azure Cosmos DB for NoSQL container. Required. + :vartype containerName: str + """ + + databaseName: Required[str] + """Azure Cosmos DB for NoSQL database. Required.""" + containerName: Required[str] + """Azure Cosmos DB for NoSQL container. Required.""" + + +class CosmosDBSourceSinkDetails(TypedDict, total=False): + """A CosmosDB data source/sink details. + + :ivar remoteAccountName: Name of remote account in case of cross-account data transfer. + :vartype remoteAccountName: str + """ + + remoteAccountName: str + """Name of remote account in case of cross-account data transfer.""" + + +class CosmosMongoDataTransferDataSourceSink(TypedDict, total=False): + """A CosmosDB Mongo API data source/sink. + + :ivar remoteAccountName: + :vartype remoteAccountName: str + :ivar databaseName: Required. + :vartype databaseName: str + :ivar collectionName: Required. + :vartype collectionName: str + :ivar component: Required. COSMOS_DB_MONGO. + :vartype component: Literal[DataTransferComponent.COSMOS_DB_MONGO] + """ + + remoteAccountName: str + databaseName: Required[str] + """Required.""" + collectionName: Required[str] + """Required.""" + component: Required[Literal[DataTransferComponent.COSMOS_DB_MONGO]] + """Required. COSMOS_DB_MONGO.""" + + +class CosmosMongoVCoreDataTransferDataSourceSink(TypedDict, total=False): # pylint: disable=name-too-long + """A CosmosDB Mongo vCore API data source/sink. + + :ivar databaseName: Required. + :vartype databaseName: str + :ivar collectionName: Required. + :vartype collectionName: str + :ivar hostName: + :vartype hostName: str + :ivar connectionStringKeyVaultUri: + :vartype connectionStringKeyVaultUri: str + :ivar component: Required. COSMOS_DB_MONGO_V_CORE. + :vartype component: Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE] + """ + + databaseName: Required[str] + """Required.""" + collectionName: Required[str] + """Required.""" + hostName: str + connectionStringKeyVaultUri: str + component: Required[Literal[DataTransferComponent.COSMOS_DB_MONGO_V_CORE]] + """Required. COSMOS_DB_MONGO_V_CORE.""" + + +class CosmosSqlDataTransferDataSourceSink(TypedDict, total=False): + """A CosmosDB No Sql API data source/sink. + + :ivar remoteAccountName: + :vartype remoteAccountName: str + :ivar databaseName: Required. + :vartype databaseName: str + :ivar containerName: Required. + :vartype containerName: str + :ivar component: Required. COSMOS_DB_SQL. + :vartype component: Literal[DataTransferComponent.COSMOS_DB_SQL] + """ + + remoteAccountName: str + databaseName: Required[str] + """Required.""" + containerName: Required[str] + """Required.""" + component: Required[Literal[DataTransferComponent.COSMOS_DB_SQL]] + """Required. COSMOS_DB_SQL.""" + + +class CreateJobRequest(ARMProxyResource): + """Parameters to create Data Transfer Job. + + :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: "DataTransferJobProperties" + """ + + properties: Required["DataTransferJobProperties"] + """Data Transfer Create Job Properties. Required.""" + + class CreateUpdateOptions(TypedDict, total=False): """CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput". :ivar throughput: Request Units per second. For example, "throughput": 10000. :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. Note: Either throughput or + :ivar autoscaleSettings: Specifies the Autoscale settings. Note: Either throughput or autoscaleSettings is required, but not both. - :vartype autoscale_settings: "AutoscaleSettings" + :vartype autoscaleSettings: "AutoscaleSettings" """ throughput: int @@ -1724,35 +1830,6 @@ class CreateUpdateOptions(TypedDict, total=False): not both.""" -class DatabaseAccountConnectionString(TypedDict, total=False): - """Connection string for the Cosmos DB account. - - :ivar connection_string: Value of the connection string. - :vartype connection_string: str - :ivar description: Description of the connection string. - :vartype description: str - :ivar key_kind: Kind of the connection string key. Known values are: "Primary", "Secondary", - "PrimaryReadonly", and "SecondaryReadonly". - :vartype key_kind: Union[str, "Kind"] - :ivar type: Type of the connection string. Known values are: "Sql", "Table", "MongoDB", - "Cassandra", "CassandraConnectorMetadata", "Gremlin", "SqlDedicatedGateway", "GremlinV2", and - "Undefined". - :vartype type: Union[str, "Type"] - """ - - connectionString: str - """Value of the connection string.""" - description: str - """Description of the connection string.""" - keyKind: Union[str, "Kind"] - """Kind of the connection string key. Known values are: \"Primary\", \"Secondary\", - \"PrimaryReadonly\", and \"SecondaryReadonly\".""" - type: Union[str, "Type"] - """Type of the connection string. Known values are: \"Sql\", \"Table\", \"MongoDB\", - \"Cassandra\", \"CassandraConnectorMetadata\", \"Gremlin\", \"SqlDedicatedGateway\", - \"GremlinV2\", and \"Undefined\".""" - - class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): """Parameters to create and update Cosmos DB database accounts. @@ -1790,106 +1867,120 @@ class DatabaseAccountCreateUpdateParameters(ARMResourceProperties): class DatabaseAccountCreateUpdateProperties(TypedDict, total=False): """Properties to create and update Azure Cosmos DB database accounts. - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: "ConsistencyPolicy" + :ivar consistencyPolicy: The consistency policy for the Cosmos DB account. + :vartype consistencyPolicy: "ConsistencyPolicy" :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB account. Required. :vartype locations: list["Location"] - :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Required. + :ivar databaseAccountOfferType: The offer type for the Cosmos DB database account. Required. Default value is "Standard". - :vartype database_account_offer_type: Literal["Standard"] - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list["IpAddressOrRange"] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the + :vartype databaseAccountOfferType: Literal["Standard"] + :ivar ipRules: List of IpRules. + :vartype ipRules: list["IpAddressOrRange"] + :ivar isVirtualNetworkFilterEnabled: Flag to indicate whether to enable/disable Virtual Network + ACL rules. + :vartype isVirtualNetworkFilterEnabled: bool + :ivar enableAutomaticFailover: Enables automatic failover of the write region in the rare event + that the region is unavailable due to an outage. Automatic failover will result in a new write + region for the account and is chosen based on the failover priorities configured for the account. - :vartype enable_automatic_failover: bool + :vartype enableAutomaticFailover: bool :ivar capabilities: List of Cosmos DB capabilities for the account. :vartype capabilities: list["Capability"] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + :ivar virtualNetworkRules: List of Virtual Network ACL rules configured for the Cosmos DB account. - :vartype virtual_network_rules: list["VirtualNetworkRule"] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. "Small" - :vartype connector_offer: Union[str, "ConnectorOffer"] - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + :vartype virtualNetworkRules: list["VirtualNetworkRule"] + :ivar enableMultipleWriteLocations: Enables the account to write in multiple locations. + :vartype enableMultipleWriteLocations: bool + :ivar enableCassandraConnector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enableCassandraConnector: bool + :ivar connectorOffer: The cassandra connector offer type for the Cosmos DB database C* account. + "Small" + :vartype connectorOffer: Union[str, "ConnectorOffer"] + :ivar disableKeyBasedMetadataWriteAccess: Disable write operations on metadata resources (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like + :vartype disableKeyBasedMetadataWriteAccess: bool + :ivar keyVaultKeyUri: The URI of the key vault. + :vartype keyVaultKeyUri: str + :ivar defaultIdentity: The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled", "Disabled", and "SecuredByPerimeter". - :vartype public_network_access: Union[str, "PublicNetworkAccess"] - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: "ApiProperties" - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: "AnalyticalStorageConfiguration" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + :vartype defaultIdentity: str + :ivar publicNetworkAccess: Whether requests from Public Network are allowed. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype publicNetworkAccess: Union[str, "PublicNetworkAccess"] + :ivar enableFreeTier: Flag to indicate whether Free Tier is enabled. + :vartype enableFreeTier: bool + :ivar apiProperties: API specific properties. Currently, supported only for MongoDB API. + :vartype apiProperties: "ApiProperties" + :ivar enableAnalyticalStorage: Flag to indicate whether to enable storage analytics. + :vartype enableAnalyticalStorage: bool + :ivar analyticalStorageConfiguration: Analytical storage specific properties. + :vartype analyticalStorageConfiguration: "AnalyticalStorageConfiguration" + :ivar createMode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: "BackupPolicy" + :vartype createMode: Union[str, "CreateMode"] + :ivar backupPolicy: The object representing the policy for taking backups on an account. + :vartype backupPolicy: "BackupPolicy" :ivar cors: The CORS policy for the Cosmos DB database account. :vartype cors: list["CorsPolicy"] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + :ivar networkAclBypass: Indicates what services are allowed to bypass firewall checks. Known values are: "None" and "AzureServices". - :vartype network_acl_bypass: Union[str, "NetworkAclBypass"] - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + :vartype networkAclBypass: Union[str, "NetworkAclBypass"] + :ivar networkAclBypassResourceIds: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "RestoreParameters" + :vartype networkAclBypassResourceIds: list[str] + :ivar diagnosticLogSettings: The Object representing the different Diagnostic log settings for + the Cosmos DB Account. + :vartype diagnosticLogSettings: "DiagnosticLogSettings" + :ivar disableLocalAuth: Opt-out of local authentication and ensure only MSI and AAD can be used + exclusively for authentication. + :vartype disableLocalAuth: bool + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "RestoreParameters" :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: "Capacity" - :ivar keys_metadata: This property is ignored during the update/create operation, as the + :ivar capacityMode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :vartype capacityMode: Union[str, "CapacityMode"] + :ivar enableMaterializedViews: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :vartype enableMaterializedViews: bool + :ivar keysMetadata: 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. - :vartype keys_metadata: "DatabaseAccountKeysMetadata" - :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on + :vartype keysMetadata: "DatabaseAccountKeysMetadata" + :ivar enablePartitionMerge: Flag to indicate enabling/disabling of Partition Merge feature on the account. - :vartype enable_partition_merge: bool - :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + :vartype enablePartitionMerge: bool + :ivar enableBurstCapacity: 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, + :vartype enableBurstCapacity: bool + :ivar minimalTlsVersion: 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: Union[str, "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 + :vartype minimalTlsVersion: Union[str, "MinimalTlsVersion"] + :ivar customerManagedKeyStatus: Indicates the status of the Customer Managed Key feature on the + account. In case there are errors, the property provides troubleshooting guidance. + :vartype customerManagedKeyStatus: str + :ivar enablePriorityBasedExecution: 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 + :vartype enablePriorityBasedExecution: bool + :ivar defaultPriorityLevel: Enum to indicate default Priority Level of request for Priority Based Execution. Known values are: "High" and "Low". - :vartype default_priority_level: Union[str, "DefaultPriorityLevel"] - :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - Per-Region Per-partition autoscale Preview feature on the account. - :vartype enable_per_region_per_partition_autoscale: bool - :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of + :vartype defaultPriorityLevel: Union[str, "DefaultPriorityLevel"] + :ivar enablePerRegionPerPartitionAutoscale: Flag to indicate enabling/disabling of Per-Region + Per-partition autoscale Preview feature on the account. + :vartype enablePerRegionPerPartitionAutoscale: bool + :ivar enableAllVersionsAndDeletesChangeFeed: Flag to indicate if All Versions and Deletes + Change feed feature is enabled on the account. + :vartype enableAllVersionsAndDeletesChangeFeed: bool + :ivar softDeleteConfiguration: The configuration for soft delete on the Cosmos DB account. + :vartype softDeleteConfiguration: "SoftDeleteConfiguration" + :ivar enforceHierarchicalPartitionKeyIdLastLevel: Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. - :vartype enforce_hierarchical_partition_key_id_last_level: bool + :vartype enforceHierarchicalPartitionKeyIdLastLevel: bool """ consistencyPolicy: "ConsistencyPolicy" @@ -1948,6 +2039,8 @@ class DatabaseAccountCreateUpdateProperties(TypedDict, total=False): \"AzureServices\".""" networkAclBypassResourceIds: list[str] """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" + diagnosticLogSettings: "DiagnosticLogSettings" + """The Object representing the different Diagnostic log settings for the Cosmos DB Account.""" disableLocalAuth: bool """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication.""" @@ -1955,6 +2048,11 @@ class DatabaseAccountCreateUpdateProperties(TypedDict, total=False): """Parameters to indicate the information about the restore.""" capacity: "Capacity" """The object that represents all properties related to capacity enforcement on an account.""" + capacityMode: Union[str, "CapacityMode"] + """Indicates the capacityMode of the Cosmos DB account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + enableMaterializedViews: bool + """Flag to indicate whether to enable MaterializedViews on the Cosmos DB account.""" keysMetadata: "DatabaseAccountKeysMetadata" """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.""" @@ -1976,141 +2074,207 @@ class DatabaseAccountCreateUpdateProperties(TypedDict, total=False): enablePerRegionPerPartitionAutoscale: bool """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account.""" + enableAllVersionsAndDeletesChangeFeed: bool + """Flag to indicate if All Versions and Deletes Change feed feature is enabled on the account.""" + softDeleteConfiguration: "SoftDeleteConfiguration" + """The configuration for soft delete on the Cosmos DB account.""" enforceHierarchicalPartitionKeyIdLastLevel: bool """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account.""" -class DatabaseAccountGetProperties(TypedDict, total=False): - """Properties for the database account. - - :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 - :ivar database_account_offer_type: The offer type for the Cosmos DB database account. Default - value: Standard. Default value is "Standard". - :vartype database_account_offer_type: Literal["Standard"] - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list["IpAddressOrRange"] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the +class DatabaseAccountKeysMetadata(TypedDict, total=False): + """The metadata related to each access key for the given Cosmos DB database account. + + :ivar primaryMasterKey: The metadata related to the Primary Read-Write Key for the given Cosmos + DB database account. + :vartype primaryMasterKey: "AccountKeyMetadata" + :ivar secondaryMasterKey: The metadata related to the Secondary Read-Write Key for the given + Cosmos DB database account. + :vartype secondaryMasterKey: "AccountKeyMetadata" + :ivar primaryReadonlyMasterKey: The metadata related to the Primary Read-Only Key for the given + Cosmos DB database account. + :vartype primaryReadonlyMasterKey: "AccountKeyMetadata" + :ivar secondaryReadonlyMasterKey: The metadata related to the Secondary Read-Only Key for the + given Cosmos DB database account. + :vartype secondaryReadonlyMasterKey: "AccountKeyMetadata" + """ + + primaryMasterKey: "AccountKeyMetadata" + """The metadata related to the Primary Read-Write Key for the given Cosmos DB database account.""" + secondaryMasterKey: "AccountKeyMetadata" + """The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account.""" + primaryReadonlyMasterKey: "AccountKeyMetadata" + """The metadata related to the Primary Read-Only Key for the given Cosmos DB database account.""" + secondaryReadonlyMasterKey: "AccountKeyMetadata" + """The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account.""" + + +class DatabaseAccountRegenerateKeyParameters(TypedDict, total=False): + """Parameters to regenerate the keys within the database account. + + :ivar keyKind: The access key to regenerate. Required. Known values are: "primary", + "secondary", "primaryReadonly", and "secondaryReadonly". + :vartype keyKind: Union[str, "KeyKind"] + :ivar skipAccountKeysLastUsageCheck: Optional flag indicating whether to skip account keys last + usage check. + :vartype skipAccountKeysLastUsageCheck: bool + """ + + keyKind: Required[Union[str, "KeyKind"]] + """The access key to regenerate. Required. Known values are: \"primary\", \"secondary\", + \"primaryReadonly\", and \"secondaryReadonly\".""" + skipAccountKeysLastUsageCheck: bool + """Optional flag indicating whether to skip account keys last usage check.""" + + +class DatabaseAccountUpdateParameters(TypedDict, total=False): + """Parameters for patching Azure Cosmos DB database account properties. + + :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 location: The location of the resource group to which the resource belongs. + :vartype location: str + :ivar identity: Identity for the resource. + :vartype identity: "ManagedServiceIdentity" + :ivar properties: Properties to update Azure Cosmos DB database accounts. + :vartype properties: "DatabaseAccountUpdateProperties" + """ + + tags: dict[str, str] + """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\".""" + location: str + """The location of the resource group to which the resource belongs.""" + identity: "ManagedServiceIdentity" + """Identity for the resource.""" + properties: "DatabaseAccountUpdateProperties" + """Properties to update Azure Cosmos DB database accounts.""" + + +class DatabaseAccountUpdateProperties(TypedDict, total=False): + """Properties to update Azure Cosmos DB database accounts. + + :ivar consistencyPolicy: The consistency policy for the Cosmos DB account. + :vartype consistencyPolicy: "ConsistencyPolicy" + :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB + account. + :vartype locations: list["Location"] + :ivar ipRules: List of IpRules. + :vartype ipRules: list["IpAddressOrRange"] + :ivar isVirtualNetworkFilterEnabled: Flag to indicate whether to enable/disable Virtual Network + ACL rules. + :vartype isVirtualNetworkFilterEnabled: bool + :ivar enableAutomaticFailover: Enables automatic failover of the write region in the rare event + that the region is unavailable due to an outage. Automatic failover will result in a new write + region for the account and is chosen based on the failover priorities configured for the account. - :vartype enable_automatic_failover: bool - :ivar consistency_policy: The consistency policy for the Cosmos DB database account. - :vartype consistency_policy: "ConsistencyPolicy" + :vartype enableAutomaticFailover: bool :ivar capabilities: List of Cosmos DB capabilities for the account. :vartype capabilities: list["Capability"] - :ivar write_locations: An array that contains the write location for the Cosmos DB account. - :vartype write_locations: list["Location"] - :ivar read_locations: An array that contains of the read locations enabled for the Cosmos DB - account. - :vartype read_locations: list["Location"] - :ivar locations: An array that contains all of the locations enabled for the Cosmos DB account. - :vartype locations: list["Location"] - :ivar failover_policies: An array that contains the regions ordered by their failover - priorities. - :vartype failover_policies: list["FailoverPolicy"] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB + :ivar virtualNetworkRules: List of Virtual Network ACL rules configured for the Cosmos DB account. - :vartype virtual_network_rules: list["VirtualNetworkRule"] - :ivar private_endpoint_connections: List of Private Endpoint Connections configured for the - Cosmos DB account. - :vartype private_endpoint_connections: list["PrivateEndpointConnection"] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. "Small" - :vartype connector_offer: Union[str, "ConnectorOffer"] - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources + :vartype virtualNetworkRules: list["VirtualNetworkRule"] + :ivar enableMultipleWriteLocations: Enables the account to write in multiple locations. + :vartype enableMultipleWriteLocations: bool + :ivar enableCassandraConnector: Enables the cassandra connector on the Cosmos DB C* account. + :vartype enableCassandraConnector: bool + :ivar connectorOffer: The cassandra connector offer type for the Cosmos DB database C* account. + "Small" + :vartype connectorOffer: Union[str, "ConnectorOffer"] + :ivar disableKeyBasedMetadataWriteAccess: Disable write operations on metadata resources (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like + :vartype disableKeyBasedMetadataWriteAccess: bool + :ivar keyVaultKeyUri: The URI of the key vault. + :vartype keyVaultKeyUri: str + :ivar defaultIdentity: The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. It can be "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled", "Disabled", and "SecuredByPerimeter". - :vartype public_network_access: Union[str, "PublicNetworkAccess"] - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. - :vartype api_properties: "ApiProperties" - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: "AnalyticalStorageConfiguration" - :ivar instance_id: A unique identifier assigned to the database account. - :vartype instance_id: str - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "RestoreParameters" - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: "BackupPolicy" + :vartype defaultIdentity: str + :ivar publicNetworkAccess: Whether requests from Public Network are allowed. Known values are: + "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype publicNetworkAccess: Union[str, "PublicNetworkAccess"] + :ivar enableFreeTier: Flag to indicate whether Free Tier is enabled. + :vartype enableFreeTier: bool + :ivar apiProperties: API specific properties. Currently, supported only for MongoDB API. + :vartype apiProperties: "ApiProperties" + :ivar enableAnalyticalStorage: Flag to indicate whether to enable storage analytics. + :vartype enableAnalyticalStorage: bool + :ivar analyticalStorageConfiguration: Analytical storage specific properties. + :vartype analyticalStorageConfiguration: "AnalyticalStorageConfiguration" + :ivar backupPolicy: The object representing the policy for taking backups on an account. + :vartype backupPolicy: "BackupPolicy" :ivar cors: The CORS policy for the Cosmos DB database account. :vartype cors: list["CorsPolicy"] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known + :ivar networkAclBypass: Indicates what services are allowed to bypass firewall checks. Known values are: "None" and "AzureServices". - :vartype network_acl_bypass: Union[str, "NetworkAclBypass"] - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl + :vartype networkAclBypass: Union[str, "NetworkAclBypass"] + :ivar networkAclBypassResourceIds: An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool + :vartype networkAclBypassResourceIds: list[str] + :ivar diagnosticLogSettings: The Object representing the different Diagnostic log settings for + the Cosmos DB Account. + :vartype diagnosticLogSettings: "DiagnosticLogSettings" + :ivar disableLocalAuth: Opt-out of local authentication and ensure only MSI and AAD can be used + exclusively for authentication. + :vartype disableLocalAuth: bool :ivar capacity: The object that represents all properties related to capacity enforcement on an account. :vartype capacity: "Capacity" - :ivar keys_metadata: The object that represents the metadata for the Account Keys of the Cosmos - DB account. - :vartype keys_metadata: "DatabaseAccountKeysMetadata" - :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on + :ivar capacityMode: Indicates the capacityMode of the Cosmos DB account. Known values are: + "None", "Provisioned", and "Serverless". + :vartype capacityMode: Union[str, "CapacityMode"] + :ivar enableMaterializedViews: Flag to indicate whether to enable MaterializedViews on the + Cosmos DB account. + :vartype enableMaterializedViews: bool + :ivar keysMetadata: 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 keysMetadata: "DatabaseAccountKeysMetadata" + :ivar enablePartitionMerge: Flag to indicate enabling/disabling of Partition Merge feature on the account. - :vartype enable_partition_merge: bool - :ivar enable_burst_capacity: Flag to indicate enabling/disabling of Burst Capacity Preview + :vartype enablePartitionMerge: bool + :ivar enableBurstCapacity: 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, + :vartype enableBurstCapacity: bool + :ivar minimalTlsVersion: 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: Union[str, "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 key_vault_key_uri_version: The version of the Customer Managed Key currently being used - by the account. - :vartype key_vault_key_uri_version: str - :ivar enable_priority_based_execution: Flag to indicate enabling/disabling of Priority Based + :vartype minimalTlsVersion: Union[str, "MinimalTlsVersion"] + :ivar customerManagedKeyStatus: Indicates the status of the Customer Managed Key feature on the + account. In case there are errors, the property provides troubleshooting guidance. + :vartype customerManagedKeyStatus: str + :ivar enablePriorityBasedExecution: 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 + :vartype enablePriorityBasedExecution: bool + :ivar defaultPriorityLevel: Enum to indicate default Priority Level of request for Priority Based Execution. Known values are: "High" and "Low". - :vartype default_priority_level: Union[str, "DefaultPriorityLevel"] - :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - Per-Region Per-partition autoscale Preview feature on the account. - :vartype enable_per_region_per_partition_autoscale: bool - :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of + :vartype defaultPriorityLevel: Union[str, "DefaultPriorityLevel"] + :ivar enablePerRegionPerPartitionAutoscale: Flag to indicate enabling/disabling of Per-Region + Per-partition autoscale Preview feature on the account. + :vartype enablePerRegionPerPartitionAutoscale: bool + :ivar enableAllVersionsAndDeletesChangeFeed: Flag to indicate if All Versions and Deletes + Change feed feature is enabled on the account. + :vartype enableAllVersionsAndDeletesChangeFeed: bool + :ivar softDeleteConfiguration: The configuration for soft delete on the Cosmos DB account. + :vartype softDeleteConfiguration: "SoftDeleteConfiguration" + :ivar enforceHierarchicalPartitionKeyIdLastLevel: Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account. - :vartype enforce_hierarchical_partition_key_id_last_level: bool + :vartype enforceHierarchicalPartitionKeyIdLastLevel: bool """ - provisioningState: str - """The provisioning state of the resource.""" - documentEndpoint: str - """The connection endpoint for the Cosmos DB database account.""" - databaseAccountOfferType: Literal["Standard"] - """The offer type for the Cosmos DB database account. Default value: Standard. Default value is - \"Standard\".""" + consistencyPolicy: "ConsistencyPolicy" + """The consistency policy for the Cosmos DB account.""" + locations: list["Location"] + """An array that contains the georeplication locations enabled for the Cosmos DB account.""" ipRules: list["IpAddressOrRange"] """List of IpRules.""" isVirtualNetworkFilterEnabled: bool @@ -2119,22 +2283,10 @@ class DatabaseAccountGetProperties(TypedDict, total=False): """Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.""" - consistencyPolicy: "ConsistencyPolicy" - """The consistency policy for the Cosmos DB database account.""" capabilities: list["Capability"] """List of Cosmos DB capabilities for the account.""" - writeLocations: list["Location"] - """An array that contains the write location for the Cosmos DB account.""" - readLocations: list["Location"] - """An array that contains of the read locations enabled for the Cosmos DB account.""" - locations: list["Location"] - """An array that contains all of the locations enabled for the Cosmos DB account.""" - failoverPolicies: list["FailoverPolicy"] - """An array that contains the regions ordered by their failover priorities.""" virtualNetworkRules: list["VirtualNetworkRule"] """List of Virtual Network ACL rules configured for the Cosmos DB account.""" - privateEndpointConnections: list["PrivateEndpointConnection"] - """List of Private Endpoint Connections configured for the Cosmos DB account.""" enableMultipleWriteLocations: bool """Enables the account to write in multiple locations.""" enableCassandraConnector: bool @@ -2156,17 +2308,11 @@ class DatabaseAccountGetProperties(TypedDict, total=False): enableFreeTier: bool """Flag to indicate whether Free Tier is enabled.""" apiProperties: "ApiProperties" - """API specific properties.""" + """API specific properties. Currently, supported only for MongoDB API.""" enableAnalyticalStorage: bool """Flag to indicate whether to enable storage analytics.""" analyticalStorageConfiguration: "AnalyticalStorageConfiguration" """Analytical storage specific properties.""" - instanceId: str - """A unique identifier assigned to the database account.""" - createMode: Union[str, "CreateMode"] - """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" - restoreParameters: "RestoreParameters" - """Parameters to indicate the information about the restore.""" backupPolicy: "BackupPolicy" """The object representing the policy for taking backups on an account.""" cors: list["CorsPolicy"] @@ -2176,13 +2322,21 @@ class DatabaseAccountGetProperties(TypedDict, total=False): \"AzureServices\".""" networkAclBypassResourceIds: list[str] """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" + diagnosticLogSettings: "DiagnosticLogSettings" + """The Object representing the different Diagnostic log settings for the Cosmos DB Account.""" disableLocalAuth: bool """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication.""" capacity: "Capacity" """The object that represents all properties related to capacity enforcement on an account.""" + capacityMode: Union[str, "CapacityMode"] + """Indicates the capacityMode of the Cosmos DB account. Known values are: \"None\", + \"Provisioned\", and \"Serverless\".""" + enableMaterializedViews: bool + """Flag to indicate whether to enable MaterializedViews on the Cosmos DB account.""" keysMetadata: "DatabaseAccountKeysMetadata" - """The object that represents the metadata for the Account Keys of the Cosmos DB account.""" + """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.""" enablePartitionMerge: bool """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" enableBurstCapacity: bool @@ -2193,8 +2347,6 @@ class DatabaseAccountGetProperties(TypedDict, total=False): customerManagedKeyStatus: str """Indicates the status of the Customer Managed Key feature on the account. In case there are errors, the property provides troubleshooting guidance.""" - keyVaultKeyUriVersion: str - """The version of the Customer Managed Key currently being used by the account.""" enablePriorityBasedExecution: bool """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" defaultPriorityLevel: Union[str, "DefaultPriorityLevel"] @@ -2203,13 +2355,32 @@ class DatabaseAccountGetProperties(TypedDict, total=False): enablePerRegionPerPartitionAutoscale: bool """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on the account.""" + enableAllVersionsAndDeletesChangeFeed: bool + """Flag to indicate if All Versions and Deletes Change feed feature is enabled on the account.""" + softDeleteConfiguration: "SoftDeleteConfiguration" + """The configuration for soft delete on the Cosmos DB account.""" enforceHierarchicalPartitionKeyIdLastLevel: bool """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on the account.""" -class DatabaseAccountGetResults(ProxyResource): - """An Azure Cosmos DB database account. +class DatabaseRestoreResource(TypedDict, total=False): + """Specific Databases to restore. + + :ivar databaseName: The name of the database available for restore. + :vartype databaseName: str + :ivar collectionNames: The names of the collections available for restore. + :vartype collectionNames: list[str] + """ + + databaseName: str + """The name of the database available for restore.""" + collectionNames: list[str] + """The names of the collections available for restore.""" + + +class DataCenterResource(ProxyResource): + """A managed Cassandra data center. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -2219,431 +2390,69 @@ class DatabaseAccountGetResults(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" - :ivar properties: Properties for the database account. - :vartype properties: "DatabaseAccountGetProperties" - :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: "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: Union[str, "DatabaseAccountKind"] + :vartype systemData: "SystemData" + :ivar properties: Properties of a managed Cassandra data center. + :vartype properties: "DataCenterResourceProperties" """ - properties: "DatabaseAccountGetProperties" - """Properties for the database account.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - kind: Union[str, "DatabaseAccountKind"] - """Indicates the type of database account. This can only be set at database account creation. - Known values are: \"GlobalDocumentDB\", \"MongoDB\", and \"Parse\".""" + properties: "DataCenterResourceProperties" + """Properties of a managed Cassandra data center.""" -class DatabaseAccountKeysMetadata(TypedDict, total=False): - """The metadata related to each access key for the given Cosmos DB database account. +class DataCenterResourceProperties(TypedDict, total=False): + """Properties of a managed Cassandra data center. - :ivar primary_master_key: The metadata related to the Primary Read-Write Key for the given - Cosmos DB database account. - :vartype primary_master_key: "AccountKeyMetadata" - :ivar secondary_master_key: The metadata related to the Secondary Read-Write Key for the given - Cosmos DB database account. - :vartype secondary_master_key: "AccountKeyMetadata" - :ivar primary_readonly_master_key: The metadata related to the Primary Read-Only Key for the - given Cosmos DB database account. - :vartype primary_readonly_master_key: "AccountKeyMetadata" - :ivar secondary_readonly_master_key: The metadata related to the Secondary Read-Only Key for - the given Cosmos DB database account. - :vartype secondary_readonly_master_key: "AccountKeyMetadata" - """ - - primaryMasterKey: "AccountKeyMetadata" - """The metadata related to the Primary Read-Write Key for the given Cosmos DB database account.""" - secondaryMasterKey: "AccountKeyMetadata" - """The metadata related to the Secondary Read-Write Key for the given Cosmos DB database account.""" - primaryReadonlyMasterKey: "AccountKeyMetadata" - """The metadata related to the Primary Read-Only Key for the given Cosmos DB database account.""" - secondaryReadonlyMasterKey: "AccountKeyMetadata" - """The metadata related to the Secondary Read-Only Key for the given Cosmos DB database account.""" - - -class DatabaseAccountListConnectionStringsResult(TypedDict, total=False): # pylint: disable=name-too-long - """The connection strings for the given database account. - - :ivar connection_strings: An array that contains the connection strings for the Cosmos DB - account. - :vartype connection_strings: list["DatabaseAccountConnectionString"] - """ - - connectionStrings: list["DatabaseAccountConnectionString"] - """An array that contains the connection strings for the Cosmos DB account.""" - - -class DatabaseAccountListReadOnlyKeysResult(TypedDict, total=False): - """The read-only access keys for the given database account. - - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str - """ - - primaryReadonlyMasterKey: str - """Base 64 encoded value of the primary read-only key.""" - secondaryReadonlyMasterKey: str - """Base 64 encoded value of the secondary read-only key.""" - - -class DatabaseAccountListKeysResult(DatabaseAccountListReadOnlyKeysResult): - """The access keys for the given database account. - - :ivar primary_readonly_master_key: Base 64 encoded value of the primary read-only key. - :vartype primary_readonly_master_key: str - :ivar secondary_readonly_master_key: Base 64 encoded value of the secondary read-only key. - :vartype secondary_readonly_master_key: str - :ivar primary_master_key: Base 64 encoded value of the primary read-write key. - :vartype primary_master_key: str - :ivar secondary_master_key: Base 64 encoded value of the secondary read-write key. - :vartype secondary_master_key: str - """ - - primaryMasterKey: str - """Base 64 encoded value of the primary read-write key.""" - secondaryMasterKey: str - """Base 64 encoded value of the secondary read-write key.""" - - -class DatabaseAccountRegenerateKeyParameters(TypedDict, total=False): - """Parameters to regenerate the keys within the database account. - - :ivar key_kind: The access key to regenerate. Required. Known values are: "primary", - "secondary", "primaryReadonly", and "secondaryReadonly". - :vartype key_kind: Union[str, "KeyKind"] - """ - - keyKind: Required[Union[str, "KeyKind"]] - """The access key to regenerate. Required. Known values are: \"primary\", \"secondary\", - \"primaryReadonly\", and \"secondaryReadonly\".""" - - -class DatabaseAccountUpdateParameters(TypedDict, total=False): - """Parameters for patching Azure Cosmos DB database account properties. - - :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 location: The location of the resource group to which the resource belongs. - :vartype location: str - :ivar identity: Identity for the resource. - :vartype identity: "ManagedServiceIdentity" - :ivar properties: Properties to update Azure Cosmos DB database accounts. - :vartype properties: "DatabaseAccountUpdateProperties" - """ - - tags: dict[str, str] - """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\".""" - location: str - """The location of the resource group to which the resource belongs.""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - properties: "DatabaseAccountUpdateProperties" - """Properties to update Azure Cosmos DB database accounts.""" - - -class DatabaseAccountUpdateProperties(TypedDict, total=False): - """Properties to update Azure Cosmos DB database accounts. - - :ivar consistency_policy: The consistency policy for the Cosmos DB account. - :vartype consistency_policy: "ConsistencyPolicy" - :ivar locations: An array that contains the georeplication locations enabled for the Cosmos DB - account. - :vartype locations: list["Location"] - :ivar ip_rules: List of IpRules. - :vartype ip_rules: list["IpAddressOrRange"] - :ivar is_virtual_network_filter_enabled: Flag to indicate whether to enable/disable Virtual - Network ACL rules. - :vartype is_virtual_network_filter_enabled: bool - :ivar enable_automatic_failover: Enables automatic failover of the write region in the rare - event that the region is unavailable due to an outage. Automatic failover will result in a new - write region for the account and is chosen based on the failover priorities configured for the - account. - :vartype enable_automatic_failover: bool - :ivar capabilities: List of Cosmos DB capabilities for the account. - :vartype capabilities: list["Capability"] - :ivar virtual_network_rules: List of Virtual Network ACL rules configured for the Cosmos DB - account. - :vartype virtual_network_rules: list["VirtualNetworkRule"] - :ivar enable_multiple_write_locations: Enables the account to write in multiple locations. - :vartype enable_multiple_write_locations: bool - :ivar enable_cassandra_connector: Enables the cassandra connector on the Cosmos DB C* account. - :vartype enable_cassandra_connector: bool - :ivar connector_offer: The cassandra connector offer type for the Cosmos DB database C* - account. "Small" - :vartype connector_offer: Union[str, "ConnectorOffer"] - :ivar disable_key_based_metadata_write_access: Disable write operations on metadata resources - (databases, containers, throughput) via account keys. - :vartype disable_key_based_metadata_write_access: bool - :ivar key_vault_key_uri: The URI of the key vault. - :vartype key_vault_key_uri: str - :ivar default_identity: The default identity for accessing key vault used in features like - customer managed keys. The default identity needs to be explicitly set by the users. It can be - "FirstPartyIdentity", "SystemAssignedIdentity" and more. - :vartype default_identity: str - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled", "Disabled", and "SecuredByPerimeter". - :vartype public_network_access: Union[str, "PublicNetworkAccess"] - :ivar enable_free_tier: Flag to indicate whether Free Tier is enabled. - :vartype enable_free_tier: bool - :ivar api_properties: API specific properties. Currently, supported only for MongoDB API. - :vartype api_properties: "ApiProperties" - :ivar enable_analytical_storage: Flag to indicate whether to enable storage analytics. - :vartype enable_analytical_storage: bool - :ivar analytical_storage_configuration: Analytical storage specific properties. - :vartype analytical_storage_configuration: "AnalyticalStorageConfiguration" - :ivar backup_policy: The object representing the policy for taking backups on an account. - :vartype backup_policy: "BackupPolicy" - :ivar cors: The CORS policy for the Cosmos DB database account. - :vartype cors: list["CorsPolicy"] - :ivar network_acl_bypass: Indicates what services are allowed to bypass firewall checks. Known - values are: "None" and "AzureServices". - :vartype network_acl_bypass: Union[str, "NetworkAclBypass"] - :ivar network_acl_bypass_resource_ids: An array that contains the Resource Ids for Network Acl - Bypass for the Cosmos DB account. - :vartype network_acl_bypass_resource_ids: list[str] - :ivar disable_local_auth: Opt-out of local authentication and ensure only MSI and AAD can be - used exclusively for authentication. - :vartype disable_local_auth: bool - :ivar capacity: The object that represents all properties related to capacity enforcement on an - account. - :vartype capacity: "Capacity" - :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: "DatabaseAccountKeysMetadata" - :ivar enable_partition_merge: Flag to indicate enabling/disabling of Partition Merge feature on - the account. - :vartype enable_partition_merge: bool - :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: Union[str, "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: Union[str, "DefaultPriorityLevel"] - :ivar enable_per_region_per_partition_autoscale: Flag to indicate enabling/disabling of - Per-Region Per-partition autoscale Preview feature on the account. - :vartype enable_per_region_per_partition_autoscale: bool - :ivar enforce_hierarchical_partition_key_id_last_level: Flag to indicate enabling/disabling of - hierarchical partition key ID last level enforcement on the account. - :vartype enforce_hierarchical_partition_key_id_last_level: bool - """ - - consistencyPolicy: "ConsistencyPolicy" - """The consistency policy for the Cosmos DB account.""" - locations: list["Location"] - """An array that contains the georeplication locations enabled for the Cosmos DB account.""" - ipRules: list["IpAddressOrRange"] - """List of IpRules.""" - isVirtualNetworkFilterEnabled: bool - """Flag to indicate whether to enable/disable Virtual Network ACL rules.""" - enableAutomaticFailover: bool - """Enables automatic failover of the write region in the rare event that the region is unavailable - due to an outage. Automatic failover will result in a new write region for the account and is - chosen based on the failover priorities configured for the account.""" - capabilities: list["Capability"] - """List of Cosmos DB capabilities for the account.""" - virtualNetworkRules: list["VirtualNetworkRule"] - """List of Virtual Network ACL rules configured for the Cosmos DB account.""" - enableMultipleWriteLocations: bool - """Enables the account to write in multiple locations.""" - enableCassandraConnector: bool - """Enables the cassandra connector on the Cosmos DB C* account.""" - connectorOffer: Union[str, "ConnectorOffer"] - """The cassandra connector offer type for the Cosmos DB database C* account. \"Small\"""" - disableKeyBasedMetadataWriteAccess: bool - """Disable write operations on metadata resources (databases, containers, throughput) via account - keys.""" - keyVaultKeyUri: str - """The URI of the key vault.""" - defaultIdentity: str - """The default identity for accessing key vault used in features like customer managed keys. The - default identity needs to be explicitly set by the users. It can be \"FirstPartyIdentity\", - \"SystemAssignedIdentity\" and more.""" - publicNetworkAccess: Union[str, "PublicNetworkAccess"] - """Whether requests from Public Network are allowed. Known values are: \"Enabled\", \"Disabled\", - and \"SecuredByPerimeter\".""" - enableFreeTier: bool - """Flag to indicate whether Free Tier is enabled.""" - apiProperties: "ApiProperties" - """API specific properties. Currently, supported only for MongoDB API.""" - enableAnalyticalStorage: bool - """Flag to indicate whether to enable storage analytics.""" - analyticalStorageConfiguration: "AnalyticalStorageConfiguration" - """Analytical storage specific properties.""" - backupPolicy: "BackupPolicy" - """The object representing the policy for taking backups on an account.""" - cors: list["CorsPolicy"] - """The CORS policy for the Cosmos DB database account.""" - networkAclBypass: Union[str, "NetworkAclBypass"] - """Indicates what services are allowed to bypass firewall checks. Known values are: \"None\" and - \"AzureServices\".""" - networkAclBypassResourceIds: list[str] - """An array that contains the Resource Ids for Network Acl Bypass for the Cosmos DB account.""" - disableLocalAuth: bool - """Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for - authentication.""" - capacity: "Capacity" - """The object that represents all properties related to capacity enforcement on an account.""" - keysMetadata: "DatabaseAccountKeysMetadata" - """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.""" - enablePartitionMerge: bool - """Flag to indicate enabling/disabling of Partition Merge feature on the account.""" - enableBurstCapacity: bool - """Flag to indicate enabling/disabling of Burst Capacity Preview feature on the account.""" - minimalTlsVersion: Union[str, "MinimalTlsVersion"] - """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\".""" - customerManagedKeyStatus: str - """Indicates the status of the Customer Managed Key feature on the account. In case there are - errors, the property provides troubleshooting guidance.""" - enablePriorityBasedExecution: bool - """Flag to indicate enabling/disabling of Priority Based Execution Preview feature on the account.""" - defaultPriorityLevel: Union[str, "DefaultPriorityLevel"] - """Enum to indicate default Priority Level of request for Priority Based Execution. Known values - are: \"High\" and \"Low\".""" - enablePerRegionPerPartitionAutoscale: bool - """Flag to indicate enabling/disabling of Per-Region Per-partition autoscale Preview feature on - the account.""" - enforceHierarchicalPartitionKeyIdLastLevel: bool - """Flag to indicate enabling/disabling of hierarchical partition key ID last level enforcement on - the account.""" - - -class DatabaseRestoreResource(TypedDict, total=False): - """Specific Databases to restore. - - :ivar database_name: The name of the database available for restore. - :vartype database_name: str - :ivar collection_names: The names of the collections available for restore. - :vartype collection_names: list[str] - """ - - databaseName: str - """The name of the database available for restore.""" - collectionNames: list[str] - """The names of the collections available for restore.""" - - -class DataCenterResource(ProxyResource): - """A managed Cassandra data center. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Properties of a managed Cassandra data center. - :vartype properties: "DataCenterResourceProperties" - """ - - properties: "DataCenterResourceProperties" - """Properties of a managed Cassandra data center.""" - - -class DataCenterResourceProperties(TypedDict, total=False): - """Properties of a managed Cassandra data center. - - :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: Union[str, "ManagedCassandraProvisioningState"] - :ivar data_center_location: The region this data center should be created in. - :vartype data_center_location: str - :ivar delegated_subnet_id: Resource id of a subnet the nodes in this data center should have - their network interfaces connected to. The subnet must be in the same region specified in - 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's - 'delegatedManagementSubnetId' property. This resource id will be of the form - '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. - :vartype delegated_subnet_id: str - :ivar node_count: The number of nodes the data center should have. This is the desired number. - After it is set, it may take some time for the data center to be scaled to match. To monitor - the number of nodes and their status, use the fetchNodeStatus method on the cluster. - :vartype node_count: int - :ivar seed_nodes: IP addresses for seed nodes in this data center. This is for reference. - Generally you will want to use the seedNodes property on the cluster, which aggregates the seed - nodes from all data centers in the cluster. - :vartype seed_nodes: list["SeedNode"] - :ivar base64_encoded_cassandra_yaml_fragment: A fragment of a cassandra.yaml configuration file - to be included in the cassandra.yaml for all nodes in this data center. The fragment should be - Base64 encoded, and only a subset of keys are allowed. - :vartype base64_encoded_cassandra_yaml_fragment: str - :ivar managed_disk_customer_key_uri: Key uri to use for encryption of managed disks. Ensure the - system assigned identity of the cluster has been assigned appropriate permissions(key - get/wrap/unwrap permissions) on the key. - :vartype managed_disk_customer_key_uri: str - :ivar backup_storage_customer_key_uri: Indicates the Key Uri of the customer key to use for - encryption of the backup storage account. - :vartype backup_storage_customer_key_uri: str - :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. - :vartype sku: str - :ivar disk_sku: Disk SKU used for data centers. Default value is P30. - :vartype disk_sku: str - :ivar disk_capacity: Number of disks attached to each node. Default is 4. - :vartype disk_capacity: int - :ivar availability_zone: If the data center has Availability Zone support, apply it to the - Virtual Machine ScaleSet that host the cassandra data center virtual machines. - :vartype availability_zone: bool - :ivar authentication_method_ldap_properties: Ldap authentication method properties. This - feature is in preview. - :vartype authentication_method_ldap_properties: "AuthenticationMethodLdapProperties" - :ivar deallocated: Whether the data center has been deallocated. - :vartype deallocated: bool - :ivar provision_error: Error related to resource provisioning. - :vartype provision_error: "CassandraError" - :ivar private_endpoint_ip_address: Ip of the VPN Endpoint for this data center. - :vartype private_endpoint_ip_address: str + :ivar provisioningState: The status of the resource at the time the operation was called. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioningState: Union[str, "ManagedCassandraProvisioningState"] + :ivar dataCenterLocation: The region this data center should be created in. + :vartype dataCenterLocation: str + :ivar delegatedSubnetId: Resource id of a subnet the nodes in this data center should have + their network interfaces connected to. The subnet must be in the same region specified in + 'dataCenterLocation' and must be able to route to the subnet specified in the cluster's + 'delegatedManagementSubnetId' property. This resource id will be of the form + '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + :vartype delegatedSubnetId: str + :ivar nodeCount: The number of nodes the data center should have. This is the desired number. + After it is set, it may take some time for the data center to be scaled to match. To monitor + the number of nodes and their status, use the fetchNodeStatus method on the cluster. + :vartype nodeCount: int + :ivar seedNodes: IP addresses for seed nodes in this data center. This is for reference. + Generally you will want to use the seedNodes property on the cluster, which aggregates the seed + nodes from all data centers in the cluster. + :vartype seedNodes: list["SeedNode"] + :ivar base64EncodedCassandraYamlFragment: A fragment of a cassandra.yaml configuration file to + be included in the cassandra.yaml for all nodes in this data center. The fragment should be + Base64 encoded, and only a subset of keys are allowed. + :vartype base64EncodedCassandraYamlFragment: str + :ivar managedDiskCustomerKeyUri: Key uri to use for encryption of managed disks. Ensure the + system assigned identity of the cluster has been assigned appropriate permissions(key + get/wrap/unwrap permissions) on the key. + :vartype managedDiskCustomerKeyUri: str + :ivar backupStorageCustomerKeyUri: Indicates the Key Uri of the customer key to use for + encryption of the backup storage account. + :vartype backupStorageCustomerKeyUri: str + :ivar sku: Virtual Machine SKU used for data centers. Default value is Standard_DS14_v2. + :vartype sku: str + :ivar diskSku: Disk SKU used for data centers. Default value is P30. + :vartype diskSku: str + :ivar diskCapacity: Number of disks attached to each node. Default is 4. + :vartype diskCapacity: int + :ivar availabilityZone: If the data center has Availability Zone support, apply it to the + Virtual Machine ScaleSet that host the cassandra data center virtual machines. + :vartype availabilityZone: bool + :ivar authenticationMethodLdapProperties: Ldap authentication method properties. This feature + is in preview. + :vartype authenticationMethodLdapProperties: "AuthenticationMethodLdapProperties" + :ivar deallocated: Whether the data center has been deallocated. + :vartype deallocated: bool + :ivar provisionError: Error related to resource provisioning. + :vartype provisionError: "CassandraError" + :ivar privateEndpointIpAddress: Ip of the VPN Endpoint for this data center. + :vartype privateEndpointIpAddress: str """ provisioningState: Union[str, "ManagedCassandraProvisioningState"] @@ -2694,50 +2503,120 @@ class DataCenterResourceProperties(TypedDict, total=False): """Ip of the VPN Endpoint for this data center.""" -class RegionalServiceResource(TypedDict, total=False): - """Resource for a regional service location. +class DataMaskingPolicy(TypedDict, total=False): + """Data masking policy for the container. - :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: Union[str, "ServiceStatus"] + :ivar includedPaths: List of JSON paths to include in the masking policy. + :vartype includedPaths: list["DataMaskingPolicyIncludedPathsItem"] + :ivar excludedPaths: List of JSON paths to exclude from masking. + :vartype excludedPaths: list["DataMaskingPolicyExcludedPathsItem"] + :ivar isPolicyEnabled: Flag indicating whether the data masking policy is enabled. + :vartype isPolicyEnabled: bool """ - name: str - """The regional service name.""" - location: str - """The location name.""" - status: Union[str, "ServiceStatus"] - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" + includedPaths: list["DataMaskingPolicyIncludedPathsItem"] + """List of JSON paths to include in the masking policy.""" + excludedPaths: list["DataMaskingPolicyExcludedPathsItem"] + """List of JSON paths to exclude from masking.""" + isPolicyEnabled: bool + """Flag indicating whether the data masking policy is enabled.""" -class DataTransferRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. +class DataMaskingPolicyExcludedPathsItem(TypedDict, total=False): + """JSON path to exclude from masking. - :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: Union[str, "ServiceStatus"] + :ivar path: The JSON path to exclude from masking (e.g. "/id"). Required. + :vartype path: str """ + path: Required[str] + """The JSON path to exclude from masking (e.g. \"/id\"). Required.""" + + +class DataMaskingPolicyIncludedPathsItem(TypedDict, total=False): + """JSON path to include in the masking policy. + + :ivar path: The JSON path to apply masking (e.g. "/contact/phones"). Required. + :vartype path: str + :ivar strategy: Masking strategy to apply (e.g. "MaskSubstring"). + :vartype strategy: str + :ivar startPosition: Start position for substring masking (when applicable). + :vartype startPosition: int + :ivar length: Length of substring to mask (when applicable). + :vartype length: int + """ + + path: Required[str] + """The JSON path to apply masking (e.g. \"/contact/phones\"). Required.""" + strategy: str + """Masking strategy to apply (e.g. \"MaskSubstring\").""" + startPosition: int + """Start position for substring masking (when applicable).""" + length: int + """Length of substring to mask (when applicable).""" + + +class DataTransferJobProperties(TypedDict, total=False): + """The properties of a DataTransfer Job. + + :ivar jobName: Job Name. + :vartype jobName: str + :ivar source: Source DataStore details. Required. + :vartype source: "DataTransferDataSourceSink" + :ivar destination: Destination DataStore details. Required. + :vartype destination: "DataTransferDataSourceSink" + :ivar status: Job Status. + :vartype status: str + :ivar processedCount: Processed Count. + :vartype processedCount: int + :ivar totalCount: Total Count. + :vartype totalCount: int + :ivar lastUpdatedUtcTime: Last Updated Time (ISO-8601 format). + :vartype lastUpdatedUtcTime: str + :ivar workerCount: Worker count. + :vartype workerCount: int + :ivar error: Error response for Faulted job. + :vartype error: "ErrorResponseAutoGenerated" + :ivar duration: Total Duration of Job. + :vartype duration: str + :ivar mode: Mode of job execution. Known values are: "Offline" and "Online". + :vartype mode: Union[str, "DataTransferJobMode"] + """ + + jobName: str + """Job Name.""" + source: Required["DataTransferDataSourceSink"] + """Source DataStore details. Required.""" + destination: Required["DataTransferDataSourceSink"] + """Destination DataStore details. Required.""" + status: str + """Job Status.""" + processedCount: int + """Processed Count.""" + totalCount: int + """Total Count.""" + lastUpdatedUtcTime: str + """Last Updated Time (ISO-8601 format).""" + workerCount: int + """Worker count.""" + error: "ErrorResponseAutoGenerated" + """Error response for Faulted job.""" + duration: str + """Total Duration of Job.""" + mode: Union[str, "DataTransferJobMode"] + """Mode of job execution. Known values are: \"Offline\" and \"Online\".""" + class DataTransferServiceResourceCreateUpdateProperties(TypedDict, total=False): # pylint: disable=name-too-long """Properties for Create or Update request for DataTransferServiceResource. - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + :ivar instanceSize: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: ServiceType for the service. Required. DATA_TRANSFER. - :vartype service_type: Literal[ServiceType.DATA_TRANSFER] + :vartype instanceSize: Union[str, "ServiceSize"] + :ivar instanceCount: Instance count for the service. + :vartype instanceCount: int + :ivar serviceType: ServiceType for the service. Required. DATA_TRANSFER. + :vartype serviceType: Literal[ServiceType.DATA_TRANSFER] """ instanceSize: Union[str, "ServiceSize"] @@ -2749,39 +2628,17 @@ class DataTransferServiceResourceCreateUpdateProperties(TypedDict, total=False): """ServiceType for the service. Required. DATA_TRANSFER.""" -class DataTransferServiceResourceProperties(TypedDict, total=False): - """Properties for DataTransferServiceResource. +class DiagnosticLogSettings(TypedDict, total=False): + """Indicates what diagnostic log settings are to be enabled. - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: str - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: Union[str, "ServiceStatus"] - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list["DataTransferRegionalServiceResource"] - :ivar service_type: ServiceType for the service. Required. DATA_TRANSFER. - :vartype service_type: Literal[ServiceType.DATA_TRANSFER] - """ - - creationTime: str - """Time of the last state change (ISO-8601 format).""" - instanceSize: Union[str, "ServiceSize"] - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instanceCount: int - """Instance count for the service.""" - status: Union[str, "ServiceStatus"] - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - locations: list["DataTransferRegionalServiceResource"] - """An array that contains all of the locations for the service.""" - serviceType: Required[Literal[ServiceType.DATA_TRANSFER]] - """ServiceType for the service. Required. DATA_TRANSFER.""" + :ivar enableFullTextQuery: Describe the level of detail with which queries are to be logged. + Known values are: "None", "True", and "False". + :vartype enableFullTextQuery: Union[str, "EnableFullTextQuery"] + """ + + enableFullTextQuery: Union[str, "EnableFullTextQuery"] + """Describe the level of detail with which queries are to be logged. Known values are: \"None\", + \"True\", and \"False\".""" class ErrorAdditionalInfo(TypedDict, total=False): @@ -2810,8 +2667,8 @@ class ErrorDetail(TypedDict, total=False): :vartype target: str :ivar details: The error details. :vartype details: list["ErrorDetail"] - :ivar additional_info: The error additional info. - :vartype additional_info: list["ErrorAdditionalInfo"] + :ivar additionalInfo: The error additional info. + :vartype additionalInfo: list["ErrorAdditionalInfo"] """ code: str @@ -2868,8 +2725,8 @@ class ExcludedPath(TypedDict, total=False): class FailoverPolicies(TypedDict, total=False): """The list of new failover policies for the failover priority change. - :ivar failover_policies: List of failover policies. Required. - :vartype failover_policies: list["FailoverPolicy"] + :ivar failoverPolicies: List of failover policies. Required. + :vartype failoverPolicies: list["FailoverPolicy"] """ failoverPolicies: Required[list["FailoverPolicy"]] @@ -2882,13 +2739,13 @@ class FailoverPolicy(TypedDict, total=False): :ivar id: The unique identifier of the region in which the database account replicates to. Example: <accountName>-<locationName>. :vartype id: str - :ivar location_name: The name of the region in which the database account exists. - :vartype location_name: str - :ivar failover_priority: The failover priority of the region. A failover priority of 0 - indicates a write region. The maximum value for a failover priority = (total number of regions - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int + :ivar locationName: The name of the region in which the database account exists. + :vartype locationName: str + :ivar failoverPriority: The failover priority of the region. A failover priority of 0 indicates + a write region. The maximum value for a failover priority = (total number of regions - 1). + Failover priority values must be unique for each of the regions in which the database account + exists. + :vartype failoverPriority: int """ id: str @@ -2902,6 +2759,52 @@ class FailoverPolicy(TypedDict, total=False): must be unique for each of the regions in which the database account exists.""" +class FleetAnalyticsProperties(TypedDict, total=False): + """FleetAnalyticsProperties. + + :ivar provisioningState: A provisioning state of the FleetAnalytics. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioningState: Union[str, "Status"] + :ivar storageLocationType: The type of the fleet analytics resource. Known values are: + "StorageAccount" and "FabricLakehouse". + :vartype storageLocationType: Union[str, "FleetAnalyticsPropertiesStorageLocationType"] + :ivar storageLocationUri: The unique identifier of the fleet analytics resource. + :vartype storageLocationUri: str + """ + + provisioningState: Union[str, "Status"] + """A provisioning state of the FleetAnalytics. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + storageLocationType: Union[str, "FleetAnalyticsPropertiesStorageLocationType"] + """The type of the fleet analytics resource. Known values are: \"StorageAccount\" and + \"FabricLakehouse\".""" + storageLocationUri: str + """The unique identifier of the fleet analytics resource.""" + + +class FleetAnalyticsResource(ProxyResource): + """An Azure Cosmos DB FleetAnalytics. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar properties: + :vartype properties: "FleetAnalyticsProperties" + """ + + properties: "FleetAnalyticsProperties" + + class TrackedResource(Resource): """Tracked Resource. @@ -2913,9 +2816,9 @@ class TrackedResource(Resource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -2939,9 +2842,9 @@ class FleetResource(TrackedResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -2957,10 +2860,10 @@ class FleetResource(TrackedResource): class FleetResourceProperties(TypedDict, total=False): """Properties to update Azure Cosmos DB fleet resource. - :ivar provisioning_state: A provisioning state of the Fleet. Known values are: "Uninitialized", + :ivar provisioningState: A provisioning state of the Fleet. Known values are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", "Failed", "Canceled", "Updating", and "Creating". - :vartype provisioning_state: Union[str, "Status"] + :vartype provisioningState: Union[str, "Status"] """ provisioningState: Union[str, "Status"] @@ -2987,13 +2890,12 @@ class FleetResourceUpdate(TypedDict, total=False): class FleetspaceAccountProperties(TypedDict, total=False): """An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account. - :ivar provisioning_state: A provisioning state of the Fleetspace Account. Known values are: + :ivar provisioningState: A provisioning state of the Fleetspace Account. Known values are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", "Failed", "Canceled", "Updating", and "Creating". - :vartype provisioning_state: Union[str, "Status"] - :ivar global_database_account_properties: Configuration for fleetspace Account in the - fleetspace. - :vartype global_database_account_properties: + :vartype provisioningState: Union[str, "Status"] + :ivar globalDatabaseAccountProperties: Configuration for fleetspace Account in the fleetspace. + :vartype globalDatabaseAccountProperties: "FleetspaceAccountPropertiesGlobalDatabaseAccountProperties" """ @@ -3010,11 +2912,10 @@ class FleetspaceAccountPropertiesGlobalDatabaseAccountProperties( ): # pylint: disable=name-too-long """Configuration for fleetspace Account in the fleetspace. - :ivar resource_id: The resource identifier of global database account in the Fleetspace - Account. - :vartype resource_id: str - :ivar arm_location: The location of global database account in the Fleetspace Account. - :vartype arm_location: str + :ivar resourceId: The resource identifier of global database account in the Fleetspace Account. + :vartype resourceId: str + :ivar armLocation: The location of global database account in the Fleetspace Account. + :vartype armLocation: str """ resourceId: str @@ -3034,9 +2935,9 @@ class FleetspaceAccountResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: An Azure Cosmos DB Global Database Account which is part of a Fleetspace Account. :vartype properties: "FleetspaceAccountProperties" @@ -3049,21 +2950,21 @@ class FleetspaceAccountResource(ProxyResource): class FleetspaceProperties(TypedDict, total=False): """Properties to update Azure Cosmos DB Fleetspace. - :ivar provisioning_state: A provisioning state of the Fleetspace. Known values are: + :ivar provisioningState: A provisioning state of the Fleetspace. Known values are: "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", "Failed", "Canceled", "Updating", and "Creating". - :vartype provisioning_state: Union[str, "Status"] - :ivar fleetspace_api_kind: The kind of API this fleetspace belongs to. Acceptable values: + :vartype provisioningState: Union[str, "Status"] + :ivar fleetspaceApiKind: The kind of API this fleetspace belongs to. Acceptable values: 'NoSQL'. "NoSQL" - :vartype fleetspace_api_kind: Union[str, "FleetspacePropertiesFleetspaceApiKind"] - :ivar service_tier: Service Tier for the fleetspace. GeneralPurpose types refers to single - write region accounts that can be added to this fleetspace, whereas BusinessCritical refers to - multi write region. Known values are: "GeneralPurpose" and "BusinessCritical". - :vartype service_tier: Union[str, "FleetspacePropertiesServiceTier"] - :ivar data_regions: List of data regions assigned to the fleetspace. Eg [westus2]. - :vartype data_regions: list[str] - :ivar throughput_pool_configuration: Configuration for throughput pool in the fleetspace. - :vartype throughput_pool_configuration: "FleetspacePropertiesThroughputPoolConfiguration" + :vartype fleetspaceApiKind: Union[str, "FleetspacePropertiesFleetspaceApiKind"] + :ivar serviceTier: Service Tier for the fleetspace. GeneralPurpose types refers to single write + region accounts that can be added to this fleetspace, whereas BusinessCritical refers to multi + write region. Known values are: "GeneralPurpose" and "BusinessCritical". + :vartype serviceTier: Union[str, "FleetspacePropertiesServiceTier"] + :ivar dataRegions: List of data regions assigned to the fleetspace. Eg [westus2]. + :vartype dataRegions: list[str] + :ivar throughputPoolConfiguration: Configuration for throughput pool in the fleetspace. + :vartype throughputPoolConfiguration: "FleetspacePropertiesThroughputPoolConfiguration" """ provisioningState: Union[str, "Status"] @@ -3085,19 +2986,18 @@ class FleetspaceProperties(TypedDict, total=False): class FleetspacePropertiesThroughputPoolConfiguration(TypedDict, total=False): # pylint: disable=name-too-long """Configuration for throughput pool in the fleetspace. - :ivar min_throughput: Minimum throughput for the pool. - :vartype min_throughput: int - :ivar max_throughput: Maximum throughput for the pool. - :vartype max_throughput: int - :ivar dedicated_r_us: Total dedicated throughput (RU/s) for fleetspace. Represents the sum of - all manual provisioned throughput and all autoscale max RU/s across all shared throughput - databases and dedicated throughput containers across all accounts in the fleetspace for 1 - region. - :vartype dedicated_r_us: int - :ivar max_consumable_r_us: Maximum consumable throughput (RU/s) for fleetspace. Represents the + :ivar minThroughput: Minimum throughput for the pool. + :vartype minThroughput: int + :ivar maxThroughput: Maximum throughput for the pool. + :vartype maxThroughput: int + :ivar dedicatedRUs: Total dedicated throughput (RU/s) for fleetspace. Represents the sum of all + manual provisioned throughput and all autoscale max RU/s across all shared throughput databases + and dedicated throughput containers across all accounts in the fleetspace for 1 region. + :vartype dedicatedRUs: int + :ivar maxConsumableRUs: Maximum consumable throughput (RU/s) for fleetspace. Represents the maximum throughput that resources in the fleetspace can consume from the fleetspace's pool in 1 region. - :vartype max_consumable_r_us: int + :vartype maxConsumableRUs: int """ minThroughput: int @@ -3124,9 +3024,9 @@ class FleetspaceResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to update Azure Cosmos DB Fleetspace. :vartype properties: "FleetspaceProperties" """ @@ -3175,10 +3075,10 @@ class FullTextPath(TypedDict, total=False): class FullTextPolicy(TypedDict, total=False): """Cosmos DB FullText Policy. - :ivar default_language: The default language for a full text paths. - :vartype default_language: str - :ivar full_text_paths: List of FullText Paths. - :vartype full_text_paths: list["FullTextPath"] + :ivar defaultLanguage: The default language for a full text paths. + :vartype defaultLanguage: str + :ivar fullTextPaths: List of FullText Paths. + :vartype fullTextPaths: list["FullTextPath"] """ defaultLanguage: str @@ -3187,34 +3087,174 @@ class FullTextPolicy(TypedDict, total=False): """List of FullText Paths.""" -class GraphAPIComputeRegionalServiceResource(RegionalServiceResource): - """Resource for a regional service location. +class GarnetClusterResource(TrackedResource): + """Representation of a Garnet cache cluster. - :ivar name: The regional service name. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar location: The location name. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: Union[str, "ServiceStatus"] - :ivar graph_api_compute_endpoint: The regional endpoint for GraphAPICompute. - :vartype graph_api_compute_endpoint: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: "GarnetClusterResourceProperties" + :ivar identity: Identity for the resource. + :vartype identity: "ManagedCassandraManagedServiceIdentity" + """ + + properties: "GarnetClusterResourceProperties" + """The resource-specific properties for this resource.""" + identity: "ManagedCassandraManagedServiceIdentity" + """Identity for the resource.""" + + +class GarnetClusterResourcePatch(TypedDict, total=False): + """Representation of a Garnet cache cluster for updates. + + :ivar properties: Properties of a Garnet cache cluster for updates. + :vartype properties: "GarnetClusterResourcePatchProperties" + """ + + properties: "GarnetClusterResourcePatchProperties" + """Properties of a Garnet cache cluster for updates.""" + + +class GarnetClusterResourcePatchProperties(TypedDict, total=False): + """Properties of a Garnet cache cluster for updates. + + :ivar clusterType: Type of the cluster. If set to Production, some operations might not be + permitted on cluster. Known values are: "Production" and "NonProduction". + :vartype clusterType: Union[str, "ClusterType"] + :ivar extensions: Extensions to be added or updated on cluster. + :vartype extensions: list[str] + :ivar authenticationMethod: The authentication method used for the Garnet cluster. "Entra" + :vartype authenticationMethod: Union[str, "GarnetAuthenticationType"] + :ivar persistence: Flag to indicate if persistence is enabled for the Garnet cluster. + :vartype persistence: bool """ - graphApiComputeEndpoint: str - """The regional endpoint for GraphAPICompute.""" + clusterType: Union[str, "ClusterType"] + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" + extensions: list[str] + """Extensions to be added or updated on cluster.""" + authenticationMethod: Union[str, "GarnetAuthenticationType"] + """The authentication method used for the Garnet cluster. \"Entra\"""" + persistence: bool + """Flag to indicate if persistence is enabled for the Garnet cluster.""" + + +class GarnetClusterResourceProperties(TypedDict, total=False): + """Properties of a Garnet cache cluster. + + :ivar provisioningState: The provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioningState: Union[str, "GarnetCacheProvisioningState"] + :ivar subnetId: 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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'. + :vartype subnetId: str + :ivar endPoints: Endpoints for clients to connect to the cluster. + :vartype endPoints: list["GarnetClusterResourcePropertiesEndPointsItem"] + :ivar replicationFactor: Number of copies of data maintained by the cluster. + :vartype replicationFactor: int + :ivar shardCount: Number of shards in the cluster. + :vartype shardCount: int + :ivar nodeSku: Virtual Machine SKU used for clusters. Default value is Standard_DS14_v2. + :vartype nodeSku: str + :ivar availabilityZone: If the data center has Availability Zone support, apply it to the + Virtual Machine ScaleSet that host the garnet cluster virtual machines. + :vartype availabilityZone: bool + :ivar authenticationMethod: The authentication method used for the Garnet cluster. "Entra" + :vartype authenticationMethod: Union[str, "GarnetAuthenticationType"] + :ivar persistence: Flag to indicate if persistence is enabled for the Garnet cluster. + :vartype persistence: bool + :ivar allocationState: Allocation state of the cluster and data center resources. Active + implies the virtual machines of the cluster are allocated, deallocated implies virtual machines + and resources are deallocated. Known values are: "Active" and "Deallocated". + :vartype allocationState: Union[str, "AllocationState"] + :ivar clusterType: Type of the cluster. If set to Production, some operations might not be + permitted on cluster. Known values are: "Production" and "NonProduction". + :vartype clusterType: Union[str, "ClusterType"] + :ivar provisionError: Error related to resource provisioning. + :vartype provisionError: "ErrorDetail" + :ivar extensions: Extensions to be added or updated on cluster. + :vartype extensions: list[str] + """ + + provisioningState: Union[str, "GarnetCacheProvisioningState"] + """The provisioning state of the resource. Known values are: \"Creating\", \"Updating\", + \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + subnetId: str + """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//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/'.""" + endPoints: list["GarnetClusterResourcePropertiesEndPointsItem"] + """Endpoints for clients to connect to the cluster.""" + replicationFactor: int + """Number of copies of data maintained by the cluster.""" + shardCount: int + """Number of shards in the cluster.""" + nodeSku: str + """Virtual Machine SKU used for clusters. Default value is Standard_DS14_v2.""" + availabilityZone: bool + """If the data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that + host the garnet cluster virtual machines.""" + authenticationMethod: Union[str, "GarnetAuthenticationType"] + """The authentication method used for the Garnet cluster. \"Entra\"""" + persistence: bool + """Flag to indicate if persistence is enabled for the Garnet cluster.""" + allocationState: Union[str, "AllocationState"] + """Allocation state of the cluster and data center resources. Active implies the virtual machines + of the cluster are allocated, deallocated implies virtual machines and resources are + deallocated. Known values are: \"Active\" and \"Deallocated\".""" + clusterType: Union[str, "ClusterType"] + """Type of the cluster. If set to Production, some operations might not be permitted on cluster. + Known values are: \"Production\" and \"NonProduction\".""" + provisionError: "ErrorDetail" + """Error related to resource provisioning.""" + extensions: list[str] + """Extensions to be added or updated on cluster.""" + + +class GarnetClusterResourcePropertiesEndPointsItem(TypedDict, total=False): # pylint: disable=name-too-long + """Endpoint for clients to connect to the cluster. + + :ivar ipAddress: Ipv4 address of the endpoint. + :vartype ipAddress: str + :ivar port: Port number. + :vartype port: int + """ + + ipAddress: str + """Ipv4 address of the endpoint.""" + port: int + """Port number.""" class GraphAPIComputeServiceResourceCreateUpdateProperties(TypedDict, total=False): # pylint: disable=name-too-long """Properties for Create or Update request for GraphAPIComputeServiceResource. - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + :ivar instanceSize: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: ServiceType for the service. Required. GRAPH_API_COMPUTE. - :vartype service_type: Literal[ServiceType.GRAPH_API_COMPUTE] + :vartype instanceSize: Union[str, "ServiceSize"] + :ivar instanceCount: Instance count for the service. + :vartype instanceCount: int + :ivar serviceType: ServiceType for the service. Required. GRAPH_API_COMPUTE. + :vartype serviceType: Literal[ServiceType.GRAPH_API_COMPUTE] """ instanceSize: Union[str, "ServiceSize"] @@ -3226,43 +3266,60 @@ class GraphAPIComputeServiceResourceCreateUpdateProperties(TypedDict, total=Fals """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" -class GraphAPIComputeServiceResourceProperties(TypedDict, total=False): - """Properties for GraphAPIComputeServiceResource. +class GraphResource(TypedDict, total=False): + """Cosmos DB Graph resource object. - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: str - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: Union[str, "ServiceStatus"] - :ivar graph_api_compute_endpoint: GraphAPICompute endpoint for the service. - :vartype graph_api_compute_endpoint: str - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list["GraphAPIComputeRegionalServiceResource"] - :ivar service_type: ServiceType for the service. Required. GRAPH_API_COMPUTE. - :vartype service_type: Literal[ServiceType.GRAPH_API_COMPUTE] - """ - - creationTime: str - """Time of the last state change (ISO-8601 format).""" - instanceSize: Union[str, "ServiceSize"] - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instanceCount: int - """Instance count for the service.""" - status: Union[str, "ServiceStatus"] - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - graphApiComputeEndpoint: str - """GraphAPICompute endpoint for the service.""" - locations: list["GraphAPIComputeRegionalServiceResource"] - """An array that contains all of the locations for the service.""" - serviceType: Required[Literal[ServiceType.GRAPH_API_COMPUTE]] - """ServiceType for the service. Required. GRAPH_API_COMPUTE.""" + :ivar id: Name of the Cosmos DB Graph. Required. + :vartype id: str + """ + + id: Required[str] + """Name of the Cosmos DB Graph. Required.""" + + +class GraphResourceCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB Graph resource. + + :ivar id: The unique resource identifier of the ARM resource. + :vartype id: str + :ivar name: The name of the ARM resource. + :vartype name: str + :ivar type: The type of Azure resource. + :vartype type: str + :ivar 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: "ManagedServiceIdentity" + :ivar properties: Properties to create and update Azure Cosmos DB Graph resource. Required. + :vartype properties: "GraphResourceCreateUpdateProperties" + """ + + properties: Required["GraphResourceCreateUpdateProperties"] + """Properties to create and update Azure Cosmos DB Graph resource. Required.""" + + +class GraphResourceCreateUpdateProperties(TypedDict, total=False): + """Properties to create and update Azure Cosmos DB Graph resource. + + :ivar resource: The standard JSON format of a Graph resource. Required. + :vartype resource: "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: "CreateUpdateOptions" + """ + + resource: Required["GraphResource"] + """The standard JSON format of a Graph resource. Required.""" + options: "CreateUpdateOptions" + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" class GremlinDatabaseCreateUpdateParameters(ARMResourceProperties): @@ -3310,40 +3367,16 @@ class GremlinDatabaseCreateUpdateProperties(TypedDict, total=False): with the request.""" -class GremlinDatabaseGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB SQL database. - - :ivar resource: - :vartype resource: "GremlinDatabaseGetPropertiesResource" - :ivar options: - :vartype options: "GremlinDatabaseGetPropertiesOptions" - """ - - resource: "GremlinDatabaseGetPropertiesResource" - options: "GremlinDatabaseGetPropertiesOptions" - - -class GremlinDatabaseGetPropertiesOptions(OptionsResource): - """GremlinDatabaseGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: "AutoscaleSettings" - """ - - class GremlinDatabaseResource(TypedDict, total=False): """Cosmos DB Gremlin database resource object. :ivar id: Name of the Cosmos DB Gremlin database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] + :vartype createMode: Union[str, "CreateMode"] """ id: Required[str] @@ -3354,85 +3387,13 @@ class GremlinDatabaseResource(TypedDict, total=False): """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" -class GremlinDatabaseGetPropertiesResource(GremlinDatabaseResource): - """GremlinDatabaseGetPropertiesResource. - - :ivar id: Name of the Cosmos DB Gremlin database. Required. - :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class GremlinDatabaseGetResults(ProxyResource): - """An Azure Cosmos DB Gremlin database. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB SQL database. - :vartype properties: "GremlinDatabaseGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "GremlinDatabaseGetProperties" - """The properties of an Azure Cosmos DB SQL database.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class GremlinDatabaseRestoreResource(TypedDict, total=False): """Specific Gremlin Databases to restore. - :ivar database_name: The name of the gremlin database available for restore. - :vartype database_name: str - :ivar graph_names: The names of the graphs available for restore. - :vartype graph_names: list[str] + :ivar databaseName: The name of the gremlin database available for restore. + :vartype databaseName: str + :ivar graphNames: The names of the graphs available for restore. + :vartype graphNames: list[str] """ databaseName: str @@ -3486,165 +3447,54 @@ class GremlinGraphCreateUpdateProperties(TypedDict, total=False): with the request.""" -class GremlinGraphGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Gremlin graph. - - :ivar resource: - :vartype resource: "GremlinGraphGetPropertiesResource" - :ivar options: - :vartype options: "GremlinGraphGetPropertiesOptions" - """ - - resource: "GremlinGraphGetPropertiesResource" - options: "GremlinGraphGetPropertiesOptions" - - -class GremlinGraphGetPropertiesOptions(OptionsResource): - """GremlinGraphGetPropertiesOptions. - - :ivar throughput: Value of the Cosmos DB resource throughput or autoscaleSettings. Use the - ThroughputSetting resource when retrieving offer details. - :vartype throughput: int - :ivar autoscale_settings: Specifies the Autoscale settings. - :vartype autoscale_settings: "AutoscaleSettings" - """ - - class GremlinGraphResource(TypedDict, total=False): """Cosmos DB Gremlin graph resource object. :ivar id: Name of the Cosmos DB Gremlin graph. Required. :vartype id: str - :ivar indexing_policy: The configuration of the indexing policy. By default, the indexing is + :ivar indexingPolicy: The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. - :vartype indexing_policy: "IndexingPolicy" - :ivar partition_key: The configuration of the partition key to be used for partitioning data + :vartype indexingPolicy: "IndexingPolicy" + :ivar partitionKey: The configuration of the partition key to be used for partitioning data into multiple partitions. - :vartype partition_key: "ContainerPartitionKey" - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + :vartype partitionKey: "ContainerPartitionKey" + :ivar defaultTtl: Default time to live. + :vartype defaultTtl: int + :ivar uniqueKeyPolicy: The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: "UniqueKeyPolicy" - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: "ConflictResolutionPolicy" - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - """ - - id: Required[str] - """Name of the Cosmos DB Gremlin graph. Required.""" - indexingPolicy: "IndexingPolicy" - """The configuration of the indexing policy. By default, the indexing is automatic for all - document paths within the graph.""" - partitionKey: "ContainerPartitionKey" - """The configuration of the partition key to be used for partitioning data into multiple - partitions.""" - defaultTtl: int - """Default time to live.""" - uniqueKeyPolicy: "UniqueKeyPolicy" - """The unique key policy configuration for specifying uniqueness constraints on documents in the - collection in the Azure Cosmos DB service.""" - conflictResolutionPolicy: "ConflictResolutionPolicy" - """The conflict resolution policy for the graph.""" - analyticalStorageTtl: int - """Analytical TTL.""" - restoreParameters: "ResourceRestoreParameters" - """Parameters to indicate the information about the restore.""" - createMode: Union[str, "CreateMode"] - """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" - - -class GremlinGraphGetPropertiesResource(GremlinGraphResource): - """GremlinGraphGetPropertiesResource. - - :ivar id: Name of the Cosmos DB Gremlin graph. 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 graph. - :vartype indexing_policy: "IndexingPolicy" - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: "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: "UniqueKeyPolicy" - :ivar conflict_resolution_policy: The conflict resolution policy for the graph. - :vartype conflict_resolution_policy: "ConflictResolutionPolicy" - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class GremlinGraphGetResults(ProxyResource): - """An Azure Cosmos DB Gremlin graph. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB Gremlin graph. - :vartype properties: "GremlinGraphGetProperties" - :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: "ManagedServiceIdentity" + :vartype uniqueKeyPolicy: "UniqueKeyPolicy" + :ivar conflictResolutionPolicy: The conflict resolution policy for the graph. + :vartype conflictResolutionPolicy: "ConflictResolutionPolicy" + :ivar analyticalStorageTtl: Analytical TTL. + :vartype analyticalStorageTtl: int + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of resource creation. Known values are: "Default" + and "Restore". + :vartype createMode: Union[str, "CreateMode"] """ - properties: "GremlinGraphGetProperties" - """The properties of an Azure Cosmos DB Gremlin graph.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" + id: Required[str] + """Name of the Cosmos DB Gremlin graph. Required.""" + indexingPolicy: "IndexingPolicy" + """The configuration of the indexing policy. By default, the indexing is automatic for all + document paths within the graph.""" + partitionKey: "ContainerPartitionKey" + """The configuration of the partition key to be used for partitioning data into multiple + partitions.""" + defaultTtl: int + """Default time to live.""" + uniqueKeyPolicy: "UniqueKeyPolicy" + """The unique key policy configuration for specifying uniqueness constraints on documents in the + collection in the Azure Cosmos DB service.""" + conflictResolutionPolicy: "ConflictResolutionPolicy" + """The conflict resolution policy for the graph.""" + analyticalStorageTtl: int + """Analytical TTL.""" + restoreParameters: "ResourceRestoreParameters" + """Parameters to indicate the information about the restore.""" + createMode: Union[str, "CreateMode"] + """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" class GremlinRoleAssignmentResource(ProxyResource): @@ -3658,9 +3508,9 @@ class GremlinRoleAssignmentResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Assignment. :vartype properties: "GremlinRoleAssignmentResourceProperties" """ @@ -3672,17 +3522,17 @@ class GremlinRoleAssignmentResource(ProxyResource): class GremlinRoleAssignmentResourceProperties(TypedDict, total=False): """Azure Cosmos DB Gremlin Role Assignment resource object. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str + :ivar roleDefinitionId: The unique identifier for the associated Role Definition. + :vartype roleDefinitionId: str :ivar scope: The data plane resource path for which access is being granted through this Gremlin Role Assignment. :vartype scope: str - :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + :ivar principalId: The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this Gremlin 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 + :vartype principalId: str + :ivar provisioningState: Provisioning state of the resource. + :vartype provisioningState: str """ roleDefinitionId: str @@ -3709,9 +3559,9 @@ class GremlinRoleDefinitionResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Gremlin Role Definition. :vartype properties: "GremlinRoleDefinitionResourceProperties" """ @@ -3725,18 +3575,18 @@ class GremlinRoleDefinitionResourceProperties(TypedDict, total=False): :ivar id: The path id for the Role Definition. :vartype id: str - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "RoleDefinitionType"] - :ivar assignable_scopes: A set of fully qualified Scopes at or below which Gremlin Role + :ivar assignableScopes: A set of fully qualified Scopes at or below which Gremlin 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] + :vartype assignableScopes: list[str] :ivar permissions: The set of operations allowed through this Role Definition. :vartype permissions: list["Permission"] """ @@ -3778,9 +3628,9 @@ class IncludedPath(TypedDict, total=False): class Indexes(TypedDict, total=False): """The indexes for the path. - :ivar data_type: The datatype for which the indexing behavior is applied to. Known values are: + :ivar dataType: The datatype for which the indexing behavior is applied to. Known values are: "String", "Number", "Point", "Polygon", "LineString", and "MultiPolygon". - :vartype data_type: Union[str, "DataType"] + :vartype dataType: Union[str, "DataType"] :ivar precision: The precision of the index. -1 is maximum precision. :vartype precision: int :ivar kind: Indicates the type of index. Known values are: "Hash", "Range", and "Spatial". @@ -3801,21 +3651,21 @@ class IndexingPolicy(TypedDict, total=False): :ivar automatic: Indicates if the indexing policy is automatic. :vartype automatic: bool - :ivar indexing_mode: Indicates the indexing mode. Known values are: "consistent", "lazy", and + :ivar indexingMode: Indicates the indexing mode. Known values are: "consistent", "lazy", and "none". - :vartype indexing_mode: Union[str, "IndexingMode"] - :ivar included_paths: List of paths to include in the indexing. - :vartype included_paths: list["IncludedPath"] - :ivar excluded_paths: List of paths to exclude from indexing. - :vartype excluded_paths: list["ExcludedPath"] - :ivar composite_indexes: List of composite path list. - :vartype composite_indexes: list[list["CompositePath"]] - :ivar spatial_indexes: List of spatial specifics. - :vartype spatial_indexes: list["SpatialSpec"] - :ivar vector_indexes: List of paths to include in the vector indexing. - :vartype vector_indexes: list["VectorIndex"] - :ivar full_text_indexes: List of paths to include in the full text indexing. - :vartype full_text_indexes: list["FullTextIndexPath"] + :vartype indexingMode: Union[str, "IndexingMode"] + :ivar includedPaths: List of paths to include in the indexing. + :vartype includedPaths: list["IncludedPath"] + :ivar excludedPaths: List of paths to exclude from indexing. + :vartype excludedPaths: list["ExcludedPath"] + :ivar compositeIndexes: List of composite path list. + :vartype compositeIndexes: list[list["CompositePath"]] + :ivar spatialIndexes: List of spatial specifics. + :vartype spatialIndexes: list["SpatialSpec"] + :ivar vectorIndexes: List of paths to include in the vector indexing. + :vartype vectorIndexes: list["VectorIndex"] + :ivar fullTextIndexes: List of paths to include in the full text indexing. + :vartype fullTextIndexes: list["FullTextIndexPath"] """ automatic: bool @@ -3839,11 +3689,11 @@ class IndexingPolicy(TypedDict, total=False): class IpAddressOrRange(TypedDict, total=False): """IpAddressOrRange object. - :ivar ip_address_or_range: A single IPv4 address or a single IPv4 address range in CIDR format. + :ivar ipAddressOrRange: A single IPv4 address or a single IPv4 address range in CIDR format. Provided IPs must be well-formatted and cannot be contained in one of the following ranges: 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, since these are not enforceable by the IP address filter. Example of valid inputs: “23.40.210.245” or “23.40.210.0/8”. - :vartype ip_address_or_range: str + :vartype ipAddressOrRange: str """ ipAddressOrRange: str @@ -3883,21 +3733,21 @@ class Location(TypedDict, total=False): :ivar id: The unique identifier of the region within the database account. Example: <accountName>-<locationName>. :vartype id: str - :ivar location_name: The name of the region. - :vartype location_name: str - :ivar document_endpoint: The connection endpoint for the specific region. Example: + :ivar locationName: The name of the region. + :vartype locationName: str + :ivar documentEndpoint: The connection endpoint for the specific region. Example: https://<accountName>-<locationName>.documents.azure.com:443/. - :vartype document_endpoint: str - :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 - - 1). Failover priority values must be unique for each of the regions in which the database - account exists. - :vartype failover_priority: int - :ivar is_zone_redundant: Flag to indicate whether or not this region is an AvailabilityZone + :vartype documentEndpoint: str + :ivar provisioningState: The provisioning state of the resource. + :vartype provisioningState: str + :ivar failoverPriority: The failover priority of the region. A failover priority of 0 indicates + a write region. The maximum value for a failover priority = (total number of regions - 1). + Failover priority values must be unique for each of the regions in which the database account + exists. + :vartype failoverPriority: int + :ivar isZoneRedundant: Flag to indicate whether or not this region is an AvailabilityZone region. - :vartype is_zone_redundant: bool + :vartype isZoneRedundant: bool """ id: str @@ -3918,73 +3768,13 @@ class Location(TypedDict, total=False): """Flag to indicate whether or not this region is an AvailabilityZone region.""" -class LocationGetResult(ProxyResource): - """Cosmos DB location get result. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Cosmos DB location metadata. - :vartype properties: "LocationProperties" - """ - - properties: "LocationProperties" - """Cosmos DB location metadata.""" - - -class LocationProperties(TypedDict, total=False): - """Cosmos DB location metadata. - - :ivar supports_availability_zone: Flag indicating whether the location supports availability - zones or not. - :vartype supports_availability_zone: bool - :ivar is_residency_restricted: Flag indicating whether the location is residency sensitive. - :vartype is_residency_restricted: bool - :ivar backup_storage_redundancies: The properties of available backup storage redundancies. - :vartype backup_storage_redundancies: list[Union[str, "BackupStorageRedundancy"]] - :ivar is_subscription_region_access_allowed_for_regular: Flag indicating whether the - subscription have access in region for Non-Availability Zones. - :vartype is_subscription_region_access_allowed_for_regular: bool - :ivar is_subscription_region_access_allowed_for_az: Flag indicating whether the subscription - 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", "Deleting", "Succeeded", - "Failed", "Canceled", "Updating", and "Creating". - :vartype status: Union[str, "Status"] - """ - - supportsAvailabilityZone: bool - """Flag indicating whether the location supports availability zones or not.""" - isResidencyRestricted: bool - """Flag indicating whether the location is residency sensitive.""" - backupStorageRedundancies: list[Union[str, "BackupStorageRedundancy"]] - """The properties of available backup storage redundancies.""" - isSubscriptionRegionAccessAllowedForRegular: bool - """Flag indicating whether the subscription have access in region for Non-Availability Zones.""" - isSubscriptionRegionAccessAllowedForAz: bool - """Flag indicating whether the subscription have access in region for Availability Zones(Az).""" - status: Union[str, "Status"] - """Enum to indicate current buildout status of the region. Known values are: \"Uninitialized\", - \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", - \"Canceled\", \"Updating\", and \"Creating\".""" - - class ManagedCassandraManagedServiceIdentity(TypedDict, total=False): """Identity for the resource. - :ivar principal_id: The object id of the identity resource. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the resource. - :vartype tenant_id: str + :ivar principalId: The object id of the identity resource. + :vartype principalId: str + :ivar tenantId: The tenant id of the resource. + :vartype tenantId: str :ivar type: The type of the resource. Known values are: "SystemAssigned" and "None". :vartype type: Union[str, "ManagedCassandraResourceIdentityType"] """ @@ -3997,42 +3787,24 @@ class ManagedCassandraManagedServiceIdentity(TypedDict, total=False): """The type of the resource. Known values are: \"SystemAssigned\" and \"None\".""" -class ManagedCassandraReaperStatus(TypedDict, total=False): - """ManagedCassandraReaperStatus. - - :ivar healthy: - :vartype healthy: bool - :ivar repair_run_ids: Dictionary of . - :vartype repair_run_ids: dict[str, str] - :ivar repair_schedules: Dictionary of . - :vartype repair_schedules: dict[str, str] - """ - - healthy: bool - repairRunIds: dict[str, str] - """Dictionary of .""" - repairSchedules: dict[str, str] - """Dictionary of .""" - - class ManagedServiceIdentity(TypedDict, total=False): """Identity for the resource. - :ivar principal_id: The principal id of the system assigned identity. This property will only - be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity. This property will only be + :ivar principalId: The principal id of the system assigned identity. This property will only be provided for a system assigned identity. - :vartype tenant_id: str + :vartype principalId: str + :ivar tenantId: The tenant id of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenantId: str :ivar type: The type of identity used for the resource. The type 'SystemAssigned,UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the service. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned", and "None". :vartype type: Union[str, "ResourceIdentityType"] - :ivar user_assigned_identities: The list of user identities associated with resource. The user + :ivar userAssignedIdentities: The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :vartype user_assigned_identities: dict[str, "ManagedServiceIdentityUserAssignedIdentity"] + :vartype userAssignedIdentities: dict[str, "ManagedServiceIdentityUserAssignedIdentity"] """ principalId: str @@ -4055,10 +3827,10 @@ class ManagedServiceIdentity(TypedDict, total=False): class ManagedServiceIdentityUserAssignedIdentity(TypedDict, total=False): # pylint: disable=name-too-long """ManagedServiceIdentityUserAssignedIdentity. - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str + :ivar principalId: The principal id of user assigned identity. + :vartype principalId: str + :ivar clientId: The client id of user assigned identity. + :vartype clientId: str """ principalId: str @@ -4067,31 +3839,61 @@ class ManagedServiceIdentityUserAssignedIdentity(TypedDict, total=False): # pyl """The client id of user assigned identity.""" -class MaterializedViewsBuilderRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long - """Resource for a regional service location. +class MaterializedViewDefinition(TypedDict, total=False): + """Materialized View definition for the container. - :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: Union[str, "ServiceStatus"] + :ivar sourceCollectionRid: An unique identifier for the source collection. This is a system + generated property. + :vartype sourceCollectionRid: str + :ivar sourceCollectionId: The name of the source container on which the Materialized View will + be created. Required. + :vartype sourceCollectionId: 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 + :ivar throughputBucketForBuild: Throughput bucket assigned for the materialized view operations + on target container. + :vartype throughputBucketForBuild: int + """ + + sourceCollectionRid: str + """An unique identifier for the source collection. This is a system generated property.""" + sourceCollectionId: Required[str] + """The name of the source container on which the Materialized View will be created. Required.""" + definition: Required[str] + """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.""" + throughputBucketForBuild: int + """Throughput bucket assigned for the materialized view operations on target container.""" + + +class MaterializedViewDetails(TypedDict, total=False): + """MaterializedViewDetails, contains Id & _rid fields of materialized view. + + :ivar id: Id field of Materialized container. + :vartype id: str + :ivar _rid: _rid field of Materialized container. + :vartype _rid: str """ + id: str + """Id field of Materialized container.""" + _rid: str + """_rid field of Materialized container.""" + class MaterializedViewsBuilderServiceResourceCreateUpdateProperties( TypedDict, total=False ): # pylint: disable=name-too-long """Properties for Create or Update request for MaterializedViewsBuilderServiceResource. - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + :ivar instanceSize: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar service_type: ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER. - :vartype service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] + :vartype instanceSize: Union[str, "ServiceSize"] + :ivar instanceCount: Instance count for the service. + :vartype instanceCount: int + :ivar serviceType: ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER. + :vartype serviceType: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] """ instanceSize: Union[str, "ServiceSize"] @@ -4103,164 +3905,27 @@ class MaterializedViewsBuilderServiceResourceCreateUpdateProperties( """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" -class MaterializedViewsBuilderServiceResourceProperties(TypedDict, total=False): # pylint: disable=name-too-long - """Properties for MaterializedViewsBuilderServiceResource. +class MaterializedViewsProperties(TypedDict, total=False): + """Materialized Views Properties for the source container. - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: str - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: Union[str, "ServiceStatus"] - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list["MaterializedViewsBuilderRegionalServiceResource"] - :ivar service_type: ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER. - :vartype service_type: Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER] - """ - - creationTime: str - """Time of the last state change (ISO-8601 format).""" - instanceSize: Union[str, "ServiceSize"] - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instanceCount: int - """Instance count for the service.""" - status: Union[str, "ServiceStatus"] - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - locations: list["MaterializedViewsBuilderRegionalServiceResource"] - """An array that contains all of the locations for the service.""" - serviceType: Required[Literal[ServiceType.MATERIALIZED_VIEWS_BUILDER]] - """ServiceType for the service. Required. MATERIALIZED_VIEWS_BUILDER.""" + :ivar throughputBucketForBuild: Throughput bucket assigned for the materialized view operations + on source container. + :vartype throughputBucketForBuild: int + """ + throughputBucketForBuild: int + """Throughput bucket assigned for the materialized view operations on source container.""" -class Metric(TypedDict, total=False): - """Metric data. - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: str - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: str - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar name: The name information for the metric. - :vartype name: "MetricName" - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list["MetricValue"] - """ +class MergeParameters(TypedDict, total=False): + """The properties of an Azure Cosmos DB merge operations. - startTime: str - """The start time for the metric (ISO-8601 format).""" - endTime: str - """The end time for the metric (ISO-8601 format).""" - timeGrain: str - """The time grain to be used to summarize the metric values.""" - unit: Union[str, "UnitType"] - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: "MetricName" - """The name information for the metric.""" - metricValues: list["MetricValue"] - """The metric values for the specified time window and timestep.""" - - -class MetricAvailability(TypedDict, total=False): - """The availability of the metric. - - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar retention: The retention for the metric values. - :vartype retention: str - """ - - timeGrain: str - """The time grain to be used to summarize the metric values.""" - retention: str - """The retention for the metric values.""" - - -class MetricDefinition(TypedDict, total=False): - """The definition of a metric. - - :ivar metric_availabilities: The list of metric availabilities for the account. - :vartype metric_availabilities: list["MetricAvailability"] - :ivar primary_aggregation_type: The primary aggregation type of the metric. Known values are: - "None", "Average", "Total", "Minimum", "Maximum", and "Last". - :vartype primary_aggregation_type: Union[str, "PrimaryAggregationType"] - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar resource_uri: The resource uri of the database. - :vartype resource_uri: str - :ivar name: The name information for the metric. - :vartype name: "MetricName" - """ - - metricAvailabilities: list["MetricAvailability"] - """The list of metric availabilities for the account.""" - primaryAggregationType: Union[str, "PrimaryAggregationType"] - """The primary aggregation type of the metric. Known values are: \"None\", \"Average\", \"Total\", - \"Minimum\", \"Maximum\", and \"Last\".""" - unit: Union[str, "UnitType"] - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - resourceUri: str - """The resource uri of the database.""" - name: "MetricName" - """The name information for the metric.""" - - -class MetricName(TypedDict, total=False): - """A metric name. - - :ivar value: The name of the metric. - :vartype value: str - :ivar localized_value: The friendly name of the metric. - :vartype localized_value: str + :ivar isDryRun: Specifies whether the operation is a real merge operation or a simulation. + :vartype isDryRun: bool """ - value: str - """The name of the metric.""" - localizedValue: str - """The friendly name of the metric.""" - - -class MetricValue(TypedDict, total=False): - """Represents metrics values. - - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: str - :ivar total: The total value of the metric. - :vartype total: float - """ - - _count: int - """The number of values for the metric.""" - average: float - """The average value of the metric.""" - maximum: float - """The max value of the metric.""" - minimum: float - """The min value of the metric.""" - timestamp: str - """The metric timestamp (ISO-8601 format).""" - total: float - """The total value of the metric.""" + isDryRun: bool + """Specifies whether the operation is a real merge operation or a simulation.""" class MongoDBCollectionCreateUpdateParameters(ARMResourceProperties): @@ -4308,46 +3973,22 @@ class MongoDBCollectionCreateUpdateProperties(TypedDict, total=False): with the request.""" -class MongoDBCollectionGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB MongoDB collection. - - :ivar resource: - :vartype resource: "MongoDBCollectionGetPropertiesResource" - :ivar options: - :vartype options: "MongoDBCollectionGetPropertiesOptions" - """ - - resource: "MongoDBCollectionGetPropertiesResource" - options: "MongoDBCollectionGetPropertiesOptions" - - -class MongoDBCollectionGetPropertiesOptions(OptionsResource): - """MongoDBCollectionGetPropertiesOptions. - - :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: "AutoscaleSettings" - """ - - class MongoDBCollectionResource(TypedDict, total=False): """Cosmos DB MongoDB collection resource object. :ivar id: Name of the Cosmos DB MongoDB collection. Required. :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] + :ivar shardKey: A key-value pair of shard keys to be applied for the request. + :vartype shardKey: dict[str, str] :ivar indexes: List of index keys. :vartype indexes: list["MongoIndex"] - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" + :ivar analyticalStorageTtl: Analytical TTL. + :vartype analyticalStorageTtl: int + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of resource creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] + :vartype createMode: Union[str, "CreateMode"] """ id: Required[str] @@ -4364,84 +4005,6 @@ class MongoDBCollectionResource(TypedDict, total=False): """Enum to indicate the mode of resource creation. Known values are: \"Default\" and \"Restore\".""" -class MongoDBCollectionGetPropertiesResource(MongoDBCollectionResource): - """MongoDBCollectionGetPropertiesResource. - - :ivar id: Name of the Cosmos DB MongoDB collection. Required. - :vartype id: str - :ivar shard_key: A key-value pair of shard keys to be applied for the request. - :vartype shard_key: dict[str, str] - :ivar indexes: List of index keys. - :vartype indexes: list["MongoIndex"] - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of resource creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class MongoDBCollectionGetResults(ProxyResource): - """An Azure Cosmos DB MongoDB collection. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB MongoDB collection. - :vartype properties: "MongoDBCollectionGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "MongoDBCollectionGetProperties" - """The properties of an Azure Cosmos DB MongoDB collection.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class MongoDBDatabaseCreateUpdateParameters(ARMResourceProperties): """Parameters to create and update Cosmos DB MongoDB database. @@ -4487,40 +4050,16 @@ class MongoDBDatabaseCreateUpdateProperties(TypedDict, total=False): with the request.""" -class MongoDBDatabaseGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB MongoDB database. - - :ivar resource: - :vartype resource: "MongoDBDatabaseGetPropertiesResource" - :ivar options: - :vartype options: "MongoDBDatabaseGetPropertiesOptions" - """ - - resource: "MongoDBDatabaseGetPropertiesResource" - options: "MongoDBDatabaseGetPropertiesOptions" - - -class MongoDBDatabaseGetPropertiesOptions(OptionsResource): - """MongoDBDatabaseGetPropertiesOptions. - - :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: "AutoscaleSettings" - """ - - class MongoDBDatabaseResource(TypedDict, total=False): """Cosmos DB MongoDB database resource object. :ivar id: Name of the Cosmos DB MongoDB database. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] + :vartype createMode: Union[str, "CreateMode"] """ id: Required[str] @@ -4531,78 +4070,6 @@ class MongoDBDatabaseResource(TypedDict, total=False): """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" -class MongoDBDatabaseGetPropertiesResource(MongoDBDatabaseResource): - """MongoDBDatabaseGetPropertiesResource. - - :ivar id: Name of the Cosmos DB MongoDB database. Required. - :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class MongoDBDatabaseGetResults(ProxyResource): - """An Azure Cosmos DB MongoDB database. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB MongoDB database. - :vartype properties: "MongoDBDatabaseGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "MongoDBDatabaseGetProperties" - """The properties of an Azure Cosmos DB MongoDB database.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class MongoIndex(TypedDict, total=False): """Cosmos DB MongoDB collection index key. @@ -4621,8 +4088,8 @@ class MongoIndex(TypedDict, total=False): class MongoIndexKeys(TypedDict, total=False): """Cosmos DB MongoDB collection resource object. - :ivar keys_property: List of keys for each MongoDB collection in the Azure Cosmos DB service. - :vartype keys_property: list[str] + :ivar keys: List of keys for each MongoDB collection in the Azure Cosmos DB service. + :vartype keys: list[str] """ keys: list[str] @@ -4632,8 +4099,8 @@ class MongoIndexKeys(TypedDict, total=False): class MongoIndexOptions(TypedDict, total=False): """Cosmos DB MongoDB collection index options. - :ivar expire_after_seconds: Expire after seconds. - :vartype expire_after_seconds: int + :ivar expireAfterSeconds: Expire after seconds. + :vartype expireAfterSeconds: int :ivar unique: Is unique or not. :vartype unique: bool """ @@ -4655,9 +4122,9 @@ class MongoMIRoleAssignmentResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Assignment. :vartype properties: "MongoMIRoleAssignmentResourceProperties" """ @@ -4669,17 +4136,17 @@ class MongoMIRoleAssignmentResource(ProxyResource): class MongoMIRoleAssignmentResourceProperties(TypedDict, total=False): """Azure Cosmos DB MongoMI Role Assignment resource object. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str + :ivar roleDefinitionId: The unique identifier for the associated Role Definition. + :vartype roleDefinitionId: str :ivar scope: The data plane resource path for which access is being granted through this MongoMI Role Assignment. :vartype scope: str - :ivar principal_id: The unique identifier for the associated AAD principal in the AAD graph to + :ivar principalId: The unique identifier for the associated AAD principal in the AAD graph to which access is being granted through this MongoMI 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 + :vartype principalId: str + :ivar provisioningState: Provisioning state of the resource. + :vartype provisioningState: str """ roleDefinitionId: str @@ -4706,9 +4173,9 @@ class MongoMIRoleDefinitionResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB MongoMI Role Definition. :vartype properties: "MongoMIRoleDefinitionResourceProperties" """ @@ -4722,18 +4189,18 @@ class MongoMIRoleDefinitionResourceProperties(TypedDict, total=False): :ivar id: The path id for the Role Definition. :vartype id: str - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "RoleDefinitionType"] - :ivar assignable_scopes: A set of fully qualified Scopes at or below which MongoMI Role + :ivar assignableScopes: A set of fully qualified Scopes at or below which MongoMI 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] + :vartype assignableScopes: list[str] :ivar permissions: The set of operations allowed through this Role Definition. :vartype permissions: list["Permission"] """ @@ -4766,40 +4233,18 @@ class MongoRoleDefinitionCreateUpdateParameters(TypedDict, total=False): # pyli """Properties to create and update an Azure Cosmos DB Mongo Role Definition.""" -class MongoRoleDefinitionGetResults(ProxyResource): - """An Azure Cosmos DB Mongo Role Definition. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Properties related to the Mongo Role Definition. - :vartype properties: "MongoRoleDefinitionResource" - """ - - properties: "MongoRoleDefinitionResource" - """Properties related to the Mongo Role Definition.""" - - class MongoRoleDefinitionResource(TypedDict, total=False): """Azure Cosmos DB Mongo Role Definition resource object. - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "MongoRoleDefinitionType"] - :ivar database_name: The database name for which access is being granted for this Role + :ivar databaseName: The database name for which access is being granted for this Role Definition. - :vartype database_name: str + :vartype databaseName: str :ivar privileges: A set of privileges contained by the Role Definition. This will allow application of this Role Definition on the entire database account or any underlying Database / Collection. Scopes higher than Database are not enforceable as privilege. @@ -4823,51 +4268,113 @@ class MongoRoleDefinitionResource(TypedDict, total=False): """The set of roles inherited by this Role Definition.""" -class MongoUserDefinitionCreateUpdateParameters(TypedDict, total=False): # pylint: disable=name-too-long - """Parameters to create and update an Azure Cosmos DB Mongo User Definition. +class MongoRUToMongoRUCopyJobProperties(TypedDict, total=False): + """Source Mongo to Destination Mongo copy job properties. - :ivar properties: Properties to create and update an Azure Cosmos DB Mongo User Definition. - :vartype properties: "MongoUserDefinitionResource" + :ivar sourceDetails: Source Mongo DataStore details. + :vartype sourceDetails: "CosmosDBSourceSinkDetails" + :ivar destinationDetails: Destination Mongo DataStore details. + :vartype destinationDetails: "CosmosDBSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["MongoRUToMongoRUCopyJobTask"] + :ivar jobType: Copy Job Type. Required. MONGO_RU_TO_MONGO_RU. + :vartype jobType: Literal[CopyJobType.MONGO_RU_TO_MONGO_RU] """ - properties: "MongoUserDefinitionResource" - """Properties to create and update an Azure Cosmos DB Mongo User Definition.""" + sourceDetails: "CosmosDBSourceSinkDetails" + """Source Mongo DataStore details.""" + destinationDetails: "CosmosDBSourceSinkDetails" + """Destination Mongo DataStore details.""" + tasks: Required[list["MongoRUToMongoRUCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.MONGO_RU_TO_MONGO_RU]] + """Copy Job Type. Required. MONGO_RU_TO_MONGO_RU.""" -class MongoUserDefinitionGetResults(ProxyResource): - """An Azure Cosmos DB User Definition. +class MongoRUToMongoRUCopyJobTask(BaseCopyJobTask): + """MongoRUToMongoRUCopyJobTask. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Properties related to the User Definition. + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source Mongo (RU) collection. Required. + :vartype source: "CosmosDBMongoCollection" + :ivar destination: Destination Mongo (RU) collection. Required. + :vartype destination: "CosmosDBMongoCollection" + """ + + source: Required["CosmosDBMongoCollection"] + """Source Mongo (RU) collection. Required.""" + destination: Required["CosmosDBMongoCollection"] + """Destination Mongo (RU) collection. Required.""" + + +class MongoRUToMongoVCoreCopyJobProperties(TypedDict, total=False): + """Source Mongo to Destination Mongo vCore copy job properties. + + :ivar sourceDetails: Source Mongo (RU) DataStore details. + :vartype sourceDetails: "CosmosDBSourceSinkDetails" + :ivar destinationDetails: Destination Mongo (vCore) DataStore details. Required. + :vartype destinationDetails: "MongoVCoreSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["MongoRUToMongoVCoreCopyJobTask"] + :ivar jobType: Copy Job Type. Required. MONGO_RU_TO_MONGO_V_CORE. + :vartype jobType: Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE] + """ + + sourceDetails: "CosmosDBSourceSinkDetails" + """Source Mongo (RU) DataStore details.""" + destinationDetails: Required["MongoVCoreSourceSinkDetails"] + """Destination Mongo (vCore) DataStore details. Required.""" + tasks: Required[list["MongoRUToMongoVCoreCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.MONGO_RU_TO_MONGO_V_CORE]] + """Copy Job Type. Required. MONGO_RU_TO_MONGO_V_CORE.""" + + +class MongoRUToMongoVCoreCopyJobTask(BaseCopyJobTask): + """MongoRUToMongoVCoreCopyJobTask. + + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source Mongo (RU) collection. Required. + :vartype source: "CosmosDBMongoCollection" + :ivar destination: Destination Mongo (vCore) collection. Required. + :vartype destination: "CosmosDBMongoVCoreCollection" + """ + + source: Required["CosmosDBMongoCollection"] + """Source Mongo (RU) collection. Required.""" + destination: Required["CosmosDBMongoVCoreCollection"] + """Destination Mongo (vCore) collection. Required.""" + + +class MongoUserDefinitionCreateUpdateParameters(TypedDict, total=False): # pylint: disable=name-too-long + """Parameters to create and update an Azure Cosmos DB Mongo User Definition. + + :ivar properties: Properties to create and update an Azure Cosmos DB Mongo User Definition. :vartype properties: "MongoUserDefinitionResource" """ properties: "MongoUserDefinitionResource" - """Properties related to the User Definition.""" + """Properties to create and update an Azure Cosmos DB Mongo User Definition.""" class MongoUserDefinitionResource(TypedDict, total=False): """Azure Cosmos DB Mongo User Definition resource object. - :ivar user_name: The user name for User Definition. - :vartype user_name: str + :ivar userName: The user name for User Definition. + :vartype userName: str :ivar password: The password for User Definition. Response does not contain user password. :vartype password: str - :ivar database_name: The database name for which access is being granted for this User + :ivar databaseName: The database name for which access is being granted for this User Definition. - :vartype database_name: str - :ivar custom_data: A custom definition for the USer Definition. - :vartype custom_data: str + :vartype databaseName: str + :ivar customData: A custom definition for the USer Definition. + :vartype customData: str :ivar roles: The set of roles inherited by the User Definition. :vartype roles: list["Role"] :ivar mechanisms: The Mongo Auth mechanism. For now, we only support auth mechanism @@ -4889,42 +4396,60 @@ class MongoUserDefinitionResource(TypedDict, total=False): """The Mongo Auth mechanism. For now, we only support auth mechanism SCRAM-SHA-256.""" -class NotebookWorkspace(ProxyResource): - """A notebook workspace resource. +class MongoVCoreSourceSinkDetails(TypedDict, total=False): + """A CosmosDB Mongo vCore data source/sink details. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Resource properties. - :vartype properties: "NotebookWorkspaceProperties" + :ivar hostName: + :vartype hostName: str + :ivar connectionStringKeyVaultUri: URI of Azure KeyVault secret containing connection string. + :vartype connectionStringKeyVaultUri: str + """ + + hostName: str + connectionStringKeyVaultUri: str + """URI of Azure KeyVault secret containing connection string.""" + + +class NoSqlRUToNoSqlRUCopyJobProperties(TypedDict, total=False): + """Source SQL to Destination SQL copy job properties. + + :ivar sourceDetails: Source SQL DataStore details. + :vartype sourceDetails: "CosmosDBSourceSinkDetails" + :ivar destinationDetails: Destination SQL DataStore details. + :vartype destinationDetails: "CosmosDBSourceSinkDetails" + :ivar tasks: Copy Job tasks. Required. + :vartype tasks: list["NoSqlRUToNoSqlRUCopyJobTask"] + :ivar jobType: Copy Job Type. Required. NO_SQL_RU_TO_NO_SQL_RU. + :vartype jobType: Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU] """ - properties: "NotebookWorkspaceProperties" - """Resource properties.""" + sourceDetails: "CosmosDBSourceSinkDetails" + """Source SQL DataStore details.""" + destinationDetails: "CosmosDBSourceSinkDetails" + """Destination SQL DataStore details.""" + tasks: Required[list["NoSqlRUToNoSqlRUCopyJobTask"]] + """Copy Job tasks. Required.""" + jobType: Required[Literal[CopyJobType.NO_SQL_RU_TO_NO_SQL_RU]] + """Copy Job Type. Required. NO_SQL_RU_TO_NO_SQL_RU.""" -class NotebookWorkspaceConnectionInfoResult(TypedDict, total=False): - """The connection info for the given notebook workspace. +class NoSqlRUToNoSqlRUCopyJobTask(BaseCopyJobTask): + """NoSqlRUToNoSqlRUCopyJobTask. - :ivar auth_token: Specifies auth token used for connecting to Notebook server (uses token-based - auth). - :vartype auth_token: str - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str + :ivar totalCount: Task level Total Count. + :vartype totalCount: int + :ivar processedCount: Task level Processed Count. + :vartype processedCount: int + :ivar source: Source SQL container. Required. + :vartype source: "CosmosDBNoSqlContainer" + :ivar destination: Destination SQL container. Required. + :vartype destination: "CosmosDBNoSqlContainer" """ - authToken: str - """Specifies auth token used for connecting to Notebook server (uses token-based auth).""" - notebookServerEndpoint: str - """Specifies the endpoint of Notebook server.""" + source: Required["CosmosDBNoSqlContainer"] + """Source SQL container. Required.""" + destination: Required["CosmosDBNoSqlContainer"] + """Destination SQL container. Required.""" class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): @@ -4939,233 +4464,14 @@ class NotebookWorkspaceCreateUpdateParameters(ARMProxyResource): """ -class NotebookWorkspaceProperties(TypedDict, total=False): - """Properties of a notebook workspace resource. - - :ivar notebook_server_endpoint: Specifies the endpoint of Notebook server. - :vartype notebook_server_endpoint: str - :ivar status: Status of the notebook workspace. Possible values are: Creating, Online, - Deleting, Failed, Updating. - :vartype status: str - """ - - notebookServerEndpoint: str - """Specifies the endpoint of Notebook server.""" - status: str - """Status of the notebook workspace. Possible values are: Creating, Online, Deleting, Failed, - Updating.""" - - -class Operation(TypedDict, total=False): - """REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: "OperationDisplay" - """ - - name: str - """Operation name: {provider}/{resource}/{operation}.""" - display: "OperationDisplay" - """The object that represents the operation.""" - - -class OperationDisplay(TypedDict, total=False): - """The object that represents the operation. - - :ivar provider: Service provider: Microsoft.ResourceProvider. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - :ivar description: Description of operation. - :vartype description: str - """ - - Provider: str - """Service provider: Microsoft.ResourceProvider.""" - Resource: str - """Resource on which the operation is performed: Profile, endpoint, etc.""" - Operation: str - """Operation type: Read, write, delete, etc.""" - Description: str - """Description of operation.""" - - -class PartitionMetric(Metric): - """The metric values for a single partition. - - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: str - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: str - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar name: The name information for the metric. - :vartype name: "MetricName" - :ivar metric_values: The metric values for the specified time window and timestep. - :vartype metric_values: list["MetricValue"] - :ivar partition_id: The partition id (GUID identifier) of the metric values. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the metric - values. - :vartype partition_key_range_id: str - """ - - partitionId: str - """The partition id (GUID identifier) of the metric values.""" - partitionKeyRangeId: str - """The partition key range id (integer identifier) of the metric values.""" - - -class Usage(TypedDict, total=False): - """The usage data for a usage request. - - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar name: The name information for the metric. - :vartype name: "MetricName" - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: int - :ivar current_value: Current value for this metric. - :vartype current_value: int - """ - - unit: Union[str, "UnitType"] - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: "MetricName" - """The name information for the metric.""" - quotaPeriod: str - """The quota period used to summarize the usage values.""" - limit: int - """Maximum value for this metric.""" - currentValue: int - """Current value for this metric.""" - - -class PartitionUsage(Usage): - """The partition level usage data for a usage request. - - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar name: The name information for the metric. - :vartype name: "MetricName" - :ivar quota_period: The quota period used to summarize the usage values. - :vartype quota_period: str - :ivar limit: Maximum value for this metric. - :vartype limit: int - :ivar current_value: Current value for this metric. - :vartype current_value: int - :ivar partition_id: The partition id (GUID identifier) of the usages. - :vartype partition_id: str - :ivar partition_key_range_id: The partition key range id (integer identifier) of the usages. - :vartype partition_key_range_id: str - """ - - partitionId: str - """The partition id (GUID identifier) of the usages.""" - partitionKeyRangeId: str - """The partition key range id (integer identifier) of the usages.""" - - -class PercentileMetric(TypedDict, total=False): - """Percentile Metric data. - - :ivar start_time: The start time for the metric (ISO-8601 format). - :vartype start_time: str - :ivar end_time: The end time for the metric (ISO-8601 format). - :vartype end_time: str - :ivar time_grain: The time grain to be used to summarize the metric values. - :vartype time_grain: str - :ivar unit: The unit of the metric. Known values are: "Count", "Bytes", "Seconds", "Percent", - "CountPerSecond", "BytesPerSecond", and "Milliseconds". - :vartype unit: Union[str, "UnitType"] - :ivar name: The name information for the metric. - :vartype name: "MetricName" - :ivar metric_values: The percentile metric values for the specified time window and timestep. - :vartype metric_values: list["PercentileMetricValue"] - """ - - startTime: str - """The start time for the metric (ISO-8601 format).""" - endTime: str - """The end time for the metric (ISO-8601 format).""" - timeGrain: str - """The time grain to be used to summarize the metric values.""" - unit: Union[str, "UnitType"] - """The unit of the metric. Known values are: \"Count\", \"Bytes\", \"Seconds\", \"Percent\", - \"CountPerSecond\", \"BytesPerSecond\", and \"Milliseconds\".""" - name: "MetricName" - """The name information for the metric.""" - metricValues: list["PercentileMetricValue"] - """The percentile metric values for the specified time window and timestep.""" - - -class PercentileMetricValue(MetricValue): - """Represents percentile metrics values. - - :ivar count: The number of values for the metric. - :vartype count: int - :ivar average: The average value of the metric. - :vartype average: float - :ivar maximum: The max value of the metric. - :vartype maximum: float - :ivar minimum: The min value of the metric. - :vartype minimum: float - :ivar timestamp: The metric timestamp (ISO-8601 format). - :vartype timestamp: str - :ivar total: The total value of the metric. - :vartype total: float - :ivar p10: The 10th percentile value for the metric. - :vartype p10: float - :ivar p25: The 25th percentile value for the metric. - :vartype p25: float - :ivar p50: The 50th percentile value for the metric. - :vartype p50: float - :ivar p75: The 75th percentile value for the metric. - :vartype p75: float - :ivar p90: The 90th percentile value for the metric. - :vartype p90: float - :ivar p95: The 95th percentile value for the metric. - :vartype p95: float - :ivar p99: The 99th percentile value for the metric. - :vartype p99: float - """ - - P10: float - """The 10th percentile value for the metric.""" - P25: float - """The 25th percentile value for the metric.""" - P50: float - """The 50th percentile value for the metric.""" - P75: float - """The 75th percentile value for the metric.""" - P90: float - """The 90th percentile value for the metric.""" - P95: float - """The 95th percentile value for the metric.""" - P99: float - """The 99th percentile value for the metric.""" - - class PeriodicModeBackupPolicy(TypedDict, total=False): """The object representing periodic mode backup policy. - :ivar migration_state: The object representing the state of the migration between the backup + :ivar migrationState: The object representing the state of the migration between the backup policies. - :vartype migration_state: "BackupPolicyMigrationState" - :ivar periodic_mode_properties: Configuration values for periodic mode backup. - :vartype periodic_mode_properties: "PeriodicModeProperties" + :vartype migrationState: "BackupPolicyMigrationState" + :ivar periodicModeProperties: Configuration values for periodic mode backup. + :vartype periodicModeProperties: "PeriodicModeProperties" :ivar type: Describes the mode of backups. Required. PERIODIC. :vartype type: Literal[BackupPolicyType.PERIODIC] """ @@ -5181,15 +4487,15 @@ class PeriodicModeBackupPolicy(TypedDict, total=False): class PeriodicModeProperties(TypedDict, total=False): """Configuration values for periodic mode backup. - :ivar backup_interval_in_minutes: An integer representing the interval in minutes between two + :ivar backupIntervalInMinutes: 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 + :vartype backupIntervalInMinutes: int + :ivar backupRetentionIntervalInHours: 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: + :vartype backupRetentionIntervalInHours: int + :ivar backupStorageRedundancy: Enum to indicate type of backup residency. Known values are: "Geo", "Local", and "Zone". - :vartype backup_storage_redundancy: Union[str, "BackupStorageRedundancy"] + :vartype backupStorageRedundancy: Union[str, "BackupStorageRedundancy"] """ backupIntervalInMinutes: int @@ -5205,10 +4511,10 @@ class Permission(TypedDict, total=False): :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] + :ivar dataActions: An array of data actions that are allowed. + :vartype dataActions: list[str] + :ivar notDataActions: An array of data actions that are denied. + :vartype notDataActions: list[str] """ id: str @@ -5219,6 +4525,36 @@ class Permission(TypedDict, total=False): """An array of data actions that are denied.""" +class PhysicalPartitionId(TypedDict, total=False): + """PhysicalPartitionId object. + + :ivar id: Id of a physical partition. Required. + :vartype id: str + """ + + id: Required[str] + """Id of a physical partition. Required.""" + + +class PhysicalPartitionThroughputInfoResource(TypedDict, total=False): + """PhysicalPartitionThroughputInfo object. + + :ivar id: Id of a physical partition. Required. + :vartype id: str + :ivar throughput: Throughput of a physical partition. + :vartype throughput: float + :ivar targetThroughput: Target throughput of a physical partition. + :vartype targetThroughput: float + """ + + id: Required[str] + """Id of a physical partition. Required.""" + throughput: float + """Throughput of a physical partition.""" + targetThroughput: float + """Target throughput of a physical partition.""" + + class PrivateEndpointConnection(ProxyResource): """A private endpoint connection. @@ -5230,9 +4566,9 @@ class PrivateEndpointConnection(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Resource properties. :vartype properties: "PrivateEndpointConnectionProperties" """ @@ -5244,15 +4580,14 @@ class PrivateEndpointConnection(ProxyResource): class PrivateEndpointConnectionProperties(TypedDict, total=False): """Properties of a private endpoint connection. - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: "PrivateEndpointProperty" - :ivar private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :vartype private_link_service_connection_state: "PrivateLinkServiceConnectionStateProperty" - :ivar group_id: Group id of the private endpoint. - :vartype group_id: str - :ivar provisioning_state: Provisioning state of the private endpoint. - :vartype provisioning_state: str + :ivar privateEndpoint: Private endpoint which the connection belongs to. + :vartype privateEndpoint: "PrivateEndpointProperty" + :ivar privateLinkServiceConnectionState: Connection State of the Private Endpoint Connection. + :vartype privateLinkServiceConnectionState: "PrivateLinkServiceConnectionStateProperty" + :ivar groupId: Group id of the private endpoint. + :vartype groupId: str + :ivar provisioningState: Provisioning state of the private endpoint. + :vartype provisioningState: str """ privateEndpoint: "PrivateEndpointProperty" @@ -5276,47 +4611,6 @@ class PrivateEndpointProperty(TypedDict, total=False): """Resource id of the private endpoint.""" -class PrivateLinkResource(ProxyResource): - """A private link resource. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the 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: "SystemData" - :ivar properties: Resource properties. - :vartype properties: "PrivateLinkResourceProperties" - """ - - properties: "PrivateLinkResourceProperties" - """Resource properties.""" - - -class PrivateLinkResourceProperties(TypedDict, total=False): - """Properties of a private link resource. - - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource required zone names. - :vartype required_zone_names: list[str] - """ - - groupId: str - """The private link resource group id.""" - requiredMembers: list[str] - """The private link resource required member names.""" - requiredZoneNames: list[str] - """The private link resource required zone names.""" - - class PrivateLinkServiceConnectionStateProperty(TypedDict, total=False): # pylint: disable=name-too-long """Connection State of the Private Endpoint Connection. @@ -5324,9 +4618,9 @@ class PrivateLinkServiceConnectionStateProperty(TypedDict, total=False): # pyli :vartype status: str :ivar description: The private link service connection description. :vartype description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ + :ivar actionsRequired: Any action that is required beyond basic workflow (approve/ reject/ disconnect). - :vartype actions_required: str + :vartype actionsRequired: str """ status: str @@ -5367,265 +4661,8 @@ class PrivilegeResource(TypedDict, total=False): """The collection name the role is applied.""" -class RegionForOnlineOffline(TypedDict, total=False): - """Cosmos DB region to online or offline. - - :ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required. - :vartype region: str - """ - - region: Required[str] - """Cosmos DB region, with spaces between words and each word capitalized. Required.""" - - -class RestoreParametersBase(TypedDict, total=False): - """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}. - :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: str - :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 - """ - - restoreSource: str - """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}.""" - restoreTimestampInUtc: str - """Time to which the account has to be restored (ISO-8601 format).""" - restoreWithTtlDisabled: bool - """Specifies whether the restored account will have Time-To-Live disabled upon the successful - restore.""" - - -class ResourceRestoreParameters(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}. - :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: str - :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 - """ - - -class RestorableDatabaseAccountGetResult(ProxyResource): - """A Azure Cosmos DB restorable database account. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of a restorable database account. - :vartype properties: "RestorableDatabaseAccountProperties" - :ivar location: The location of the resource group to which the resource belongs. - :vartype location: str - """ - - properties: "RestorableDatabaseAccountProperties" - """The properties of a restorable database account.""" - location: str - """The location of the resource group to which the resource belongs.""" - - -class RestorableDatabaseAccountProperties(TypedDict, total=False): - """The properties of a restorable database account. - - :ivar account_name: The name of the global database account. - :vartype account_name: str - :ivar creation_time: The creation time of the restorable database account (ISO-8601 format). - :vartype creation_time: str - :ivar oldest_restorable_time: The least recent time at which the database account can be - restored to (ISO-8601 format). - :vartype oldest_restorable_time: str - :ivar deletion_time: The time at which the restorable database account has been deleted - (ISO-8601 format). - :vartype deletion_time: str - :ivar api_type: The API type of the restorable database account. Known values are: "MongoDB", - "Gremlin", "Cassandra", "Table", "Sql", and "GremlinV2". - :vartype api_type: Union[str, "ApiType"] - :ivar restorable_locations: List of regions where the of the database account can be restored - from. - :vartype restorable_locations: list["RestorableLocationResource"] - """ - - accountName: str - """The name of the global database account.""" - creationTime: str - """The creation time of the restorable database account (ISO-8601 format).""" - oldestRestorableTime: str - """The least recent time at which the database account can be restored to (ISO-8601 format).""" - deletionTime: str - """The time at which the restorable database account has been deleted (ISO-8601 format).""" - apiType: Union[str, "ApiType"] - """The API type of the restorable database account. Known values are: \"MongoDB\", \"Gremlin\", - \"Cassandra\", \"Table\", \"Sql\", and \"GremlinV2\".""" - restorableLocations: list["RestorableLocationResource"] - """List of regions where the of the database account can be restored from.""" - - -class RestorableGremlinDatabaseGetResult(TypedDict, total=False): - """An Azure Cosmos DB Gremlin database event. - - :ivar properties: The properties of a Gremlin database event. - :vartype properties: "RestorableGremlinDatabaseProperties" - :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 - """ - - properties: "RestorableGremlinDatabaseProperties" - """The properties of a Gremlin database event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - - -class RestorableGremlinDatabaseProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Gremlin database event. - - :ivar resource: The resource of an Azure Cosmos DB Gremlin database event. - :vartype resource: "RestorableGremlinDatabasePropertiesResource" - """ - - resource: "RestorableGremlinDatabasePropertiesResource" - """The resource of an Azure Cosmos DB Gremlin database event.""" - - -class RestorableGremlinDatabasePropertiesResource(TypedDict, total=False): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB Gremlin database event. - - :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", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: Union[str, "OperationType"] - :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 database can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this database event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin database. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin database. - :vartype owner_resource_id: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this database event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this database to identify if this database is restorable in same account.""" - canUndeleteReason: str - """The reason why this database can not be restored in same account.""" - eventTimestamp: str - """The time when this database event happened.""" - ownerId: str - """The name of this Gremlin database.""" - ownerResourceId: str - """The resource ID of this Gremlin database.""" - - -class RestorableGremlinGraphGetResult(TypedDict, total=False): - """An Azure Cosmos DB Gremlin graph event. - - :ivar properties: The properties of a Gremlin graph event. - :vartype properties: "RestorableGremlinGraphProperties" - :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 - """ - - properties: "RestorableGremlinGraphProperties" - """The properties of a Gremlin graph event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - - -class RestorableGremlinGraphProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Gremlin graph event. - - :ivar resource: The resource of an Azure Cosmos DB Gremlin graph event. - :vartype resource: "RestorableGremlinGraphPropertiesResource" - """ - - resource: "RestorableGremlinGraphPropertiesResource" - """The resource of an Azure Cosmos DB Gremlin graph event.""" - - -class RestorableGremlinGraphPropertiesResource(TypedDict, total=False): - """The resource of an Azure Cosmos DB Gremlin graph event. - - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar operation_type: The operation type of this graph event. Known values are: "Create", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: Union[str, "OperationType"] - :ivar can_undelete: A state of this graph to identify if this graph is restorable in same - account. - :vartype can_undelete: str - :ivar can_undelete_reason: The reason why this graph can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this graph event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this Gremlin graph. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this Gremlin graph. - :vartype owner_resource_id: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this graph event. Known values are: \"Create\", \"Replace\", \"Delete\", - \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this graph to identify if this graph is restorable in same account.""" - canUndeleteReason: str - """The reason why this graph can not be restored in same account.""" - eventTimestamp: str - """The time when this graph event happened.""" - ownerId: str - """The name of this Gremlin graph.""" - ownerResourceId: str - """The resource ID of this Gremlin graph.""" - - -class RestorableGremlinResourcesGetResult(TypedDict, total=False): - """Specific Databases to restore. +class RedistributeThroughputParameters(ARMResourceProperties): + """Cosmos DB redistribute throughput parameters object. :ivar id: The unique resource identifier of the ARM resource. :vartype id: str @@ -5633,330 +4670,152 @@ class RestorableGremlinResourcesGetResult(TypedDict, total=False): :vartype name: str :ivar type: The type of Azure resource. :vartype type: str - :ivar database_name: The name of the gremlin database available for restore. - :vartype database_name: str - :ivar graph_names: The names of the graphs available for restore. - :vartype graph_names: list[str] - """ - - id: str - """The unique resource identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - databaseName: str - """The name of the gremlin database available for restore.""" - graphNames: list[str] - """The names of the graphs available for restore.""" - - -class RestorableLocationResource(TypedDict, total=False): - """Properties of the regional restorable account. - - :ivar location_name: The location of the regional restorable account. - :vartype location_name: str - :ivar regional_database_account_instance_id: The instance id of the regional restorable - account. - :vartype regional_database_account_instance_id: str - :ivar creation_time: The creation time of the regional restorable database account (ISO-8601 - format). - :vartype creation_time: str - :ivar deletion_time: The time at which the regional restorable database account has been - deleted (ISO-8601 format). - :vartype deletion_time: str - """ - - locationName: str - """The location of the regional restorable account.""" - regionalDatabaseAccountInstanceId: str - """The instance id of the regional restorable account.""" - creationTime: str - """The creation time of the regional restorable database account (ISO-8601 format).""" - deletionTime: str - """The time at which the regional restorable database account has been deleted (ISO-8601 format).""" - - -class RestorableMongodbCollectionGetResult(TypedDict, total=False): - """An Azure Cosmos DB MongoDB collection event. - - :ivar properties: The properties of a MongoDB collection event. - :vartype properties: "RestorableMongodbCollectionProperties" - :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 - """ - - properties: "RestorableMongodbCollectionProperties" - """The properties of a MongoDB collection event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - - -class RestorableMongodbCollectionProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB MongoDB collection event. - - :ivar resource: The resource of an Azure Cosmos DB MongoDB collection event. - :vartype resource: "RestorableMongodbCollectionPropertiesResource" - """ - - resource: "RestorableMongodbCollectionPropertiesResource" - """The resource of an Azure Cosmos DB MongoDB collection event.""" - - -class RestorableMongodbCollectionPropertiesResource(TypedDict, total=False): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB collection event. - - :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: Union[str, "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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this collection event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this collection to identify if this container is restorable in same account.""" - canUndeleteReason: str - """The reason why this collection can not be restored in same account.""" - eventTimestamp: str - """The time when this collection event happened.""" - ownerId: str - """The name of this MongoDB collection.""" - ownerResourceId: str - """The resource ID of this MongoDB collection.""" - - -class RestorableMongodbDatabaseGetResult(TypedDict, total=False): - """An Azure Cosmos DB MongoDB database event. - - :ivar properties: The properties of a MongoDB database event. - :vartype properties: "RestorableMongodbDatabaseProperties" - :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: "ManagedServiceIdentity" + :ivar properties: Properties to redistribute throughput parameters object. Required. + :vartype properties: "RedistributeThroughputProperties" """ - properties: "RestorableMongodbDatabaseProperties" - """The properties of a MongoDB database event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" + properties: Required["RedistributeThroughputProperties"] + """Properties to redistribute throughput parameters object. Required.""" -class RestorableMongodbDatabaseProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB MongoDB database event. +class RedistributeThroughputProperties(TypedDict, total=False): + """Properties to redistribute throughput for Azure Cosmos DB resource. - :ivar resource: The resource of an Azure Cosmos DB MongoDB database event. - :vartype resource: "RestorableMongodbDatabasePropertiesResource" + :ivar resource: The standard JSON format of a resource throughput. Required. + :vartype resource: "RedistributeThroughputPropertiesResource" """ - resource: "RestorableMongodbDatabasePropertiesResource" - """The resource of an Azure Cosmos DB MongoDB database event.""" - - -class RestorableMongodbDatabasePropertiesResource(TypedDict, total=False): # pylint: disable=name-too-long - """The resource of an Azure Cosmos DB MongoDB database event. + resource: Required["RedistributeThroughputPropertiesResource"] + """The standard JSON format of a resource throughput. Required.""" - :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", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: Union[str, "OperationType"] - :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 database can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this database event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this MongoDB database. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of this MongoDB database. - :vartype owner_resource_id: str - """ - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this database event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this database to identify if this database is restorable in same account.""" - canUndeleteReason: str - """The reason why this database can not be restored in same account.""" - eventTimestamp: str - """The time when this database event happened.""" - ownerId: str - """The name of this MongoDB database.""" - ownerResourceId: str - """The resource ID of this MongoDB database.""" - - -class RestorableMongodbResourcesGetResult(TypedDict, total=False): - """Specific Databases to restore. +class RedistributeThroughputPropertiesResource(TypedDict, total=False): + """Resource to redistribute throughput for Azure Cosmos DB resource. - :ivar id: The unique resource identifier of the ARM resource. - :vartype id: str - :ivar name: The name of the ARM resource. - :vartype name: str - :ivar type: The type of Azure resource. - :vartype type: str - :ivar 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 throughputPolicy: ThroughputPolicy to apply for throughput redistribution. Required. + Known values are: "none", "equal", and "custom". + :vartype throughputPolicy: Union[str, "ThroughputPolicyType"] + :ivar targetPhysicalPartitionThroughputInfo: Array of PhysicalPartitionThroughputInfoResource + objects. Required. + :vartype targetPhysicalPartitionThroughputInfo: list["PhysicalPartitionThroughputInfoResource"] + :ivar sourcePhysicalPartitionThroughputInfo: Array of PhysicalPartitionThroughputInfoResource + objects. Required. + :vartype sourcePhysicalPartitionThroughputInfo: list["PhysicalPartitionThroughputInfoResource"] """ - id: str - """The unique resource identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - databaseName: str - """The name of the database available for restore.""" - collectionNames: list[str] - """The names of the collections available for restore.""" - + throughputPolicy: Required[Union[str, "ThroughputPolicyType"]] + """ThroughputPolicy to apply for throughput redistribution. Required. Known values are: \"none\", + \"equal\", and \"custom\".""" + targetPhysicalPartitionThroughputInfo: Required[list["PhysicalPartitionThroughputInfoResource"]] + """Array of PhysicalPartitionThroughputInfoResource objects. Required.""" + sourcePhysicalPartitionThroughputInfo: Required[list["PhysicalPartitionThroughputInfoResource"]] + """Array of PhysicalPartitionThroughputInfoResource objects. Required.""" -class RestorableSqlContainerGetResult(TypedDict, total=False): - """An Azure Cosmos DB SQL container event. - :ivar properties: The properties of a SQL container event. - :vartype properties: "RestorableSqlContainerProperties" - :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 +class RegionForOnlineOffline(TypedDict, total=False): + """Cosmos DB region to online or offline. + + :ivar region: Cosmos DB region, with spaces between words and each word capitalized. Required. + :vartype region: str """ - properties: "RestorableSqlContainerProperties" - """The properties of a SQL container event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" + region: Required[str] + """Cosmos DB region, with spaces between words and each word capitalized. Required.""" -class RestorableSqlContainerProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB SQL container event. +class RestoreParametersBase(TypedDict, total=False): + """Parameters to indicate the information about the restore. - :ivar resource: The resource of an Azure Cosmos DB SQL container event. - :vartype resource: "RestorableSqlContainerPropertiesResource" + :ivar restoreSource: 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}. + :vartype restoreSource: str + :ivar restoreTimestampInUtc: Time to which the account has to be restored (ISO-8601 format). + :vartype restoreTimestampInUtc: str + :ivar restoreWithTtlDisabled: Specifies whether the restored account will have Time-To-Live + disabled upon the successful restore. + :vartype restoreWithTtlDisabled: bool """ - resource: "RestorableSqlContainerPropertiesResource" - """The resource of an Azure Cosmos DB SQL container event.""" + restoreSource: str + """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}.""" + restoreTimestampInUtc: str + """Time to which the account has to be restored (ISO-8601 format).""" + restoreWithTtlDisabled: bool + """Specifies whether the restored account will have Time-To-Live disabled upon the successful + restore.""" -class RestorableSqlContainerPropertiesResource(TypedDict, total=False): - """The resource of an Azure Cosmos DB SQL container event. +class ResourceRestoreParameters(RestoreParametersBase): + """Parameters to indicate the information about the restore. - :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", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: Union[str, "OperationType"] - :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 container can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The when this container event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of this SQL container. - :vartype owner_id: str - :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: "RestorableSqlContainerPropertiesResourceContainer" + :ivar restoreSource: 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}. + :vartype restoreSource: str + :ivar restoreTimestampInUtc: Time to which the account has to be restored (ISO-8601 format). + :vartype restoreTimestampInUtc: str + :ivar restoreWithTtlDisabled: Specifies whether the restored account will have Time-To-Live + disabled upon the successful restore. + :vartype restoreWithTtlDisabled: bool """ - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this container event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this container to identify if this container is restorable in same account.""" - canUndeleteReason: str - """The reason why this container can not be restored in same account.""" - eventTimestamp: str - """The when this container event happened.""" - ownerId: str - """The name of this SQL container.""" - ownerResourceId: str - """The resource ID of this SQL container.""" - container: "RestorableSqlContainerPropertiesResourceContainer" - """Cosmos DB SQL container resource object.""" - class SqlContainerResource(TypedDict, total=False): """Cosmos DB SQL container resource object. :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 + :ivar indexingPolicy: The configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. - :vartype indexing_policy: "IndexingPolicy" - :ivar partition_key: The configuration of the partition key to be used for partitioning data + :vartype indexingPolicy: "IndexingPolicy" + :ivar partitionKey: The configuration of the partition key to be used for partitioning data into multiple partitions. - :vartype partition_key: "ContainerPartitionKey" - :ivar default_ttl: Default time to live. - :vartype default_ttl: int - :ivar unique_key_policy: The unique key policy configuration for specifying uniqueness + :vartype partitionKey: "ContainerPartitionKey" + :ivar defaultTtl: Default time to live. + :vartype defaultTtl: int + :ivar uniqueKeyPolicy: The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - :vartype unique_key_policy: "UniqueKeyPolicy" - :ivar conflict_resolution_policy: The conflict resolution policy for the container. - :vartype conflict_resolution_policy: "ConflictResolutionPolicy" - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: "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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + :vartype uniqueKeyPolicy: "UniqueKeyPolicy" + :ivar conflictResolutionPolicy: The conflict resolution policy for the container. + :vartype conflictResolutionPolicy: "ConflictResolutionPolicy" + :ivar clientEncryptionPolicy: The client encryption policy for the container. + :vartype clientEncryptionPolicy: "ClientEncryptionPolicy" + :ivar analyticalStorageTtl: Analytical TTL. + :vartype analyticalStorageTtl: int + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list["ComputedProperty"] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: "VectorEmbeddingPolicy" - :ivar full_text_policy: The FullText policy for the container. - :vartype full_text_policy: "FullTextPolicy" + :vartype createMode: Union[str, "CreateMode"] + :ivar materializedViewDefinition: The configuration for defining Materialized Views. This must + be specified only for creating a Materialized View container. + :vartype materializedViewDefinition: "MaterializedViewDefinition" + :ivar materializedViews: Materialized Views defined on the container. + :vartype materializedViews: list["MaterializedViewDetails"] + :ivar materializedViewsProperties: Materialized Views Properties defined for source container. + :vartype materializedViewsProperties: "MaterializedViewsProperties" + :ivar computedProperties: List of computed properties. + :vartype computedProperties: list["ComputedProperty"] + :ivar vectorEmbeddingPolicy: The vector embedding policy for the container. + :vartype vectorEmbeddingPolicy: "VectorEmbeddingPolicy" + :ivar fullTextPolicy: The FullText policy for the container. + :vartype fullTextPolicy: "FullTextPolicy" + :ivar dataMaskingPolicy: The Data Masking policy for the container. + :vartype dataMaskingPolicy: "DataMaskingPolicy" """ id: Required[str] @@ -5982,144 +4841,21 @@ class SqlContainerResource(TypedDict, total=False): """Parameters to indicate the information about the restore.""" createMode: Union[str, "CreateMode"] """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" + materializedViewDefinition: "MaterializedViewDefinition" + """The configuration for defining Materialized Views. This must be specified only for creating a + Materialized View container.""" + materializedViews: list["MaterializedViewDetails"] + """Materialized Views defined on the container.""" + materializedViewsProperties: "MaterializedViewsProperties" + """Materialized Views Properties defined for source container.""" computedProperties: list["ComputedProperty"] """List of computed properties.""" vectorEmbeddingPolicy: "VectorEmbeddingPolicy" """The vector embedding policy for the container.""" fullTextPolicy: "FullTextPolicy" """The FullText policy for the container.""" - - -class RestorableSqlContainerPropertiesResourceContainer(SqlContainerResource): # pylint: disable=name-too-long - """Cosmos DB SQL container resource object. - - :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: "IndexingPolicy" - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: "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: "UniqueKeyPolicy" - :ivar conflict_resolution_policy: The conflict resolution policy for the container. - :vartype conflict_resolution_policy: "ConflictResolutionPolicy" - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: "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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list["ComputedProperty"] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: "VectorEmbeddingPolicy" - :ivar full_text_policy: The FullText policy for the container. - :vartype full_text_policy: "FullTextPolicy" - :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 self_property: A system generated property that specifies the addressable path of the - container resource. - :vartype self_property: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - _self: str - """A system generated property that specifies the addressable path of the container resource.""" - - -class RestorableSqlDatabaseGetResult(TypedDict, total=False): - """An Azure Cosmos DB SQL database event. - - :ivar properties: The properties of a SQL database event. - :vartype properties: "RestorableSqlDatabaseProperties" - :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 - """ - - properties: "RestorableSqlDatabaseProperties" - """The properties of a SQL database event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - - -class RestorableSqlDatabaseProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB SQL database event. - - :ivar resource: The resource of an Azure Cosmos DB SQL database event. - :vartype resource: "RestorableSqlDatabasePropertiesResource" - """ - - resource: "RestorableSqlDatabasePropertiesResource" - """The resource of an Azure Cosmos DB SQL database event.""" - - -class RestorableSqlDatabasePropertiesResource(TypedDict, total=False): - """The resource of an Azure Cosmos DB SQL database event. - - :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", - "Replace", "Delete", "Recreate", and "SystemOperation". - :vartype operation_type: Union[str, "OperationType"] - :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 database can not be restored in same account. - :vartype can_undelete_reason: str - :ivar event_timestamp: The time when this database event happened. - :vartype event_timestamp: str - :ivar owner_id: The name of the SQL database. - :vartype owner_id: str - :ivar owner_resource_id: The resource ID of the SQL database. - :vartype owner_resource_id: str - :ivar database: Cosmos DB SQL database resource object. - :vartype database: "RestorableSqlDatabasePropertiesResourceDatabase" - """ - - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this database event. Known values are: \"Create\", \"Replace\", - \"Delete\", \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this database to identify if this database is restorable in same account.""" - canUndeleteReason: str - """The reason why this database can not be restored in same account.""" - eventTimestamp: str - """The time when this database event happened.""" - ownerId: str - """The name of the SQL database.""" - ownerResourceId: str - """The resource ID of the SQL database.""" - database: "RestorableSqlDatabasePropertiesResourceDatabase" - """Cosmos DB SQL database resource object.""" + dataMaskingPolicy: "DataMaskingPolicy" + """The Data Masking policy for the container.""" class SqlDatabaseResource(TypedDict, total=False): @@ -6127,11 +4863,11 @@ class SqlDatabaseResource(TypedDict, total=False): :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] + :vartype createMode: Union[str, "CreateMode"] """ id: Required[str] @@ -6142,201 +4878,90 @@ class SqlDatabaseResource(TypedDict, total=False): """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" -class RestorableSqlDatabasePropertiesResourceDatabase(SqlDatabaseResource): # pylint: disable=name-too-long - """Cosmos DB SQL database resource object. - - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - _colls: str - """A system generated property that specified the addressable path of the collections resource.""" - _users: str - """A system generated property that specifies the addressable path of the users resource.""" - _self: str - """A system generated property that specifies the addressable path of the database resource.""" - - -class RestorableSqlResourcesGetResult(TypedDict, total=False): - """Specific Databases to restore. +class RestoreParameters(RestoreParametersBase): + """Parameters to indicate the information about the restore. - :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] + :ivar restoreWithTtlDisabled: Specifies whether the restored account will have Time-To-Live + disabled upon the successful restore. + :vartype restoreWithTtlDisabled: bool + :ivar restoreMode: Describes the mode of the restore. "PointInTime" + :vartype restoreMode: Union[str, "RestoreMode"] + :ivar restoreSource: 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}. + :vartype restoreSource: str + :ivar restoreTimestampInUtc: Time to which the account has to be restored (ISO-8601 format). + :vartype restoreTimestampInUtc: str + :ivar databasesToRestore: List of specific databases available for restore. + :vartype databasesToRestore: list["DatabaseRestoreResource"] + :ivar gremlinDatabasesToRestore: List of specific gremlin databases available for restore. + :vartype gremlinDatabasesToRestore: list["GremlinDatabaseRestoreResource"] + :ivar tablesToRestore: List of specific tables available for restore. + :vartype tablesToRestore: list[str] + :ivar sourceBackupLocation: The source backup location for restore. + :vartype sourceBackupLocation: str """ - id: str - """The unique resource identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - databaseName: str - """The name of the database available for restore.""" - collectionNames: list[str] - """The names of the collections available for restore.""" + restoreMode: Union[str, "RestoreMode"] + """Describes the mode of the restore. \"PointInTime\"""" + databasesToRestore: list["DatabaseRestoreResource"] + """List of specific databases available for restore.""" + gremlinDatabasesToRestore: list["GremlinDatabaseRestoreResource"] + """List of specific gremlin databases available for restore.""" + tablesToRestore: list[str] + """List of specific tables available for restore.""" + sourceBackupLocation: str + """The source backup location for restore.""" -class RestorableTableGetResult(TypedDict, total=False): - """An Azure Cosmos DB Table event. +class RetrieveThroughputParameters(ARMResourceProperties): + """Cosmos DB retrieve throughput parameters object. - :ivar properties: The properties of a Table event. - :vartype properties: "RestorableTableProperties" - :ivar id: The unique resource Identifier of the ARM resource. + :ivar id: The unique resource identifier of the ARM resource. :vartype id: str :ivar name: The name of the ARM resource. :vartype name: str :ivar type: The type of Azure resource. :vartype type: str + :ivar 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: "ManagedServiceIdentity" + :ivar properties: Properties to retrieve throughput parameters object. Required. + :vartype properties: "RetrieveThroughputProperties" """ - properties: "RestorableTableProperties" - """The properties of a Table event.""" - id: str - """The unique resource Identifier of the ARM resource.""" - name: str - """The name of the ARM resource.""" - type: str - """The type of Azure resource.""" - - -class RestorableTableProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB Table event. - - :ivar resource: The resource of an Azure Cosmos DB Table event. - :vartype resource: "RestorableTablePropertiesResource" - """ - - resource: "RestorableTablePropertiesResource" - """The resource of an Azure Cosmos DB Table event.""" - - -class RestorableTablePropertiesResource(TypedDict, total=False): - """The resource of an Azure Cosmos DB Table event. + properties: Required["RetrieveThroughputProperties"] + """Properties to retrieve throughput parameters object. Required.""" - :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: Union[str, "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 - """ - _rid: str - """A system generated property. A unique identifier.""" - operationType: Union[str, "OperationType"] - """The operation type of this table event. Known values are: \"Create\", \"Replace\", \"Delete\", - \"Recreate\", and \"SystemOperation\".""" - canUndelete: str - """A state of this table to identify if this table is restorable in same account.""" - canUndeleteReason: str - """The reason why this table can not be restored in same account.""" - eventTimestamp: str - """The time when this table event happened.""" - ownerId: str - """The name of this Table.""" - ownerResourceId: str - """The resource ID of this Table.""" - - -class RestorableTableResourcesGetResult(TypedDict, total=False): - """Specific Databases to restore. +class RetrieveThroughputProperties(TypedDict, total=False): + """Properties to retrieve throughput for Azure Cosmos DB resource. - :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 + :ivar resource: The standard JSON format of a resource throughput. Required. + :vartype resource: "RetrieveThroughputPropertiesResource" """ - id: str - """The unique resource identifier of the ARM resource.""" - name: str - """The name of the Table.""" - type: str - """The type of Azure resource.""" + resource: Required["RetrieveThroughputPropertiesResource"] + """The standard JSON format of a resource throughput. Required.""" -class RestoreParameters(RestoreParametersBase): - """Parameters to indicate the information about the restore. +class RetrieveThroughputPropertiesResource(TypedDict, total=False): + """Resource to retrieve throughput information for Cosmos DB resource. - :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: Union[str, "RestoreMode"] - :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}. - :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: str - :ivar databases_to_restore: List of specific databases available for restore. - :vartype databases_to_restore: list["DatabaseRestoreResource"] - :ivar gremlin_databases_to_restore: List of specific gremlin databases available for restore. - :vartype gremlin_databases_to_restore: list["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 + :ivar physicalPartitionIds: Array of PhysicalPartitionId objects. Required. + :vartype physicalPartitionIds: list["PhysicalPartitionId"] """ - restoreMode: Union[str, "RestoreMode"] - """Describes the mode of the restore. \"PointInTime\"""" - databasesToRestore: list["DatabaseRestoreResource"] - """List of specific databases available for restore.""" - gremlinDatabasesToRestore: list["GremlinDatabaseRestoreResource"] - """List of specific gremlin databases available for restore.""" - tablesToRestore: list[str] - """List of specific tables available for restore.""" - sourceBackupLocation: str - """The source backup location for restore.""" + physicalPartitionIds: Required[list["PhysicalPartitionId"]] + """Array of PhysicalPartitionId objects. Required.""" class Role(TypedDict, total=False): @@ -6357,36 +4982,14 @@ class Role(TypedDict, total=False): class SeedNode(TypedDict, total=False): """SeedNode. - :ivar ip_address: IP address of this seed node. - :vartype ip_address: str + :ivar ipAddress: IP address of this seed node. + :vartype ipAddress: str """ ipAddress: str """IP address of this seed node.""" -class ServiceResource(ProxyResource): - """Properties for the database account. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Services response resource. - :vartype properties: "ServiceResourceProperties" - """ - - properties: "ServiceResourceProperties" - """Services response resource.""" - - class ServiceResourceCreateUpdateParameters(TypedDict, total=False): """Parameters for Create or Update request for ServiceResource. @@ -6398,185 +5001,87 @@ class ServiceResourceCreateUpdateParameters(TypedDict, total=False): """Properties in ServiceResourceCreateUpdateParameters.""" -class SpatialSpec(TypedDict, total=False): - """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[Union[str, "SpatialType"]] - """ - - path: str - """The path for which the indexing behavior applies to. Index paths typically start with root and - end with wildcard (/path/*).""" - types: list[Union[str, "SpatialType"]] - """List of path's spatial type.""" - - -class SqlContainerCreateUpdateParameters(ARMResourceProperties): - """Parameters to create and update Cosmos DB container. - - :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: "ManagedServiceIdentity" - :ivar properties: Properties to create and update Azure Cosmos DB container. Required. - :vartype properties: "SqlContainerCreateUpdateProperties" - """ - - properties: Required["SqlContainerCreateUpdateProperties"] - """Properties to create and update Azure Cosmos DB container. Required.""" - - -class SqlContainerCreateUpdateProperties(TypedDict, total=False): - """Properties to create and update Azure Cosmos DB container. - - :ivar resource: The standard JSON format of a container. Required. - :vartype resource: "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: "CreateUpdateOptions" - """ - - resource: Required["SqlContainerResource"] - """The standard JSON format of a container. Required.""" - options: "CreateUpdateOptions" - """A key-value pair of options to be applied for the request. This corresponds to the headers sent - with the request.""" - - -class SqlContainerGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB container. +class SoftDeleteConfiguration(TypedDict, total=False): + """Configuration for soft delete on the Cosmos DB account. - :ivar resource: - :vartype resource: "SqlContainerGetPropertiesResource" - :ivar options: - :vartype options: "SqlContainerGetPropertiesOptions" + :ivar softDeletionEnabled: Flag to indicate whether soft delete is enabled on the account. + :vartype softDeletionEnabled: bool + :ivar minMinutesBeforePermanentDeletionAllowed: Minimum number of minutes before a soft deleted + resource can be permanently deleted. + :vartype minMinutesBeforePermanentDeletionAllowed: int + :ivar softDeleteRetentionPeriodInMinutes: Soft delete retention period in minutes for + resources. + :vartype softDeleteRetentionPeriodInMinutes: int """ - resource: "SqlContainerGetPropertiesResource" - options: "SqlContainerGetPropertiesOptions" - - -class SqlContainerGetPropertiesOptions(OptionsResource): - """SqlContainerGetPropertiesOptions. + softDeletionEnabled: bool + """Flag to indicate whether soft delete is enabled on the account.""" + minMinutesBeforePermanentDeletionAllowed: int + """Minimum number of minutes before a soft deleted resource can be permanently deleted.""" + softDeleteRetentionPeriodInMinutes: int + """Soft delete retention period in minutes for resources.""" - :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: "AutoscaleSettings" - """ +class SpatialSpec(TypedDict, total=False): + """SpatialSpec. -class SqlContainerGetPropertiesResource(SqlContainerResource): - """SqlContainerGetPropertiesResource. - - :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: "IndexingPolicy" - :ivar partition_key: The configuration of the partition key to be used for partitioning data - into multiple partitions. - :vartype partition_key: "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: "UniqueKeyPolicy" - :ivar conflict_resolution_policy: The conflict resolution policy for the container. - :vartype conflict_resolution_policy: "ConflictResolutionPolicy" - :ivar client_encryption_policy: The client encryption policy for the container. - :vartype client_encryption_policy: "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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :ivar computed_properties: List of computed properties. - :vartype computed_properties: list["ComputedProperty"] - :ivar vector_embedding_policy: The vector embedding policy for the container. - :vartype vector_embedding_policy: "VectorEmbeddingPolicy" - :ivar full_text_policy: The FullText policy for the container. - :vartype full_text_policy: "FullTextPolicy" - :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 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[Union[str, "SpatialType"]] """ - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" + path: str + """The path for which the indexing behavior applies to. Index paths typically start with root and + end with wildcard (/path/*).""" + types: list[Union[str, "SpatialType"]] + """List of path's spatial type.""" -class SqlContainerGetResults(ProxyResource): - """An Azure Cosmos DB container. +class SqlContainerCreateUpdateParameters(ARMResourceProperties): + """Parameters to create and update Cosmos DB container. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB container. - :vartype properties: "SqlContainerGetProperties" :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\\". + 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: "ManagedServiceIdentity" + :ivar properties: Properties to create and update Azure Cosmos DB container. Required. + :vartype properties: "SqlContainerCreateUpdateProperties" """ - properties: "SqlContainerGetProperties" - """The properties of an Azure Cosmos DB container.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" + properties: Required["SqlContainerCreateUpdateProperties"] + """Properties to create and update Azure Cosmos DB container. Required.""" + + +class SqlContainerCreateUpdateProperties(TypedDict, total=False): + """Properties to create and update Azure Cosmos DB container. + + :ivar resource: The standard JSON format of a container. Required. + :vartype resource: "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: "CreateUpdateOptions" + """ + + resource: Required["SqlContainerResource"] + """The standard JSON format of a container. Required.""" + options: "CreateUpdateOptions" + """A key-value pair of options to be applied for the request. This corresponds to the headers sent + with the request.""" class SqlDatabaseCreateUpdateParameters(ARMResourceProperties): @@ -6624,198 +5129,29 @@ class SqlDatabaseCreateUpdateProperties(TypedDict, total=False): with the request.""" -class SqlDatabaseGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB SQL database. - - :ivar resource: - :vartype resource: "SqlDatabaseGetPropertiesResource" - :ivar options: - :vartype options: "SqlDatabaseGetPropertiesOptions" - """ - - resource: "SqlDatabaseGetPropertiesResource" - options: "SqlDatabaseGetPropertiesOptions" - - -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: "AutoscaleSettings" - """ - - -class SqlDatabaseGetPropertiesResource(SqlDatabaseResource): - """SqlDatabaseGetPropertiesResource. - - :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: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - _colls: str - """A system generated property that specified the addressable path of the collections resource.""" - _users: str - """A system generated property that specifies the addressable path of the users resource.""" - - -class SqlDatabaseGetResults(ProxyResource): - """An Azure Cosmos DB SQL database. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB SQL database. - :vartype properties: "SqlDatabaseGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "SqlDatabaseGetProperties" - """The properties of an Azure Cosmos DB SQL database.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - -class SqlDedicatedGatewayRegionalServiceResource(RegionalServiceResource): # pylint: disable=name-too-long - """Resource for a regional service location. - - :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: Union[str, "ServiceStatus"] - :ivar sql_dedicated_gateway_endpoint: The regional endpoint for SqlDedicatedGateway. - :vartype sql_dedicated_gateway_endpoint: str - """ - - sqlDedicatedGatewayEndpoint: str - """The regional endpoint for SqlDedicatedGateway.""" - - class SqlDedicatedGatewayServiceResourceCreateUpdateProperties(TypedDict, total=False): # pylint: disable=name-too-long """Properties for Create or Update request for SqlDedicatedGatewayServiceResource. - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", - "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar dedicated_gateway_type: DedicatedGatewayType for the service. Known values are: - "IntegratedCache" and "DistributedQuery". - :vartype dedicated_gateway_type: Union[str, "DedicatedGatewayType"] - :ivar service_type: ServiceType for the service. Required. SQL_DEDICATED_GATEWAY. - :vartype service_type: Literal[ServiceType.SQL_DEDICATED_GATEWAY] - """ - - instanceSize: Union[str, "ServiceSize"] - """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and - \"Cosmos.D16s\".""" - instanceCount: int - """Instance count for the service.""" - dedicatedGatewayType: Union[str, "DedicatedGatewayType"] - """DedicatedGatewayType for the service. Known values are: \"IntegratedCache\" and - \"DistributedQuery\".""" - serviceType: Required[Literal[ServiceType.SQL_DEDICATED_GATEWAY]] - """ServiceType for the service. Required. SQL_DEDICATED_GATEWAY.""" - - -class SqlDedicatedGatewayServiceResourceProperties(TypedDict, total=False): # pylint: disable=name-too-long - """Properties for SqlDedicatedGatewayServiceResource. - - :ivar creation_time: Time of the last state change (ISO-8601 format). - :vartype creation_time: str - :ivar instance_size: Instance type for the service. Known values are: "Cosmos.D4s", + :ivar instanceSize: Instance type for the service. Known values are: "Cosmos.D4s", "Cosmos.D8s", and "Cosmos.D16s". - :vartype instance_size: Union[str, "ServiceSize"] - :ivar instance_count: Instance count for the service. - :vartype instance_count: int - :ivar status: Describes the status of a service. Known values are: "Creating", "Running", - "Updating", "Deleting", "Error", and "Stopped". - :vartype status: Union[str, "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: + :vartype instanceSize: Union[str, "ServiceSize"] + :ivar instanceCount: Instance count for the service. + :vartype instanceCount: int + :ivar dedicatedGatewayType: DedicatedGatewayType for the service. Known values are: "IntegratedCache" and "DistributedQuery". - :vartype dedicated_gateway_type: Union[str, "DedicatedGatewayType"] - :ivar locations: An array that contains all of the locations for the service. - :vartype locations: list["SqlDedicatedGatewayRegionalServiceResource"] - :ivar service_type: ServiceType for the service. Required. SQL_DEDICATED_GATEWAY. - :vartype service_type: Literal[ServiceType.SQL_DEDICATED_GATEWAY] + :vartype dedicatedGatewayType: Union[str, "DedicatedGatewayType"] + :ivar serviceType: ServiceType for the service. Required. SQL_DEDICATED_GATEWAY. + :vartype serviceType: Literal[ServiceType.SQL_DEDICATED_GATEWAY] """ - creationTime: str - """Time of the last state change (ISO-8601 format).""" instanceSize: Union[str, "ServiceSize"] """Instance type for the service. Known values are: \"Cosmos.D4s\", \"Cosmos.D8s\", and \"Cosmos.D16s\".""" instanceCount: int """Instance count for the service.""" - status: Union[str, "ServiceStatus"] - """Describes the status of a service. Known values are: \"Creating\", \"Running\", \"Updating\", - \"Deleting\", \"Error\", and \"Stopped\".""" - sqlDedicatedGatewayEndpoint: str - """SqlDedicatedGateway endpoint for the service.""" dedicatedGatewayType: Union[str, "DedicatedGatewayType"] """DedicatedGatewayType for the service. Known values are: \"IntegratedCache\" and \"DistributedQuery\".""" - locations: list["SqlDedicatedGatewayRegionalServiceResource"] - """An array that contains all of the locations for the service.""" serviceType: Required[Literal[ServiceType.SQL_DEDICATED_GATEWAY]] """ServiceType for the service. Required. SQL_DEDICATED_GATEWAY.""" @@ -6831,40 +5167,18 @@ class SqlRoleAssignmentCreateUpdateParameters(TypedDict, total=False): """Properties to create and update an Azure Cosmos DB SQL Role Assignment.""" -class SqlRoleAssignmentGetResults(ProxyResource): - """An Azure Cosmos DB Role Assignment. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Properties related to the Role Assignment. - :vartype properties: "SqlRoleAssignmentResource" - """ - - properties: "SqlRoleAssignmentResource" - """Properties related to the Role Assignment.""" - - class SqlRoleAssignmentResource(TypedDict, total=False): """Azure Cosmos DB SQL Role Assignment resource object. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str + :ivar roleDefinitionId: The unique identifier for the associated Role Definition. + :vartype roleDefinitionId: 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 + :ivar principalId: 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 + :vartype principalId: str """ roleDefinitionId: str @@ -6888,43 +5202,21 @@ class SqlRoleDefinitionCreateUpdateParameters(TypedDict, total=False): """Properties to create and update an Azure Cosmos DB SQL Role Definition.""" -class SqlRoleDefinitionGetResults(ProxyResource): - """An Azure Cosmos DB SQL Role Definition. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: Properties related to the Role Definition. - :vartype properties: "SqlRoleDefinitionResource" - """ - - properties: "SqlRoleDefinitionResource" - """Properties related to the Role Definition.""" - - class SqlRoleDefinitionResource(TypedDict, total=False): """Azure Cosmos DB SQL Role Definition resource object. - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "RoleDefinitionType"] - :ivar assignable_scopes: A set of fully qualified Scopes at or below which Role Assignments may + :ivar assignableScopes: 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] + :vartype assignableScopes: list[str] :ivar permissions: The set of operations allowed through this Role Definition. :vartype permissions: list["Permission"] """ @@ -6989,16 +5281,6 @@ class SqlStoredProcedureCreateUpdateProperties(TypedDict, total=False): with the request.""" -class SqlStoredProcedureGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB StoredProcedure. - - :ivar resource: - :vartype resource: "SqlStoredProcedureGetPropertiesResource" - """ - - resource: "SqlStoredProcedureGetPropertiesResource" - - class SqlStoredProcedureResource(TypedDict, total=False): """Cosmos DB SQL storedProcedure resource object. @@ -7014,75 +5296,6 @@ class SqlStoredProcedureResource(TypedDict, total=False): """Body of the Stored Procedure.""" -class SqlStoredProcedureGetPropertiesResource(SqlStoredProcedureResource): - """SqlStoredProcedureGetPropertiesResource. - - :ivar id: Name of the Cosmos DB SQL storedProcedure. Required. - :vartype id: str - :ivar body: Body of the Stored Procedure. - :vartype body: str - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class SqlStoredProcedureGetResults(ProxyResource): - """An Azure Cosmos DB storedProcedure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB storedProcedure. - :vartype properties: "SqlStoredProcedureGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "SqlStoredProcedureGetProperties" - """The properties of an Azure Cosmos DB storedProcedure.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class SqlTriggerCreateUpdateParameters(ARMResourceProperties): """Parameters to create and update Cosmos DB trigger. @@ -7128,113 +5341,29 @@ class SqlTriggerCreateUpdateProperties(TypedDict, total=False): with the request.""" -class SqlTriggerGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB trigger. - - :ivar resource: - :vartype resource: "SqlTriggerGetPropertiesResource" - """ - - resource: "SqlTriggerGetPropertiesResource" - - class SqlTriggerResource(TypedDict, total=False): """Cosmos DB SQL trigger resource object. - :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: Union[str, "TriggerType"] - :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", - "Create", "Update", "Delete", and "Replace". - :vartype trigger_operation: Union[str, "TriggerOperation"] - """ - - id: Required[str] - """Name of the Cosmos DB SQL trigger. Required.""" - body: str - """Body of the Trigger.""" - triggerType: Union[str, "TriggerType"] - """Type of the Trigger. Known values are: \"Pre\" and \"Post\".""" - triggerOperation: Union[str, "TriggerOperation"] - """The operation the trigger is associated with. Known values are: \"All\", \"Create\", - \"Update\", \"Delete\", and \"Replace\".""" - - -class SqlTriggerGetPropertiesResource(SqlTriggerResource): - """SqlTriggerGetPropertiesResource. - - :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: Union[str, "TriggerType"] - :ivar trigger_operation: The operation the trigger is associated with. Known values are: "All", - "Create", "Update", "Delete", and "Replace". - :vartype trigger_operation: Union[str, "TriggerOperation"] - :ivar rid: A system generated property. A unique identifier. - :vartype rid: str - :ivar ts: A system generated property that denotes the last updated timestamp of the resource. - :vartype ts: float - :ivar etag: A system generated property representing the resource etag required for optimistic - concurrency control. - :vartype etag: str - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class SqlTriggerGetResults(ProxyResource): - """An Azure Cosmos DB trigger. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Name of the Cosmos DB SQL trigger. Required. :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: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB trigger. - :vartype properties: "SqlTriggerGetProperties" - :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: "ManagedServiceIdentity" + :ivar body: Body of the Trigger. + :vartype body: str + :ivar triggerType: Type of the Trigger. Known values are: "Pre" and "Post". + :vartype triggerType: Union[str, "TriggerType"] + :ivar triggerOperation: The operation the trigger is associated with. Known values are: "All", + "Create", "Update", "Delete", and "Replace". + :vartype triggerOperation: Union[str, "TriggerOperation"] """ - properties: "SqlTriggerGetProperties" - """The properties of an Azure Cosmos DB trigger.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" + id: Required[str] + """Name of the Cosmos DB SQL trigger. Required.""" + body: str + """Body of the Trigger.""" + triggerType: Union[str, "TriggerType"] + """Type of the Trigger. Known values are: \"Pre\" and \"Post\".""" + triggerOperation: Union[str, "TriggerOperation"] + """The operation the trigger is associated with. Known values are: \"All\", \"Create\", + \"Update\", \"Delete\", and \"Replace\".""" class SqlUserDefinedFunctionCreateUpdateParameters(ARMResourceProperties): # pylint: disable=name-too-long @@ -7283,16 +5412,6 @@ class SqlUserDefinedFunctionCreateUpdateProperties(TypedDict, total=False): # p with the request.""" -class SqlUserDefinedFunctionGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB userDefinedFunction. - - :ivar resource: - :vartype resource: "SqlUserDefinedFunctionGetPropertiesResource" - """ - - resource: "SqlUserDefinedFunctionGetPropertiesResource" - - class SqlUserDefinedFunctionResource(TypedDict, total=False): """Cosmos DB SQL userDefinedFunction resource object. @@ -7308,92 +5427,23 @@ class SqlUserDefinedFunctionResource(TypedDict, total=False): """Body of the User Defined Function.""" -class SqlUserDefinedFunctionGetPropertiesResource(SqlUserDefinedFunctionResource): # pylint: disable=name-too-long - """SqlUserDefinedFunctionGetPropertiesResource. - - :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 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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class SqlUserDefinedFunctionGetResults(ProxyResource): - """An Azure Cosmos DB userDefinedFunction. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB userDefinedFunction. - :vartype properties: "SqlUserDefinedFunctionGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "SqlUserDefinedFunctionGetProperties" - """The properties of an Azure Cosmos DB userDefinedFunction.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class SystemData(TypedDict, total=False): """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: Union[str, "CreatedByType"] - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: str - :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 + :ivar createdBy: The identity that created the resource. + :vartype createdBy: str + :ivar createdByType: The type of identity that created the resource. Known values are: "User", + "Application", "ManagedIdentity", and "Key". + :vartype createdByType: Union[str, "CreatedByType"] + :ivar createdAt: The timestamp of resource creation (UTC). + :vartype createdAt: str + :ivar lastModifiedBy: The identity that last modified the resource. + :vartype lastModifiedBy: str + :ivar lastModifiedByType: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: Union[str, "CreatedByType"] - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: str + :vartype lastModifiedByType: Union[str, "CreatedByType"] + :ivar lastModifiedAt: The timestamp of resource last modification (UTC). + :vartype lastModifiedAt: str """ createdBy: str @@ -7457,40 +5507,16 @@ class TableCreateUpdateProperties(TypedDict, total=False): with the request.""" -class TableGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos Table. - - :ivar resource: - :vartype resource: "TableGetPropertiesResource" - :ivar options: - :vartype options: "TableGetPropertiesOptions" - """ - - resource: "TableGetPropertiesResource" - options: "TableGetPropertiesOptions" - - -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: "AutoscaleSettings" - """ - - class TableResource(TypedDict, total=False): """Cosmos DB table resource object. :ivar id: Name of the Cosmos DB table. Required. :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" + :ivar restoreParameters: Parameters to indicate the information about the restore. + :vartype restoreParameters: "ResourceRestoreParameters" + :ivar createMode: Enum to indicate the mode of account creation. Known values are: "Default" and "Restore". - :vartype create_mode: Union[str, "CreateMode"] + :vartype createMode: Union[str, "CreateMode"] """ id: Required[str] @@ -7501,78 +5527,6 @@ class TableResource(TypedDict, total=False): """Enum to indicate the mode of account creation. Known values are: \"Default\" and \"Restore\".""" -class TableGetPropertiesResource(TableResource): - """TableGetPropertiesResource. - - :ivar id: Name of the Cosmos DB table. Required. - :vartype id: str - :ivar restore_parameters: Parameters to indicate the information about the restore. - :vartype restore_parameters: "ResourceRestoreParameters" - :ivar create_mode: Enum to indicate the mode of account creation. Known values are: "Default" - and "Restore". - :vartype create_mode: Union[str, "CreateMode"] - :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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class TableGetResults(ProxyResource): - """An Azure Cosmos DB Table. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB Table. - :vartype properties: "TableGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "TableGetProperties" - """The properties of an Azure Cosmos DB Table.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" - - class TableRoleAssignmentResource(ProxyResource): """Parameters to create and update an Azure Cosmos DB Table Role Assignment. @@ -7584,9 +5538,9 @@ class TableRoleAssignmentResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Table Role Assignment. :vartype properties: "TableRoleAssignmentResourceProperties" """ @@ -7598,17 +5552,17 @@ class TableRoleAssignmentResource(ProxyResource): class TableRoleAssignmentResourceProperties(TypedDict, total=False): """Azure Cosmos DB Table Role Assignment resource object. - :ivar role_definition_id: The unique identifier for the associated Role Definition. - :vartype role_definition_id: str + :ivar roleDefinitionId: The unique identifier for the associated Role Definition. + :vartype roleDefinitionId: 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 + :ivar principalId: 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 + :vartype principalId: str + :ivar provisioningState: Provisioning state of the resource. + :vartype provisioningState: str """ roleDefinitionId: str @@ -7635,9 +5589,9 @@ class TableRoleDefinitionResource(ProxyResource): :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 + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: "SystemData" + :vartype systemData: "SystemData" :ivar properties: Properties to create and update an Azure Cosmos DB Table Role Definition. :vartype properties: "TableRoleDefinitionResourceProperties" """ @@ -7651,18 +5605,18 @@ class TableRoleDefinitionResourceProperties(TypedDict, total=False): :ivar id: The path id for the Role Definition. :vartype id: str - :ivar role_name: A user-friendly name for the Role Definition. Must be unique for the database + :ivar roleName: A user-friendly name for the Role Definition. Must be unique for the database account. - :vartype role_name: str + :vartype roleName: str :ivar type: Indicates whether the Role Definition was built-in or user created. Known values are: "BuiltInRole" and "CustomRole". :vartype type: Union[str, "RoleDefinitionType"] - :ivar assignable_scopes: A set of fully qualified Scopes at or below which Table Role + :ivar assignableScopes: 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] + :vartype assignableScopes: list[str] :ivar permissions: The set of operations allowed through this Role Definition. :vartype permissions: list["Permission"] """ @@ -7684,14 +5638,34 @@ class TableRoleDefinitionResourceProperties(TypedDict, total=False): """The set of operations allowed through this Role Definition.""" +class ThroughputBucketResource(TypedDict, total=False): + """Cosmos DB throughput bucket object. + + :ivar id: Represents the throughput bucket id. Required. + :vartype id: int + :ivar maxThroughputPercentage: Represents maximum percentage throughput that can be used by the + bucket. Required. + :vartype maxThroughputPercentage: int + :ivar isDefaultBucket: Indicates whether this is the default throughput bucket. + :vartype isDefaultBucket: bool + """ + + id: Required[int] + """Represents the throughput bucket id. Required.""" + maxThroughputPercentage: Required[int] + """Represents maximum percentage throughput that can be used by the bucket. Required.""" + isDefaultBucket: bool + """Indicates whether this is the default throughput bucket.""" + + class ThroughputPolicyResource(TypedDict, total=False): """Cosmos DB resource throughput policy. - :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 + :ivar isEnabled: Determines whether the ThroughputPolicy is active or not. + :vartype isEnabled: bool + :ivar incrementPercent: Represents the percentage by which throughput can increase every time throughput policy kicks in. - :vartype increment_percent: int + :vartype incrementPercent: int """ isEnabled: bool @@ -7701,14 +5675,110 @@ class ThroughputPolicyResource(TypedDict, total=False): in.""" -class ThroughputSettingsGetProperties(TypedDict, total=False): - """The properties of an Azure Cosmos DB resource throughput. +class ThroughputPoolAccountProperties(TypedDict, total=False): + """An Azure Cosmos DB Global Database Account which is part of a Throughputpool. + + :ivar provisioningState: A provisioning state of the ThroughputPool Account. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioningState: Union[str, "Status"] + :ivar accountResourceIdentifier: The resource identifier of global database account in the + throughputPool. + :vartype accountResourceIdentifier: str + :ivar accountLocation: The location of global database account in the throughputPool. + :vartype accountLocation: str + :ivar accountInstanceId: The instance id of global database account in the throughputPool. + :vartype accountInstanceId: str + """ + + provisioningState: Union[str, "Status"] + """A provisioning state of the ThroughputPool Account. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + accountResourceIdentifier: str + """The resource identifier of global database account in the throughputPool.""" + accountLocation: str + """The location of global database account in the throughputPool.""" + accountInstanceId: str + """The instance id of global database account in the throughputPool.""" + + +class ThroughputPoolAccountResource(ProxyResource): + """An Azure Cosmos DB Throughputpool Account. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar properties: An Azure Cosmos DB Global Database Account which is part of a Throughputpool. + :vartype properties: "ThroughputPoolAccountProperties" + """ + + properties: "ThroughputPoolAccountProperties" + """An Azure Cosmos DB Global Database Account which is part of a Throughputpool.""" + + +class ThroughputPoolProperties(TypedDict, total=False): + """Properties to update Azure Cosmos DB throughput pool. + + :ivar provisioningState: A provisioning state of the ThroughputPool. Known values are: + "Uninitialized", "Initializing", "InternallyReady", "Online", "Deleting", "Succeeded", + "Failed", "Canceled", "Updating", and "Creating". + :vartype provisioningState: Union[str, "Status"] + :ivar maxThroughput: Value for throughput to be shared among CosmosDB resources in the pool. + :vartype maxThroughput: int + """ + + provisioningState: Union[str, "Status"] + """A provisioning state of the ThroughputPool. Known values are: \"Uninitialized\", + \"Initializing\", \"InternallyReady\", \"Online\", \"Deleting\", \"Succeeded\", \"Failed\", + \"Canceled\", \"Updating\", and \"Creating\".""" + maxThroughput: int + """Value for throughput to be shared among CosmosDB resources in the pool.""" + + +class ThroughputPoolResource(TrackedResource): + """An Azure Cosmos DB Throughputpool. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar systemData: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype systemData: "SystemData" + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties to update Azure Cosmos DB throughput pool. + :vartype properties: "ThroughputPoolProperties" + """ + + properties: "ThroughputPoolProperties" + """Properties to update Azure Cosmos DB throughput pool.""" + - :ivar resource: - :vartype resource: "ThroughputSettingsGetPropertiesResource" +class ThroughputPoolUpdate(TypedDict, total=False): + """Represents a throughput pool resource for updates. + + :ivar properties: Properties of the throughput pool. + :vartype properties: "ThroughputPoolProperties" """ - resource: "ThroughputSettingsGetPropertiesResource" + properties: "ThroughputPoolProperties" + """Properties of the throughput pool.""" class ThroughputSettingsResource(TypedDict, total=False): @@ -7718,19 +5788,22 @@ class ThroughputSettingsResource(TypedDict, total=False): :ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or autoscaleSettings is required, but not both. :vartype throughput: int - :ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is + :ivar autoscaleSettings: Cosmos DB resource for autoscale settings. Either throughput is required or autoscaleSettings is required, but not both. - :vartype autoscale_settings: "AutoscaleSettingsResource" - :ivar minimum_throughput: The minimum throughput of the resource. - :vartype minimum_throughput: str - :ivar offer_replace_pending: The throughput replace is pending. - :vartype offer_replace_pending: str - :ivar instant_maximum_throughput: The offer throughput value to instantly scale up without + :vartype autoscaleSettings: "AutoscaleSettingsResource" + :ivar minimumThroughput: The minimum throughput of the resource. + :vartype minimumThroughput: str + :ivar offerReplacePending: The throughput replace is pending. + :vartype offerReplacePending: str + :ivar instantMaximumThroughput: The offer throughput value to instantly scale up without triggering splits. - :vartype instant_maximum_throughput: str - :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 + :vartype instantMaximumThroughput: str + :ivar softAllowedMaximumThroughput: The maximum throughput value or the maximum maxThroughput + value (for autoscale) that can be specified. + :vartype softAllowedMaximumThroughput: str + :ivar throughputBuckets: Array of throughput bucket limits to be applied to the Cosmos DB + container. + :vartype throughputBuckets: list["ThroughputBucketResource"] """ throughput: int @@ -7748,87 +5821,8 @@ class ThroughputSettingsResource(TypedDict, total=False): softAllowedMaximumThroughput: str """The maximum throughput value or the maximum maxThroughput value (for autoscale) that can be specified.""" - - -class ThroughputSettingsGetPropertiesResource(ThroughputSettingsResource): - """ThroughputSettingsGetPropertiesResource. - - :ivar throughput: Value of the Cosmos DB resource throughput. Either throughput is required or - autoscaleSettings is required, but not both. - :vartype throughput: int - :ivar autoscale_settings: Cosmos DB resource for autoscale settings. Either throughput is - required or autoscaleSettings is required, but not both. - :vartype autoscale_settings: "AutoscaleSettingsResource" - :ivar minimum_throughput: The minimum throughput of the resource. - :vartype minimum_throughput: str - :ivar offer_replace_pending: The throughput replace is pending. - :vartype offer_replace_pending: str - :ivar instant_maximum_throughput: The offer throughput value to instantly scale up without - triggering splits. - :vartype instant_maximum_throughput: str - :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 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 - """ - - _rid: str - """A system generated property. A unique identifier.""" - _ts: float - """A system generated property that denotes the last updated timestamp of the resource.""" - _etag: str - """A system generated property representing the resource etag required for optimistic concurrency - control.""" - - -class ThroughputSettingsGetResults(ProxyResource): - """An Azure Cosmos DB resource throughput. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: "SystemData" - :ivar properties: The properties of an Azure Cosmos DB resource throughput. - :vartype properties: "ThroughputSettingsGetProperties" - :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: "ManagedServiceIdentity" - """ - - properties: "ThroughputSettingsGetProperties" - """The properties of an Azure Cosmos DB resource throughput.""" - location: str - """The location of the resource group to which the resource belongs.""" - tags: dict[str, str] - """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\\".""" - identity: "ManagedServiceIdentity" - """Identity for the resource.""" + throughputBuckets: list["ThroughputBucketResource"] + """Array of throughput bucket limits to be applied to the Cosmos DB container.""" class ThroughputSettingsUpdateParameters(ARMResourceProperties): @@ -7886,9 +5880,9 @@ class UniqueKeyPolicy(TypedDict, total=False): """The unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. - :ivar unique_keys: List of unique keys on that enforces uniqueness constraint on documents in + :ivar uniqueKeys: List of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - :vartype unique_keys: list["UniqueKey"] + :vartype uniqueKeys: list["UniqueKey"] """ uniqueKeys: list["UniqueKey"] @@ -7902,12 +5896,12 @@ class VectorEmbedding(TypedDict, total=False): :ivar path: The path to the vector field in the document. Required. :vartype path: str - :ivar data_type: Indicates the data type of vector. Required. Known values are: "float32", + :ivar dataType: Indicates the data type of vector. Required. Known values are: "float32", "uint8", "int8", and "float16". - :vartype data_type: Union[str, "VectorDataType"] - :ivar distance_function: The distance function to use for distance calculation in between + :vartype dataType: Union[str, "VectorDataType"] + :ivar distanceFunction: The distance function to use for distance calculation in between vectors. Required. Known values are: "euclidean", "cosine", and "dotproduct". - :vartype distance_function: Union[str, "DistanceFunction"] + :vartype distanceFunction: Union[str, "DistanceFunction"] :ivar dimensions: The number of dimensions in the vector. Required. :vartype dimensions: int """ @@ -7927,8 +5921,8 @@ class VectorEmbedding(TypedDict, total=False): class VectorEmbeddingPolicy(TypedDict, total=False): """Cosmos DB Vector Embedding Policy. - :ivar vector_embeddings: List of vector embeddings. - :vartype vector_embeddings: list["VectorEmbedding"] + :ivar vectorEmbeddings: List of vector embeddings. + :vartype vectorEmbeddings: list["VectorEmbedding"] """ vectorEmbeddings: list["VectorEmbedding"] @@ -7943,18 +5937,18 @@ class VectorIndex(TypedDict, total=False): :ivar type: The index type of the vector. Currently, flat, diskANN, and quantizedFlat are supported. Required. Known values are: "flat", "diskANN", and "quantizedFlat". :vartype type: Union[str, "VectorIndexType"] - :ivar quantization_byte_size: The number of bytes used in product quantization of the vectors. - A larger value may result in better recall for vector searches at the expense of latency. This - is only applicable for the quantizedFlat and diskANN vector index types. - :vartype quantization_byte_size: int - :ivar indexing_search_list_size: This is the size of the candidate list of approximate - neighbors stored while building the DiskANN index as part of the optimization processes. Large - values may improve recall at the expense of latency. This is only applicable for the diskANN - vector index type. - :vartype indexing_search_list_size: int - :ivar vector_index_shard_key: Array of shard keys for the vector index. This is only applicable + :ivar quantizationByteSize: The number of bytes used in product quantization of the vectors. A + larger value may result in better recall for vector searches at the expense of latency. This is + only applicable for the quantizedFlat and diskANN vector index types. + :vartype quantizationByteSize: int + :ivar indexingSearchListSize: This is the size of the candidate list of approximate neighbors + stored while building the DiskANN index as part of the optimization processes. Large values may + improve recall at the expense of latency. This is only applicable for the diskANN vector index + type. + :vartype indexingSearchListSize: int + :ivar vectorIndexShardKey: Array of shard keys for the vector index. This is only applicable for the quantizedFlat and diskANN vector index types. - :vartype vector_index_shard_key: list[str] + :vartype vectorIndexShardKey: list[str] """ path: Required[str] @@ -7981,9 +5975,9 @@ class VirtualNetworkRule(TypedDict, total=False): :ivar id: Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. :vartype id: str - :ivar ignore_missing_v_net_service_endpoint: Create firewall rule before the virtual network - has vnet service endpoint enabled. - :vartype ignore_missing_v_net_service_endpoint: bool + :ivar ignoreMissingVNetServiceEndpoint: Create firewall rule before the virtual network has + vnet service endpoint enabled. + :vartype ignoreMissingVNetServiceEndpoint: bool """ id: str @@ -7993,16 +5987,31 @@ class VirtualNetworkRule(TypedDict, total=False): """Create firewall rule before the virtual network has vnet service endpoint enabled.""" +BaseCosmosDataTransferDataSourceSink = Union[ + CosmosCassandraDataTransferDataSourceSink, + CosmosMongoDataTransferDataSourceSink, + CosmosSqlDataTransferDataSourceSink, +] +DataTransferDataSourceSink = Union[ + AzureBlobDataTransferDataSourceSink, + BaseCosmosDataTransferDataSourceSink, + CosmosCassandraDataTransferDataSourceSink, + CosmosMongoDataTransferDataSourceSink, + CosmosMongoVCoreDataTransferDataSourceSink, + CosmosSqlDataTransferDataSourceSink, +] BackupPolicy = Union[ContinuousModeBackupPolicy, PeriodicModeBackupPolicy] +BaseCopyJobProperties = Union[ + BlobToCassandraRUCopyJobProperties, + CassandraRUToBlobCopyJobProperties, + CassandraRUToCassandraRUCopyJobProperties, + MongoRUToMongoRUCopyJobProperties, + MongoRUToMongoVCoreCopyJobProperties, + NoSqlRUToNoSqlRUCopyJobProperties, +] ServiceResourceCreateUpdateProperties = Union[ DataTransferServiceResourceCreateUpdateProperties, GraphAPIComputeServiceResourceCreateUpdateProperties, MaterializedViewsBuilderServiceResourceCreateUpdateProperties, SqlDedicatedGatewayServiceResourceCreateUpdateProperties, ] -ServiceResourceProperties = Union[ - DataTransferServiceResourceProperties, - GraphAPIComputeServiceResourceProperties, - MaterializedViewsBuilderServiceResourceProperties, - SqlDedicatedGatewayServiceResourceProperties, -] 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..aaa8d5beeec9 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..3e43618cb409 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.chaos_fault.get( + resource_group_name="rg1", + account_name="ddb1", + chaos_fault="ServiceUnavailability", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/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..caac40b0a76a --- /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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.chaos_fault.list( + resource_group_name="rg1", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/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 6c45a877c870..43d19109c7e8 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: 2026-03-15/CosmosDBCassandraKeyspaceCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 b70219e0a6f7..226031c7fd21 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: 2026-03-15/CosmosDBCassandraKeyspaceDelete.json +# x-ms-original-file: 2026-04-01-preview/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 b4209bd9a340..73125034971e 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: 2026-03-15/CosmosDBCassandraKeyspaceGet.json +# x-ms-original-file: 2026-04-01-preview/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 f203ecd17ae5..7f448b0690f4 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: 2026-03-15/CosmosDBCassandraKeyspaceList.json +# x-ms-original-file: 2026-04-01-preview/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 8645b5d3efc9..238baa5e6efc 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: 2026-03-15/CosmosDBCassandraKeyspaceMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 31e68d4c9d29..519ef1e3510a 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: 2026-03-15/CosmosDBCassandraKeyspaceMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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 982c3ceb7c78..1890735c856d 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: 2026-03-15/CosmosDBCassandraKeyspaceThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 ce1a6b0b0793..2a9e0a6831b9 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: 2026-03-15/CosmosDBCassandraKeyspaceThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBCassandraKeyspaceThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_create_update.py index 054e361758e6..074d00ecf9d9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_create_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleAssignmentCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_delete.py index 3978401fc418..e1a8d2d14481 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleAssignmentDelete.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_get.py index 27f53b841e8a..4642498ed76e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleAssignmentGet.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_list.py index 12f9a9a9e474..836891fd9540 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_assignment_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleAssignmentList.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_create_update.py index 4af3966e53cb..f4f488e9b31d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_create_update.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_delete.py index 03674ea381b5..89388f09a91c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_get.py index eab5776d4f49..9b799e64ac1f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_list.py index a62e8c978e3e..0ae7b2cfd117 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/cassandrarbac/CosmosDBCassandraRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/cassandrarbac/CosmosDBCassandraRoleDefinitionList.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 39c64f6b1d0d..f031f03dc4d6 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: 2026-03-15/CosmosDBCassandraTableCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 0cf8100bc605..7bc4d14c2c44 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: 2026-03-15/CosmosDBCassandraTableDelete.json +# x-ms-original-file: 2026-04-01-preview/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 022f35626369..c0879c4c85f7 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: 2026-03-15/CosmosDBCassandraTableGet.json +# x-ms-original-file: 2026-04-01-preview/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 c621af79a973..d9c62dc1e877 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: 2026-03-15/CosmosDBCassandraTableList.json +# x-ms-original-file: 2026-04-01-preview/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 a1e20d07d918..5b06a4f7b755 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: 2026-03-15/CosmosDBCassandraTableMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 3da7b88a1c3c..3b019822008d 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: 2026-03-15/CosmosDBCassandraTableMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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 2c1b1c956ffc..a6ab0ddf8ea5 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: 2026-03-15/CosmosDBCassandraTableThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 73ecd167fe91..a5af5330344c 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: 2026-03-15/CosmosDBCassandraTableThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/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..88ac967d1b59 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_cassandra_view_create_update.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..76dfdc93adf7 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..2685ac017271 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..afaf00added7 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..547d53b41aa0 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..111c4ad54647 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..e3c045b8f0cc --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..de2098af8bc4 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 c43fb4bb0803..cc228192e515 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: 2026-03-15/CosmosDBCollectionGetMetricDefinitions.json +# x-ms-original-file: 2026-04-01-preview/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 7bebb5f9a58f..8cd840c1cad9 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 @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBCollectionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 a2e71c551ea5..4c261471d738 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: 2026-03-15/CosmosDBCollectionGetUsages.json +# x-ms-original-file: 2026-04-01-preview/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 dacdb4155c2b..fcf269d64f1f 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 @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBCollectionPartitionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 2e630e060a68..30e6f1d92b5e 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: 2026-03-15/CosmosDBCollectionPartitionGetUsages.json +# x-ms-original-file: 2026-04-01-preview/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 b31b97e53cc6..6635adf6d602 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 @@ -43,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBCollectionPartitionRegionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBCollectionPartitionRegionGetMetrics.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_cancel.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_cancel.py new file mode 100644 index 000000000000..e19d9f54bf07 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.cancel( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobCancel.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_complete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_complete.py new file mode 100644 index 000000000000..5b9564d31f3f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.complete( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobComplete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_create.py new file mode 100644 index 000000000000..b5a2fbe28987 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_create.py @@ -0,0 +1,61 @@ +# 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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.create( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + job_create_parameters={ + "properties": { + "jobProperties": { + "jobType": "NoSqlRUToNoSqlRU", + "tasks": [ + { + "destination": {"containerName": "destTable1", "databaseName": "destDB1"}, + "source": {"containerName": "sourceTable1", "databaseName": "sourceDb1"}, + }, + { + "destination": {"containerName": "destTable2", "databaseName": "destDB2"}, + "source": {"containerName": "sourceTable2", "databaseName": "sourceDb2"}, + }, + ], + }, + "mode": "Offline", + } + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_feed.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_feed.py new file mode 100644 index 000000000000..33858f5438e4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.list_by_database_account( + resource_group_name="rg1", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobFeed.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_get.py new file mode 100644 index 000000000000..67078c0347bf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.get( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_pause.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_pause.py new file mode 100644 index 000000000000..a5329a317f66 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.pause( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobPause.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_resume.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_job_resume.py new file mode 100644 index 000000000000..ae587613b092 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_copy_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) Python 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_copy_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="SUBSCRIPTION_ID", + ) + + response = client.copy_jobs.resume( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/copy-jobs/CosmosDBCopyJobResume.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_cancel.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_cancel.py new file mode 100644 index 000000000000..b5c4a34cc771 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.data_transfer_jobs.cancel( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobCancel.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_complete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_complete.py new file mode 100644 index 000000000000..ea5e847b1b9b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.data_transfer_jobs.complete( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobComplete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_create.py new file mode 100644 index 000000000000..81ff5aa2c915 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_feed.py new file mode 100644 index 000000000000..236266e4765c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobFeed.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_get.py new file mode 100644 index 000000000000..2a2853cc6d01 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.data_transfer_jobs.get( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_pause.py new file mode 100644 index 000000000000..6bfdfb19c937 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.data_transfer_jobs.pause( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobPause.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_resume.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_data_transfer_job_resume.py new file mode 100644 index 000000000000..fe56e85288d4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.data_transfer_jobs.resume( + resource_group_name="rg1", + account_name="ddb1", + job_name="j1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/data-transfer-service/CosmosDBDataTransferJobResume.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 6ba694552c2f..d700bd64f2ad 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: 2026-03-15/CosmosDBDataTransferServiceCreate.json +# x-ms-original-file: 2026-04-01-preview/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 e4198b077f39..e0fc6bb8e5a2 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: 2026-03-15/CosmosDBDataTransferServiceDelete.json +# x-ms-original-file: 2026-04-01-preview/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 72229bfcc193..5d755354b461 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: 2026-03-15/CosmosDBDataTransferServiceGet.json +# x-ms-original-file: 2026-04-01-preview/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 8001e9831af5..d5672b5ee390 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: 2026-03-15/CosmosDBDatabaseAccountCheckNameExists.json +# x-ms-original-file: 2026-04-01-preview/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 66783cf6726d..6dac4d5c57b6 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 @@ -55,6 +55,7 @@ def main(): "type": "Periodic", }, "capacity": {"totalThroughputLimit": 2000}, + "capacityMode": "Provisioned", "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 10, @@ -65,9 +66,11 @@ def main(): "databaseAccountOfferType": "Standard", "defaultIdentity": "FirstPartyIdentity", "defaultPriorityLevel": "Low", + "enableAllVersionsAndDeletesChangeFeed": False, "enableAnalyticalStorage": True, "enableBurstCapacity": True, "enableFreeTier": False, + "enableMaterializedViews": False, "enablePerRegionPerPartitionAutoscale": True, "enablePriorityBasedExecution": True, "enforceHierarchicalPartitionKeyIdLastLevel": False, @@ -97,6 +100,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountCreateMax.json +# x-ms-original-file: 2026-04-01-preview/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 d14da1dd655e..aa68fd2a3455 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: 2026-03-15/CosmosDBDatabaseAccountCreateMin.json +# x-ms-original-file: 2026-04-01-preview/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 632ada3ad505..fa70f9a83600 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: 2026-03-15/CosmosDBDatabaseAccountDelete.json +# x-ms-original-file: 2026-04-01-preview/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 0f6f7953cade..a7807e48b333 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: 2026-03-15/CosmosDBDatabaseAccountFailoverPriorityChange.json +# x-ms-original-file: 2026-04-01-preview/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 83c49ddc1404..0e190cb3bb9e 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: 2026-03-15/CosmosDBDatabaseAccountGet.json +# x-ms-original-file: 2026-04-01-preview/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 138d058ca988..8c5eb566874d 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: 2026-03-15/CosmosDBDatabaseAccountGetMetricDefinitions.json +# x-ms-original-file: 2026-04-01-preview/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 ce601f68377e..182fe7f3efc1 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 @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 a67af3b08991..62162ff867f4 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: 2026-03-15/CosmosDBDatabaseAccountGetUsages.json +# x-ms-original-file: 2026-04-01-preview/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 e5fed47d6eec..39040fa277ff 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: 2026-03-15/CosmosDBDatabaseAccountList.json +# x-ms-original-file: 2026-04-01-preview/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 0aac144e2364..babde43d124b 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: 2026-03-15/CosmosDBDatabaseAccountListByResourceGroup.json +# x-ms-original-file: 2026-04-01-preview/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 7f1c933b45cc..206d63c80c72 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: 2026-03-15/CosmosDBDatabaseAccountListConnectionStrings.json +# x-ms-original-file: 2026-04-01-preview/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 08b32d0e48f3..5d2865bc8b39 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: 2026-03-15/CosmosDBDatabaseAccountListConnectionStringsMongo.json +# x-ms-original-file: 2026-04-01-preview/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 95a5d18f9341..63ebeb7457c6 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: 2026-03-15/CosmosDBDatabaseAccountListKeys.json +# x-ms-original-file: 2026-04-01-preview/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 4028006ff8b7..d34847c6ea8e 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountListReadOnlyKeys.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBDatabaseAccountListReadOnlyKeys.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys_get_read_only_keys.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys_get_read_only_keys.py index 717e7ce74880..bb2c7da5b6b8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys_get_read_only_keys.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_database_account_list_read_only_keys_get_read_only_keys.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountListReadOnlyKeys_GetReadOnlyKeys.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBDatabaseAccountListReadOnlyKeys_GetReadOnlyKeys.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 994692654542..782b0e5a1aa1 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: 2026-03-15/CosmosDBDatabaseAccountOfflineRegion.json +# x-ms-original-file: 2026-04-01-preview/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 b680d7d71d40..446a7e69a747 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: 2026-03-15/CosmosDBDatabaseAccountOnlineRegion.json +# x-ms-original-file: 2026-04-01-preview/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 2c79544d745b..d62e1451365d 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 @@ -48,11 +48,12 @@ def main(): "periodicModeProperties": { "backupIntervalInMinutes": 240, "backupRetentionIntervalInHours": 720, - "backupStorageRedundancy": "Local", + "backupStorageRedundancy": "Geo", }, "type": "Periodic", }, "capacity": {"totalThroughputLimit": 2000}, + "capacityMode": "Provisioned", "consistencyPolicy": { "defaultConsistencyLevel": "BoundedStaleness", "maxIntervalInSeconds": 10, @@ -60,6 +61,7 @@ def main(): }, "defaultIdentity": "FirstPartyIdentity", "defaultPriorityLevel": "Low", + "diagnosticLogSettings": {"enableFullTextQuery": "True"}, "enableAnalyticalStorage": True, "enableBurstCapacity": True, "enableFreeTier": False, @@ -87,6 +89,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountPatch.json +# x-ms-original-file: 2026-04-01-preview/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 996c2a5ec518..6a6b9747f880 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 @@ -33,10 +33,10 @@ def main(): client.database_accounts.begin_regenerate_key( resource_group_name="rg1", account_name="ddb1", - key_to_regenerate={"keyKind": "primary"}, + key_to_regenerate={"keyKind": "primary", "skipAccountKeysLastUsageCheck": False}, ).result() -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountRegenerateKey.json +# x-ms-original-file: 2026-04-01-preview/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 c1c1e1f0b010..5d02a89dbe9a 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 @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseAccountRegionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 a4d692966579..d5100500b157 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: 2026-03-15/CosmosDBDatabaseGetMetricDefinitions.json +# x-ms-original-file: 2026-04-01-preview/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 73026ee2ea55..a4a035a02323 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 @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBDatabaseGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 3df566113919..6658c5a97eef 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: 2026-03-15/CosmosDBDatabaseGetUsages.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBDatabaseGetUsages.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_create.py new file mode 100644 index 000000000000..61b82f699169 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_create.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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_fleet_analytics_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="SUBSCRIPTION_ID", + ) + + response = client.fleet_analytics.create( + resource_group_name="rg1", + fleet_name="fleet1", + fleet_analytics_name="storageAccount", + body={ + "properties": { + "storageLocationType": "StorageAccount", + "storageLocationUri": "/subscriptions/d1eb41bc-1b7f-4404-bd2a-868c222852d/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/testStorageAccount1", + } + }, + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetAnalyticsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_delete.py new file mode 100644 index 000000000000..29a8f0fd4cf0 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_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) Python 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_fleet_analytics_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="SUBSCRIPTION_ID", + ) + + client.fleet_analytics.begin_delete( + resource_group_name="rg1", + fleet_name="fleet1", + fleet_analytics_name="storageAccount", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetAnalyticsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_get.py new file mode 100644 index 000000000000..97bedd6a3a6a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_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) Python 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_fleet_analytics_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="SUBSCRIPTION_ID", + ) + + response = client.fleet_analytics.get( + resource_group_name="rg1", + fleet_name="fleet1", + fleet_analytics_name="storageAccount", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetAnalyticsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_list.py new file mode 100644 index 000000000000..e3341dfe10db --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_analytics_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) Python 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_fleet_analytics_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="SUBSCRIPTION_ID", + ) + + response = client.fleet_analytics.list( + resource_group_name="rg1", + fleet_name="fleet1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetAnalyticsList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_create.py index 1c5cfd3e72eb..85896b576b5a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetCreate.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_delete.py index 47884105d466..7cfd27515731 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetDelete.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_get.py index bd6bb72012ad..f9614e6a7d9d 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetGet.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list.py index fdf34ae228fe..94b5c0f36292 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetList.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list_list_by_resource_group.py index a5836bcf239e..ddd9cab9904f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list_list_by_resource_group.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_list_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetList_ListByResourceGroup.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetList_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_update.py index 0867e9d33410..eda2939b6f6a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleet_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetUpdate.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_create.py index c921366f832e..945190130a6a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_create.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceAccountCreate.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceAccountCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_delete.py index 553de13a68e7..e9d74c65c538 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_delete.py @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceAccountDelete.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceAccountDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_get.py index 0ff047560411..7d1b6841342f 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceAccountGet.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceAccountGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_list.py index 021b63e6296e..b8749b7e2caf 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_account_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceAccountList.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceAccountList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_create.py index 14500cb7a711..494b51b7dfad 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceCreate.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_delete.py index 0b18222b943c..b0d69f29b140 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceDelete.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_get.py index ece0f7510d97..f1bb6e26d4ec 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceGet.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_list.py index 73e38c98af2d..b302758b4127 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceList.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_update.py index 6bb3ef04d14d..cef519fb63bb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_fleetspace_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/fleet/CosmosDBFleetspaceUpdate.json +# x-ms-original-file: 2026-04-01-preview/fleet/CosmosDBFleetspaceUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_create.py new file mode 100644 index 000000000000..bc3a5ffde840 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_create.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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_garnet_cluster_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="SUBSCRIPTION_ID", + ) + + response = client.garnet_clusters.begin_create_update( + resource_group_name="garnet-prod-rg", + cluster_name="garnet-prod", + body={ + "location": "West US", + "properties": { + "authenticationMethod": "Entra", + "nodeSku": "Standard_DS13_v2", + "persistence": True, + "replicationFactor": 2, + "shardCount": 4, + "subnetId": "/subscriptions/536e130b-d7d6-4ac7-98a5-de20d69588d2/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management", + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_delete.py new file mode 100644 index 000000000000..077104ada148 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_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) Python 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_garnet_cluster_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="SUBSCRIPTION_ID", + ) + + client.garnet_clusters.begin_delete( + resource_group_name="garnet-prod-rg", + cluster_name="garnet-prod", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_get.py new file mode 100644 index 000000000000..f006c25845f3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_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) Python 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_garnet_cluster_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="SUBSCRIPTION_ID", + ) + + response = client.garnet_clusters.get( + resource_group_name="garnet-prod-rg", + cluster_name="garnet-prod", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_resource_group.py new file mode 100644 index 000000000000..0e5d21dd9096 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_resource_group.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) Python 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_garnet_cluster_list_by_resource_group.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="SUBSCRIPTION_ID", + ) + + response = client.garnet_clusters.list_by_resource_group( + resource_group_name="garnet-prod-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_subscription.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_subscription.py new file mode 100644 index 000000000000..c1c67a3f35e6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_list_by_subscription.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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_garnet_cluster_list_by_subscription.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="SUBSCRIPTION_ID", + ) + + response = client.garnet_clusters.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterListBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_patch.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_patch.py new file mode 100644 index 000000000000..54c509ac7e40 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_garnet_cluster_patch.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) Python 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_garnet_cluster_patch.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="SUBSCRIPTION_ID", + ) + + response = client.garnet_clusters.begin_update( + resource_group_name="garnet-prod-rg", + cluster_name="garnet-prod", + body={"properties": {"authenticationMethod": "Entra", "clusterType": "Production", "persistence": True}}, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBGarnetClusterPatch.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 e488e6c7f5a8..40724f5e6ae3 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: 2026-03-15/CosmosDBGraphAPIComputeServiceCreate.json +# x-ms-original-file: 2026-04-01-preview/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 31b4d5891dec..32d451f7d68e 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: 2026-03-15/CosmosDBGraphAPIComputeServiceDelete.json +# x-ms-original-file: 2026-04-01-preview/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 d8a4762e270d..02115fa2bf99 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: 2026-03-15/CosmosDBGraphAPIComputeServiceGet.json +# x-ms-original-file: 2026-04-01-preview/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..2582f725cec0 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..92ffac12a69e --- /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) Python 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="SUBSCRIPTION_ID", + ) + + client.graph_resources.begin_delete_graph_resource( + resource_group_name="rg1", + account_name="ddb1", + graph_name="graphName", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/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..f140ae3dd2dd --- /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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.graph_resources.get_graph( + resource_group_name="rg1", + account_name="ddb1", + graph_name="graphName", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/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..878875202f76 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.graph_resources.list_graphs( + resource_group_name="rgName", + account_name="ddb1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/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 9a57c04bff72..978eb158ef8c 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: 2026-03-15/CosmosDBGremlinDatabaseCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 eb6ce8a4518b..5564400a6514 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: 2026-03-15/CosmosDBGremlinDatabaseDelete.json +# x-ms-original-file: 2026-04-01-preview/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 a0e5dff1cd83..b1cee0d14527 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: 2026-03-15/CosmosDBGremlinDatabaseGet.json +# x-ms-original-file: 2026-04-01-preview/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 f2d16df0ff57..e3d7e1e9c82e 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: 2026-03-15/CosmosDBGremlinDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 bedf6745d2b5..e81f3e85100a 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: 2026-03-15/CosmosDBGremlinDatabaseMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 57f2a60c72be..37b475cc6753 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: 2026-03-15/CosmosDBGremlinDatabaseMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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 e8bf28d64b7b..373430fa6e92 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: 2026-03-15/CosmosDBGremlinDatabaseThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 1435f58773d3..096812a1b98a 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: 2026-03-15/CosmosDBGremlinDatabaseThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 165e15df1b6b..48db442ac357 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: 2026-03-15/CosmosDBGremlinGraphBackupInformation.json +# x-ms-original-file: 2026-04-01-preview/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 7fe6bbac6fd8..2d29b96b72c3 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: 2026-03-15/CosmosDBGremlinGraphCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 7f942c94c47d..4bcb106c75b5 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: 2026-03-15/CosmosDBGremlinGraphDelete.json +# x-ms-original-file: 2026-04-01-preview/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 318214513b31..d4dc43ee1606 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: 2026-03-15/CosmosDBGremlinGraphGet.json +# x-ms-original-file: 2026-04-01-preview/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 82bc0b138882..d8e582e7d388 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: 2026-03-15/CosmosDBGremlinGraphList.json +# x-ms-original-file: 2026-04-01-preview/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 a7653e4f6eb5..4e3896fc9cb0 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: 2026-03-15/CosmosDBGremlinGraphMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 eba0d715057c..eeafd3b25203 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: 2026-03-15/CosmosDBGremlinGraphMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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 5c3823b252e3..9d8344d29fe2 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: 2026-03-15/CosmosDBGremlinGraphThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 f715d610f5dc..9acc17f2232e 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: 2026-03-15/CosmosDBGremlinGraphThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBGremlinGraphThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_create_update.py index c5ea68432654..016d96c94e54 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_create_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleAssignmentCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_delete.py index 270cf090679f..b853f309ffb0 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleAssignmentDelete.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_get.py index 82493ae53e95..b37ffeac4809 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleAssignmentGet.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_list.py index 6f1d2413ad66..137fe5459519 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_assignment_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleAssignmentList.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_create_update.py index bbf8d5f19a2b..5de4b91072b3 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_create_update.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_delete.py index c27e5f18241a..03598a32cacd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_get.py index 2b34017f1e0d..18fea8d02f76 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_list.py index 43e9cdc8f7da..68df245e9f35 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_gremlin_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/gremlinrbac/CosmosDBGremlinRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/gremlinrbac/CosmosDBGremlinRoleDefinitionList.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 d04667760294..069abf758fdd 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: 2026-03-15/CosmosDBLocationGet.json +# x-ms-original-file: 2026-04-01-preview/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 f3d375fcd639..b78f58542498 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: 2026-03-15/CosmosDBLocationList.json +# x-ms-original-file: 2026-04-01-preview/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..116ee5fb55e8 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..666bc92a48bb --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 193ea9a341fb..78d55861fd96 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 @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraClusterCreate.json +# x-ms-original-file: 2026-04-01-preview/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 7141bf1feae0..f3eb88c5d611 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 @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraClusterDeallocate.json +# x-ms-original-file: 2026-04-01-preview/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 89ca92bcf6e7..107437599a4c 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: 2026-03-15/CosmosDBManagedCassandraClusterDelete.json +# x-ms-original-file: 2026-04-01-preview/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 bfd91256c2e7..d403e92156f3 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: 2026-03-15/CosmosDBManagedCassandraClusterGet.json +# x-ms-original-file: 2026-04-01-preview/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 2dcafd7437dc..bcb51c77869f 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: 2026-03-15/CosmosDBManagedCassandraClusterListByResourceGroup.json +# x-ms-original-file: 2026-04-01-preview/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 57e4f645c0bc..33daab78311a 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: 2026-03-15/CosmosDBManagedCassandraClusterListBySubscription.json +# x-ms-original-file: 2026-04-01-preview/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 50db5242d140..1941cb3ccfe6 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: 2026-03-15/CosmosDBManagedCassandraClusterPatch.json +# x-ms-original-file: 2026-04-01-preview/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 d7a7dbabf044..5124b6fc620d 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 @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraClusterStart.json +# x-ms-original-file: 2026-04-01-preview/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 c78550ff6451..5c6f314fdfca 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 @@ -33,11 +33,11 @@ def main(): 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: 2026-03-15/CosmosDBManagedCassandraCommand.json +# x-ms-original-file: 2026-04-01-preview/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..05ef045f8ba9 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..061b6d94f6b9 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 a123c8de319e..8970c8dd53d7 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraDataCenterCreate.json +# x-ms-original-file: 2026-04-01-preview/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 64aae6017c0e..e2f009fd95af 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: 2026-03-15/CosmosDBManagedCassandraDataCenterDelete.json +# x-ms-original-file: 2026-04-01-preview/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 2cd31b08bf5a..f244e620296e 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: 2026-03-15/CosmosDBManagedCassandraDataCenterGet.json +# x-ms-original-file: 2026-04-01-preview/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 b93171776c62..edb8abc63020 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: 2026-03-15/CosmosDBManagedCassandraDataCenterList.json +# x-ms-original-file: 2026-04-01-preview/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 6231fa2c5e74..e938346a3cd8 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraDataCenterPatch.json +# x-ms-original-file: 2026-04-01-preview/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..56f7af760584 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 c2f58eaeee45..eeed096af0cb 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBManagedCassandraStatus.json +# x-ms-original-file: 2026-04-01-preview/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 e89c2d32c158..9e6d06c3e7e8 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: 2026-03-15/CosmosDBMaterializedViewsBuilderServiceCreate.json +# x-ms-original-file: 2026-04-01-preview/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 37d361a38e2f..79ebc970fe71 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: 2026-03-15/CosmosDBMaterializedViewsBuilderServiceDelete.json +# x-ms-original-file: 2026-04-01-preview/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 25f660d1a6e7..067c9fcb1088 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: 2026-03-15/CosmosDBMaterializedViewsBuilderServiceGet.json +# x-ms-original-file: 2026-04-01-preview/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 2cd659087ec5..cd2f56f2b10a 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: 2026-03-15/CosmosDBMongoDBCollectionBackupInformation.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBCollectionBackupInformation.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_create_update.py index beba9204f8da..b101652b2327 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_create_update.py @@ -40,6 +40,7 @@ def main(): "properties": { "options": {}, "resource": { + "analyticalStorageTtl": 500, "id": "collectionName", "indexes": [ {"key": {"keys": ["_ts"]}, "options": {"expireAfterSeconds": 100, "unique": True}}, @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBMongoDBCollectionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBCollectionCreateUpdate.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 3d75c673445c..366e6ff25ba9 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: 2026-03-15/CosmosDBMongoDBCollectionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 14973e5e5c78..7b9a32393dab 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: 2026-03-15/CosmosDBMongoDBCollectionGet.json +# x-ms-original-file: 2026-04-01-preview/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 aa1d257bdd51..6383244c1c95 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: 2026-03-15/CosmosDBMongoDBCollectionList.json +# x-ms-original-file: 2026-04-01-preview/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 2bb09703719e..0b473e5d8cd5 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: 2026-03-15/CosmosDBMongoDBCollectionMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 4ab52f5541cb..5e5de174356c 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: 2026-03-15/CosmosDBMongoDBCollectionMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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..aeae7b366718 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..a356c4b00ae7 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/CosmosDBMongoDBCollectionRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_restore.py new file mode 100644 index 000000000000..6b816ab8755b --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_collection_restore.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.mongo_db_resources.begin_create_update_mongo_db_collection( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + collection_name="collectionName", + create_update_mongo_db_collection_parameters={ + "location": "West US", + "properties": { + "options": {}, + "resource": { + "createMode": "Restore", + "id": "collectionName", + "restoreParameters": { + "restoreSource": "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": False, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBCollectionRestore.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..5e81af27f2e3 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 4f497e81e119..1ecc9ec06819 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: 2026-03-15/CosmosDBMongoDBCollectionThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 ced5253c8bf9..0e250b6078fd 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: 2026-03-15/CosmosDBMongoDBCollectionThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBCollectionThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_create_update.py index d0ad80adbce7..865b09a9241a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_create_update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBMongoDBDatabaseCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBDatabaseCreateUpdate.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 97baf84f5e80..1eae26dd8e87 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: 2026-03-15/CosmosDBMongoDBDatabaseDelete.json +# x-ms-original-file: 2026-04-01-preview/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 f94db19ca40b..5bd7d80f6fea 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: 2026-03-15/CosmosDBMongoDBDatabaseGet.json +# x-ms-original-file: 2026-04-01-preview/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 ac999bd70e92..78338cf2e825 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: 2026-03-15/CosmosDBMongoDBDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 c9ed06ad10ef..dee0822c5e71 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: 2026-03-15/CosmosDBMongoDBDatabaseMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 298226716da2..1adc193d0524 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: 2026-03-15/CosmosDBMongoDBDatabaseMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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..e6e9c7b374db --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..9c668ed611fd --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/CosmosDBMongoDBDatabaseRedistributeThroughput.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_restore.py new file mode 100644 index 000000000000..afc7012ad5c7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_db_database_restore.py @@ -0,0 +1,60 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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_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="SUBSCRIPTION_ID", + ) + + response = client.mongo_db_resources.begin_create_update_mongo_db_database( + resource_group_name="rg1", + account_name="ddb1", + database_name="databaseName", + create_update_mongo_db_database_parameters={ + "location": "West US", + "properties": { + "options": {}, + "resource": { + "createMode": "Restore", + "id": "databaseName", + "restoreParameters": { + "restoreSource": "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": False, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBDatabaseRestore.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..2cafec134b8c --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 60e817229963..35828126265b 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: 2026-03-15/CosmosDBMongoDBDatabaseThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 430e9fb4a89f..d7b2f4744e68 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: 2026-03-15/CosmosDBMongoDBDatabaseThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 4831b6d29d9e..2a259adb1f65 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: 2026-03-15/CosmosDBMongoDBRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 d3cbd3a42f97..90b283ce71ce 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: 2026-03-15/CosmosDBMongoDBRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 f5781dfc30ec..afda06363f86 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: 2026-03-15/CosmosDBMongoDBRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/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 83570b949d5d..ca2cd15a633c 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: 2026-03-15/CosmosDBMongoDBRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/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 ede66029e6a4..122fb9163143 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: 2026-03-15/CosmosDBMongoDBUserDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 d08091868d04..5f3ade92f925 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: 2026-03-15/CosmosDBMongoDBUserDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 87fc51df3eec..c3317a332dd6 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: 2026-03-15/CosmosDBMongoDBUserDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/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 e7d50c8b7f28..d5d94d4c3fd2 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: 2026-03-15/CosmosDBMongoDBUserDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBMongoDBUserDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_create_update.py index 8c04e68ccae8..030a495c7e3c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_create_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleAssignmentCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_delete.py index 8eb4a6645126..58523443deb4 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleAssignmentDelete.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_get.py index 7bfd8dce5621..4a5eac59f187 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleAssignmentGet.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_list.py index 25e0d1adc7b4..d15913ae22bd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_assignment_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleAssignmentList.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_create_update.py index a84fb849e522..3992de0f2183 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_create_update.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_delete.py index 005559c755e3..1689f52bf067 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_get.py index af2d62488151..7606fa564f20 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_list.py index 3434bb1b3444..01dc2205c513 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_mongo_mi_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/mongoMIrbac/CosmosDBMongoMIRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/mongoMIrbac/CosmosDBMongoMIRoleDefinitionList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_create.py index d191db194e0a..5c9f5b133f7c 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_notebook_workspace_create.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBNotebookWorkspaceCreate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBNotebookWorkspaceCreate.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 635d6bc813b6..9cf415316c6e 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: 2026-03-15/CosmosDBNotebookWorkspaceDelete.json +# x-ms-original-file: 2026-04-01-preview/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 811e9c92ed7f..e46723700d3d 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: 2026-03-15/CosmosDBNotebookWorkspaceGet.json +# x-ms-original-file: 2026-04-01-preview/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 061d57417eb3..c5ce92593ec2 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: 2026-03-15/CosmosDBNotebookWorkspaceList.json +# x-ms-original-file: 2026-04-01-preview/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 71879f00a0d8..4e5473ae3725 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: 2026-03-15/CosmosDBNotebookWorkspaceListConnectionInfo.json +# x-ms-original-file: 2026-04-01-preview/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 bf045f3ddb56..937c0d6da07a 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: 2026-03-15/CosmosDBNotebookWorkspaceRegenerateAuthToken.json +# x-ms-original-file: 2026-04-01-preview/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 edfea78fc4c3..684602abac7d 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: 2026-03-15/CosmosDBNotebookWorkspaceStart.json +# x-ms-original-file: 2026-04-01-preview/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 2141b01a4891..ae232d5992a9 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: 2026-03-15/CosmosDBOperationsList.json +# x-ms-original-file: 2026-04-01-preview/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 4ef5df49d1b0..bce65fa5ea05 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 @@ -40,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBPercentileGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 b6760a995bc9..1515edbd5867 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 @@ -42,6 +42,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBPercentileSourceTargetGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 7109d7b21870..3c54e5c7da6f 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 @@ -41,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBPercentileTargetGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 c30be08cf5eb..02a16260a003 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: 2026-03-15/CosmosDBPrivateEndpointConnectionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 301ef2fe1cb0..559e965c0550 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: 2026-03-15/CosmosDBPrivateEndpointConnectionGet.json +# x-ms-original-file: 2026-04-01-preview/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 8c2774a80317..048be7275063 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: 2026-03-15/CosmosDBPrivateEndpointConnectionListGet.json +# x-ms-original-file: 2026-04-01-preview/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 19bcaae6543b..61e63cb8be3b 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: 2026-03-15/CosmosDBPrivateEndpointConnectionUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 0c917afcce4b..03f0678c8b9d 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: 2026-03-15/CosmosDBPrivateLinkResourceGet.json +# x-ms-original-file: 2026-04-01-preview/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 ff9d428232c6..9cf97110ddc3 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: 2026-03-15/CosmosDBPrivateLinkResourceListGet.json +# x-ms-original-file: 2026-04-01-preview/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 2e308d62878d..7fce5b25dc78 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 @@ -43,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBRegionCollectionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 535d363cb13e..d32cccad3869 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: 2026-03-15/CosmosDBRestorableDatabaseAccountGet.json +# x-ms-original-file: 2026-04-01-preview/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 d7777ba03bec..1ceaa866003b 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: 2026-03-15/CosmosDBRestorableDatabaseAccountList.json +# x-ms-original-file: 2026-04-01-preview/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 defc52a65d56..a46133b176dc 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: 2026-03-15/CosmosDBRestorableDatabaseAccountNoLocationList.json +# x-ms-original-file: 2026-04-01-preview/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 d59f94195a2a..77a5943bd438 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: 2026-03-15/CosmosDBRestorableGremlinDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 f1e063aee4fe..1da45c42e684 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: 2026-03-15/CosmosDBRestorableGremlinGraphList.json +# x-ms-original-file: 2026-04-01-preview/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 7a85fc86099a..bb26cc504045 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: 2026-03-15/CosmosDBRestorableGremlinResourceList.json +# x-ms-original-file: 2026-04-01-preview/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 e702b3f317fd..31aa5be75d7f 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: 2026-03-15/CosmosDBRestorableMongodbCollectionList.json +# x-ms-original-file: 2026-04-01-preview/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 599095a03b4c..7ec4aa35b556 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: 2026-03-15/CosmosDBRestorableMongodbDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 8ea027c8f670..4044c22c625c 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: 2026-03-15/CosmosDBRestorableMongodbResourceList.json +# x-ms-original-file: 2026-04-01-preview/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 46c11be42ced..3a606d1b164e 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: 2026-03-15/CosmosDBRestorableSqlContainerList.json +# x-ms-original-file: 2026-04-01-preview/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 68b4cbe7288c..71b781319c77 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: 2026-03-15/CosmosDBRestorableSqlDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 df67f25014ef..9c645860919e 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: 2026-03-15/CosmosDBRestorableSqlResourceList.json +# x-ms-original-file: 2026-04-01-preview/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 75d1530be97b..ba684a8d4f17 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: 2026-03-15/CosmosDBRestorableTableList.json +# x-ms-original-file: 2026-04-01-preview/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 49b9be96526c..aeef3bb2f607 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: 2026-03-15/CosmosDBRestorableTableResourceList.json +# x-ms-original-file: 2026-04-01-preview/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 73ccb0e698e0..c876662e65e1 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 @@ -49,6 +49,7 @@ def main(): "databaseAccountOfferType": "Standard", "enableAnalyticalStorage": True, "enableFreeTier": False, + "enableMaterializedViews": False, "enforceHierarchicalPartitionKeyIdLastLevel": False, "keyVaultKeyUri": "https://myKeyVault.vault.azure.net", "locations": [{"failoverPriority": 0, "isZoneRedundant": False, "locationName": "southcentralus"}], @@ -59,7 +60,7 @@ def main(): {"collectionNames": ["collection3", "collection4"], "databaseName": "db2"}, ], "restoreMode": "PointInTime", - "restoreSource": "/subscriptions/subid/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc", + "restoreSource": "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/1a97b4bb-f6a0-430e-ade1-638d781830cc", "restoreTimestampInUtc": "2021-03-11T22:05:09Z", "restoreWithTtlDisabled": False, "sourceBackupLocation": "westus", @@ -71,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBRestoreDatabaseAccountCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 2f367d816acd..1453ba340ea1 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: 2026-03-15/CosmosDBServicesList.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBServicesList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_get.py new file mode 100644 index 000000000000..b0783ee0f534 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_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) Python 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_soft_deleted_database_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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_database_accounts.get( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedDatabaseAccountGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_location.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_location.py new file mode 100644 index 000000000000..0b6006e03e28 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_location.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) Python 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_soft_deleted_database_account_list_by_location.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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_database_accounts.list_by_location( + location="West US", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedDatabaseAccountListByLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_resource_group_and_location.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_resource_group_and_location.py new file mode 100644 index 000000000000..10c297be3626 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_list_by_resource_group_and_location.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) Python 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_soft_deleted_database_account_list_by_resource_group_and_location.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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_database_accounts.list_by_resource_group_and_location( + resource_group_name="rg1", + location="West US", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedDatabaseAccountListByResourceGroupAndLocation.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_purge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_purge.py new file mode 100644 index 000000000000..94cb800a18f6 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_purge.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) Python 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_soft_deleted_database_account_purge.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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_database_accounts.begin_purge( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedDatabaseAccountPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_restore.py new file mode 100644 index 000000000000..2edf444c131a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_database_account_restore.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) Python 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_soft_deleted_database_account_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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_database_accounts.begin_restore( + resource_group_name="rg2", + location="West US", + account_name="softdeleted-cosmosdb-2", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedDatabaseAccountRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_get.py new file mode 100644 index 000000000000..7184b5a894fd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_get.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) Python 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_soft_deleted_sql_container_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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_sql_containers.get( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + container_name="MyContainer", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlContainerGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_list.py new file mode 100644 index 000000000000..848be1343157 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_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) Python 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_soft_deleted_sql_container_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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_sql_containers.list( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlContainerList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_purge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_purge.py new file mode 100644 index 000000000000..31ee97953d36 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_purge.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) Python 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_soft_deleted_sql_container_purge.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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_sql_containers.begin_purge( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + container_name="MyContainer", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlContainerPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_restore.py new file mode 100644 index 000000000000..7f90f338563a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_container_restore.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) Python 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_soft_deleted_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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_sql_containers.begin_restore( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + container_name="MyContainer", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlContainerRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_get.py new file mode 100644 index 000000000000..a5674f46586a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_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) Python 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_soft_deleted_sql_database_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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_sql_databases.get( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlDatabaseGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_list.py new file mode 100644 index 000000000000..c7fdfa549584 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_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) Python 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_soft_deleted_sql_database_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="SUBSCRIPTION_ID", + ) + + response = client.soft_deleted_sql_databases.list( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlDatabaseList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_purge.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_purge.py new file mode 100644 index 000000000000..8389e0a20389 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_purge.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) Python 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_soft_deleted_sql_database_purge.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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_sql_databases.begin_purge( + resource_group_name="rg1", + location="West US", + account_name="softdeleted-cosmosdb-1", + database_name="MyDatabase", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlDatabasePurge.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_restore.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_restore.py new file mode 100644 index 000000000000..c0808031ab9a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_soft_deleted_sql_database_restore.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) Python 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_soft_deleted_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="SUBSCRIPTION_ID", + ) + + client.soft_deleted_sql_databases.begin_restore( + resource_group_name="rg1", + location="West US", + account_name="ddb1", + database_name="softDeletedDatabase1", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/CosmosDBSoftDeletedSqlDatabaseRestore.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 67374beb05ea..103cdb6f15e7 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -46,7 +47,7 @@ def main(): "type": "AzureKeyVault", "value": "AzureKeyVault Key URL", }, - "wrappedDataEncryptionKey": "U3dhZ2dlciByb2Nrcw==", + "wrappedDataEncryptionKey": "VGhpcyBpcyBhY3R1YWxseSBhbiBhcnJheSBvZiBieXRlcy4gVGhpcyByZXF1ZXN0L3Jlc3BvbnNlIGlzIGJlaW5nIHByZXNlbnRlZCBhcyBhIHN0cmluZyBmb3IgcmVhZGFiaWxpdHkgaW4gdGhlIGV4YW1wbGU=", } } }, @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBSqlClientEncryptionKeyCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 cb08bc622465..dff07f03d8fc 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: 2026-03-15/CosmosDBSqlClientEncryptionKeyGet.json +# x-ms-original-file: 2026-04-01-preview/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 eb9890e0f1ff..848477597fc6 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: 2026-03-15/CosmosDBSqlClientEncryptionKeysList.json +# x-ms-original-file: 2026-04-01-preview/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 f330b26f79ca..44743fa5ecba 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: 2026-03-15/CosmosDBSqlContainerBackupInformation.json +# x-ms-original-file: 2026-04-01-preview/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 9d2181d0e5b3..fae910e5422a 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 @@ -53,6 +53,14 @@ def main(): }, "computedProperties": [{"name": "cp_lowerName", "query": "SELECT VALUE LOWER(c.name) FROM c"}], "conflictResolutionPolicy": {"conflictResolutionPath": "/path", "mode": "LastWriterWins"}, + "dataMaskingPolicy": { + "excludedPaths": [{"path": "/id"}], + "includedPaths": [ + {"path": "/"}, + {"length": 10, "path": "/contact/phones", "startPosition": 3, "strategy": "MaskSubstring"}, + ], + "isPolicyEnabled": True, + }, "defaultTtl": 100, "fullTextPolicy": { "defaultLanguage": "1033", @@ -115,6 +123,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBSqlContainerCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 eaacbd1b33d4..39d1798dc542 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: 2026-03-15/CosmosDBSqlContainerDelete.json +# x-ms-original-file: 2026-04-01-preview/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 274609b66de2..8bc14a0d5c5f 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: 2026-03-15/CosmosDBSqlContainerGet.json +# x-ms-original-file: 2026-04-01-preview/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 928ee396e9cb..2ebe271457bf 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: 2026-03-15/CosmosDBSqlContainerList.json +# x-ms-original-file: 2026-04-01-preview/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 c629556f7456..a43dd51f486a 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: 2026-03-15/CosmosDBSqlContainerMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 5fe4a7d92563..ddcb1325e9fb 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: 2026-03-15/CosmosDBSqlContainerMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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..49a40366f42c --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..a3bc159600ff --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..45263493d6c8 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_container_restore.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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="SUBSCRIPTION_ID", + ) + + 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/00000000-1111-2222-3333-444444444444/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": True, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/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..6818d62a1719 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 f0d155b15e07..63aefe9d08d4 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: 2026-03-15/CosmosDBSqlContainerThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 d978113a4c47..8d4fcf92e457 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: 2026-03-15/CosmosDBSqlContainerThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 caf14bf8c315..dfd608e8256d 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: 2026-03-15/CosmosDBSqlDatabaseCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 d0dc37764639..7dae7f31dfa4 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: 2026-03-15/CosmosDBSqlDatabaseDelete.json +# x-ms-original-file: 2026-04-01-preview/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 c10ad4b21b0d..7b07c298ff3d 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: 2026-03-15/CosmosDBSqlDatabaseGet.json +# x-ms-original-file: 2026-04-01-preview/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 ef526ed5af20..032a212da034 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: 2026-03-15/CosmosDBSqlDatabaseList.json +# x-ms-original-file: 2026-04-01-preview/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 5b465152f917..d88439c32ced 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: 2026-03-15/CosmosDBSqlDatabaseMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 91d20f216a62..85e9ac4878c8 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: 2026-03-15/CosmosDBSqlDatabaseMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/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..ac897353ee97 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..d5352808efc8 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..1e633285f160 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_database_restore.py @@ -0,0 +1,60 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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="SUBSCRIPTION_ID", + ) + + 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/00000000-1111-2222-3333-444444444444/providers/Microsoft.DocumentDB/locations/WestUS/restorableDatabaseAccounts/restorableDatabaseAccountId", + "restoreTimestampInUtc": "2022-07-20T18:28:00Z", + "restoreWithTtlDisabled": True, + }, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/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..2171468c968d --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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 84ff1becfc0e..37f797f97360 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: 2026-03-15/CosmosDBSqlDatabaseThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 f58187fa9e51..c651355027b1 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: 2026-03-15/CosmosDBSqlDatabaseThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBSqlDatabaseThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py index 19b445436819..160e0ebd1fe1 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_create.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceCreate.json +# x-ms-original-file: 2026-04-01-preview/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceCreate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py index c9c49417c12b..bb9c3619467a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceDelete.json +# x-ms-original-file: 2026-04-01-preview/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py index bdece63d3afc..bceb8c41ad1e 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_dedicated_gateway_service_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceGet.json +# x-ms-original-file: 2026-04-01-preview/services/sqldedicatedgateway/CosmosDBSqlDedicatedGatewayServiceGet.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..59d1e98240b4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_sql_materialized_view_create_update.py @@ -0,0 +1,74 @@ +# 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) Python 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="SUBSCRIPTION_ID", + ) + + 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", + "throughputBucketForBuild": 1, + }, + "partitionKey": {"kind": "Hash", "paths": ["/mvpk"]}, + }, + }, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/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 b299c48a1325..e38673c93e2b 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 @@ -38,14 +38,14 @@ def main(): create_update_sql_role_assignment_parameters={ "properties": { "principalId": "myPrincipalId", - "roleDefinitionId": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId", - "scope": "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", + "roleDefinitionId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/sqlRoleDefinitions/myRoleDefinitionId", + "scope": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases/colls/redmond-purchases", } }, ).result() print(response) -# x-ms-original-file: 2026-03-15/CosmosDBSqlRoleAssignmentCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 233a2b4bcf64..891d46968b32 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: 2026-03-15/CosmosDBSqlRoleAssignmentDelete.json +# x-ms-original-file: 2026-04-01-preview/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 bbfdef1decf4..85fd763edf7a 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: 2026-03-15/CosmosDBSqlRoleAssignmentGet.json +# x-ms-original-file: 2026-04-01-preview/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 fc70fbe381a1..e64328b4f3f0 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: 2026-03-15/CosmosDBSqlRoleAssignmentList.json +# x-ms-original-file: 2026-04-01-preview/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 e241073a71ce..ed0c29efc9eb 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 @@ -38,8 +38,8 @@ def main(): create_update_sql_role_definition_parameters={ "properties": { "assignableScopes": [ - "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", - "/subscriptions/mySubscriptionId/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/sales", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/myAccountName/dbs/purchases", ], "permissions": [ { @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/CosmosDBSqlRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 cc53a3fafb7e..c83e183927c1 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: 2026-03-15/CosmosDBSqlRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 01574f258256..364a81e8a03d 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: 2026-03-15/CosmosDBSqlRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/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 d23b7b6391ac..135e3a77ecc0 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: 2026-03-15/CosmosDBSqlRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/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 293b9a399558..af5059e66d7d 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: 2026-03-15/CosmosDBSqlStoredProcedureCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 7f1641a539a9..8e3cba2d7eb2 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: 2026-03-15/CosmosDBSqlStoredProcedureDelete.json +# x-ms-original-file: 2026-04-01-preview/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 3434077f3f2e..16ea19d23db4 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: 2026-03-15/CosmosDBSqlStoredProcedureGet.json +# x-ms-original-file: 2026-04-01-preview/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 d3895ea8a9db..27dc53a8c9e6 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: 2026-03-15/CosmosDBSqlStoredProcedureList.json +# x-ms-original-file: 2026-04-01-preview/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 dc35eb804d55..dfd2af7600b3 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: 2026-03-15/CosmosDBSqlTriggerCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 a33b8daf5f6d..f1a2c392c21a 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: 2026-03-15/CosmosDBSqlTriggerDelete.json +# x-ms-original-file: 2026-04-01-preview/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 5abd02baf6ab..9046e7c6e4f5 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: 2026-03-15/CosmosDBSqlTriggerGet.json +# x-ms-original-file: 2026-04-01-preview/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 9e19d383f8a0..845352f7c757 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: 2026-03-15/CosmosDBSqlTriggerList.json +# x-ms-original-file: 2026-04-01-preview/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 5fd30f1b1bb8..f10a2d5a7fe7 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: 2026-03-15/CosmosDBSqlUserDefinedFunctionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 73c02c534ec7..b3c6ce523dc0 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: 2026-03-15/CosmosDBSqlUserDefinedFunctionDelete.json +# x-ms-original-file: 2026-04-01-preview/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 b5d984d235ea..0513d7228a68 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: 2026-03-15/CosmosDBSqlUserDefinedFunctionGet.json +# x-ms-original-file: 2026-04-01-preview/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 59221ffdface..dc80ce2c688c 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: 2026-03-15/CosmosDBSqlUserDefinedFunctionList.json +# x-ms-original-file: 2026-04-01-preview/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 cb886624d545..c4ff8eab55f4 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: 2026-03-15/CosmosDBTableBackupInformation.json +# x-ms-original-file: 2026-04-01-preview/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 f5037c6848a2..d750de237cc4 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: 2026-03-15/CosmosDBTableCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/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 53c12aa516e4..f08142e6ae0f 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: 2026-03-15/CosmosDBTableDelete.json +# x-ms-original-file: 2026-04-01-preview/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 7158594e3a74..411f126e07ed 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: 2026-03-15/CosmosDBTableGet.json +# x-ms-original-file: 2026-04-01-preview/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 d1bc4dbeb399..34d5028aa386 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: 2026-03-15/CosmosDBTableList.json +# x-ms-original-file: 2026-04-01-preview/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 75ed239c337c..e8469177d5f8 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: 2026-03-15/CosmosDBTableMigrateToAutoscale.json +# x-ms-original-file: 2026-04-01-preview/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 306e2414051a..fa4a5c2bf9f4 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: 2026-03-15/CosmosDBTableMigrateToManualThroughput.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBTableMigrateToManualThroughput.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_create_update.py index ca3ae1497828..641f1ee5b331 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_create_update.py @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleAssignmentCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleAssignmentCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_delete.py index fd2f257987a4..e95480db9acd 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleAssignmentDelete.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleAssignmentDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_get.py index ae84e581b687..fdc44de12efb 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleAssignmentGet.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleAssignmentGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_list.py index f6d883ac8285..9dc4c7471b45 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_assignment_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleAssignmentList.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleAssignmentList.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_create_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_create_update.py index 92c0b592725b..1d904858d5d8 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_create_update.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_create_update.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleDefinitionCreateUpdate.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleDefinitionCreateUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_delete.py index 6f0ada7abdf2..fabb9b65e0f9 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_delete.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleDefinitionDelete.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleDefinitionDelete.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_get.py index 68e5b33dac3b..b985f0b8cf0b 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_get.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleDefinitionGet.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleDefinitionGet.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_list.py index f89747ae68d8..4e4ea6bdad8a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_list.py +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_table_role_definition_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/tablerbac/CosmosDBTableRoleDefinitionList.json +# x-ms-original-file: 2026-04-01-preview/tablerbac/CosmosDBTableRoleDefinitionList.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 a0c054e951df..f484524b85a8 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: 2026-03-15/CosmosDBTableThroughputGet.json +# x-ms-original-file: 2026-04-01-preview/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 ca4c1b81fcc3..a12eb57441c0 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: 2026-03-15/CosmosDBTableThroughputUpdate.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBTableThroughputUpdate.json if __name__ == "__main__": main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_create.py new file mode 100644 index 000000000000..3957ff63a748 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_create.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# 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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolAccountCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_delete.py new file mode 100644 index 000000000000..8823f09ca06a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + client.throughput_pool_account.begin_delete( + resource_group_name="rgName", + throughput_pool_name="tp1", + throughput_pool_account_name="db1", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolAccountDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_account_get.py new file mode 100644 index 000000000000..090d9668a8d5 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolAccountGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_accounts_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_accounts_list.py new file mode 100644 index 000000000000..fafe79bf73a7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.throughput_pool_accounts.list( + resource_group_name="rgName", + throughput_pool_name="tp1", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolAccountsList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_create.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_create.py new file mode 100644 index 000000000000..66442fb79404 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_delete.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_delete.py new file mode 100644 index 000000000000..06b5d6a30fb7 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + client.throughput_pool.begin_delete( + resource_group_name="rgName", + throughput_pool_name="tp1", + ).result() + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_get.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_get.py new file mode 100644 index 000000000000..8d6b695bffea --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.throughput_pool.get( + resource_group_name="rgName", + throughput_pool_name="tp1", + ) + print(response) + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolGet.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list.py new file mode 100644 index 000000000000..ebfe4986f85c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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="SUBSCRIPTION_ID", + ) + + response = client.throughput_pools.list() + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolList.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list_list_by_resource_group.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list_list_by_resource_group.py new file mode 100644 index 000000000000..14c785e3a496 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_list_list_by_resource_group.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) Python 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_list_by_resource_group.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="SUBSCRIPTION_ID", + ) + + response = client.throughput_pools.list_by_resource_group( + resource_group_name="rgName", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolList_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_update.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/cosmos_db_throughput_pool_update.py new file mode 100644 index 000000000000..32296ffd345a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_samples/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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.throughput_pool.begin_update( + resource_group_name="rg1", + throughput_pool_name="tp1", + ).result() + print(response) + + +# x-ms-original-file: 2026-04-01-preview/throughputPool/CosmosDBThroughputPoolUpdate.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 953e06bcaf68..fc7f718612bd 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 @@ -43,6 +43,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBPKeyRangeIdGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/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 b1d53eda63db..98c56b94d6c0 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 @@ -44,6 +44,6 @@ def main(): print(item) -# x-ms-original-file: 2026-03-15/CosmosDBPKeyRangeIdRegionGetMetrics.json +# x-ms-original-file: 2026-04-01-preview/CosmosDBPKeyRangeIdRegionGetMetrics.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..fe4ee9041b00 --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/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..2973c231513b --- /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) Python 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="SUBSCRIPTION_ID", + ) + + response = client.network_security_perimeter_configurations.list( + resource_group_name="res4410", + account_name="cosmosTest", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-04-01-preview/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..a244cd2fa66a --- /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) Python 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="SUBSCRIPTION_ID", + ) + + 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: 2026-04-01-preview/NetworkSecurityPerimeterConfigurationReconcile.json +if __name__ == "__main__": + main() 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 9235d44b3207..77df7c4fe702 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 @@ -49,6 +49,7 @@ def test_cassandra_clusters_begin_create_update(self, resource_group): "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", "extensions": ["str"], @@ -103,6 +104,7 @@ def test_cassandra_clusters_begin_update(self, resource_group): "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", "extensions": ["str"], @@ -184,6 +186,64 @@ def test_cassandra_clusters_begin_invoke_command(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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}, + ).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", + ) + 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", + ) + + # 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", + ) + 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", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_cassandra_clusters_begin_deallocate(self, resource_group): 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 eac78f73949a..9273a29c351e 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 @@ -51,6 +51,7 @@ async def test_cassandra_clusters_begin_create_update(self, resource_group): "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", "extensions": ["str"], @@ -112,6 +113,7 @@ async def test_cassandra_clusters_begin_update(self, resource_group): "cassandraVersion": "str", "clientCertificates": [{"pem": "str"}], "clusterNameOverride": "str", + "clusterType": "str", "deallocated": bool, "delegatedManagementSubnetId": "str", "extensions": ["str"], @@ -203,6 +205,72 @@ async def test_cassandra_clusters_begin_invoke_command(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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, + }, + ) + ).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", + ) + 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", + ) + + # 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", + ) + 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", + ) + + # 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): 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 dbd147c317c5..ba65ec3c3c44 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 @@ -50,6 +50,7 @@ def test_cassandra_resources_begin_update_cassandra_keyspace_throughput(self, re "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -127,6 +128,7 @@ def test_cassandra_resources_begin_update_cassandra_table_throughput(self, resou "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -172,6 +174,86 @@ def test_cassandra_resources_begin_migrate_cassandra_table_to_manual_throughput( # 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", + ) + + # 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={ + "properties": { + "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, "isDefaultBucket": bool}], + } + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ).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", + ).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", + ).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_keyspace(self, resource_group): @@ -313,6 +395,74 @@ def test_cassandra_resources_list_cassandra_tables(self, resource_group): # 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", + ) + + # 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={ + "properties": { + "resource": {"id": "str", "viewDefinition": "str"}, + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 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", + }, + ).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", + ).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", + ) + 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_role_definition(self, resource_group): 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 b3453f6ebd03..62e960f05cd5 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 @@ -52,6 +52,7 @@ async def test_cassandra_resources_begin_update_cassandra_keyspace_throughput(se "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -135,6 +136,7 @@ async def test_cassandra_resources_begin_update_cassandra_table_throughput(self, "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -185,6 +187,92 @@ async def test_cassandra_resources_begin_migrate_cassandra_table_to_manual_throu # 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", + ) + + # 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={ + "properties": { + "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, "isDefaultBucket": bool}], + } + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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", + ) + ).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", + ) + ).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_keyspace(self, resource_group): @@ -334,6 +422,78 @@ async def test_cassandra_resources_list_cassandra_tables(self, resource_group): # 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", + ) + + # 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={ + "properties": { + "resource": {"id": "str", "viewDefinition": "str"}, + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 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", + }, + ) + ).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", + ) + ).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", + ) + 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_role_definition(self, resource_group): 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 new file mode 100644 index 000000000000..50d939d034ac --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations.py @@ -0,0 +1,74 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementChaosFaultOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + chaos_fault="str", + chaos_fault_request={ + "id": "str", + "name": "str", + "properties": { + "action": "str", + "containerName": "str", + "databaseName": "str", + "provisioningState": "str", + "region": "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", + }, + ).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_chaos_fault_list(self, resource_group): + response = self.client.chaos_fault.list( + resource_group_name=resource_group.name, + account_name="str", + ) + 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_chaos_fault_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py new file mode 100644 index 000000000000..ccb1d68c9e34 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_chaos_fault_operations_async.py @@ -0,0 +1,77 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementChaosFaultOperationsAsync(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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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, + account_name="str", + chaos_fault="str", + chaos_fault_request={ + "id": "str", + "name": "str", + "properties": { + "action": "str", + "containerName": "str", + "databaseName": "str", + "provisioningState": "str", + "region": "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", + }, + ) + ).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_chaos_fault_list(self, resource_group): + response = self.client.chaos_fault.list( + resource_group_name=resource_group.name, + account_name="str", + ) + 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_copy_jobs_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations.py new file mode 100644 index 000000000000..1cc14576fe6a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementCopyJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_get(self, resource_group): + response = self.client.copy_jobs.get( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_create(self, resource_group): + response = self.client.copy_jobs.create( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + job_create_parameters={ + "properties": { + "jobProperties": "base_copy_job_properties", + "duration": "str", + "error": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + }, + "lastUpdatedUtcTime": "2020-02-20 00:00:00", + "mode": "str", + "processedCount": 0, + "status": "str", + "totalCount": 0, + "workerCount": 0, + }, + "id": "str", + "name": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_list_by_database_account(self, resource_group): + response = self.client.copy_jobs.list_by_database_account( + resource_group_name=resource_group.name, + account_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_pause(self, resource_group): + response = self.client.copy_jobs.pause( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_resume(self, resource_group): + response = self.client.copy_jobs.resume( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_cancel(self, resource_group): + response = self.client.copy_jobs.cancel( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_copy_jobs_complete(self, resource_group): + response = self.client.copy_jobs.complete( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations_async.py new file mode 100644 index 000000000000..add13b11086e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_copy_jobs_operations_async.py @@ -0,0 +1,135 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementCopyJobsOperationsAsync(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_copy_jobs_get(self, resource_group): + response = await self.client.copy_jobs.get( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_copy_jobs_create(self, resource_group): + response = await self.client.copy_jobs.create( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + job_create_parameters={ + "properties": { + "jobProperties": "base_copy_job_properties", + "duration": "str", + "error": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + }, + "lastUpdatedUtcTime": "2020-02-20 00:00:00", + "mode": "str", + "processedCount": 0, + "status": "str", + "totalCount": 0, + "workerCount": 0, + }, + "id": "str", + "name": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_copy_jobs_list_by_database_account(self, resource_group): + response = self.client.copy_jobs.list_by_database_account( + resource_group_name=resource_group.name, + account_name="str", + ) + 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_copy_jobs_pause(self, resource_group): + response = await self.client.copy_jobs.pause( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_copy_jobs_resume(self, resource_group): + response = await self.client.copy_jobs.resume( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_copy_jobs_cancel(self, resource_group): + response = await self.client.copy_jobs.cancel( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_copy_jobs_complete(self, resource_group): + response = await self.client.copy_jobs.complete( + resource_group_name=resource_group.name, + account_name="str", + job_name="str", + ) + + # 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 new file mode 100644 index 000000000000..14c0707e6879 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementDataTransferJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + job_name="str", + job_create_parameters={ + "properties": { + "destination": "data_transfer_data_source_sink", + "source": "data_transfer_data_source_sink", + "duration": "str", + "error": {"code": "str", "message": "str"}, + "jobName": "str", + "lastUpdatedUtcTime": "2020-02-20 00:00:00", + "mode": "str", + "processedCount": 0, + "status": "str", + "totalCount": 0, + "workerCount": 0, + }, + "id": "str", + "name": "str", + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # 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 new file mode 100644 index 000000000000..120a0212ae2a --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_data_transfer_jobs_operations_async.py @@ -0,0 +1,121 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementDataTransferJobsOperationsAsync(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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + job_name="str", + job_create_parameters={ + "properties": { + "destination": "data_transfer_data_source_sink", + "source": "data_transfer_data_source_sink", + "duration": "str", + "error": {"code": "str", "message": "str"}, + "jobName": "str", + "lastUpdatedUtcTime": "2020-02-20 00:00:00", + "mode": "str", + "processedCount": 0, + "status": "str", + "totalCount": 0, + "workerCount": 0, + }, + "id": "str", + "name": "str", + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + 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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + + # 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 ed0d61040f27..060026f3fa91 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 @@ -53,6 +53,7 @@ def test_database_accounts_begin_create_or_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -72,13 +73,16 @@ def test_database_accounts_begin_create_or_update(self, resource_group): "customerManagedKeyStatus": "str", "defaultIdentity": "str", "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, + "enableAllVersionsAndDeletesChangeFeed": bool, "enableAnalyticalStorage": bool, "enableAutomaticFailover": bool, "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, @@ -88,10 +92,22 @@ def test_database_accounts_begin_create_or_update(self, resource_group): "isVirtualNetworkFilterEnabled": bool, "keyVaultKeyUri": "str", "keysMetadata": { - "primaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "primaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, + "primaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "primaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, }, "minimalTlsVersion": "str", "networkAclBypass": "str", @@ -107,6 +123,11 @@ def test_database_accounts_begin_create_or_update(self, resource_group): "sourceBackupLocation": "str", "tablesToRestore": ["str"], }, + "softDeleteConfiguration": { + "minMinutesBeforePermanentDeletionAllowed": 0, + "softDeleteRetentionPeriodInMinutes": 0, + "softDeletionEnabled": bool, + }, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, "id": "str", @@ -147,6 +168,7 @@ def test_database_accounts_begin_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -165,13 +187,16 @@ def test_database_accounts_begin_update(self, resource_group): "customerManagedKeyStatus": "str", "defaultIdentity": "str", "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, + "enableAllVersionsAndDeletesChangeFeed": bool, "enableAnalyticalStorage": bool, "enableAutomaticFailover": bool, "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, @@ -181,10 +206,22 @@ def test_database_accounts_begin_update(self, resource_group): "isVirtualNetworkFilterEnabled": bool, "keyVaultKeyUri": "str", "keysMetadata": { - "primaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "primaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, + "primaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "primaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, }, "locations": [ { @@ -200,6 +237,11 @@ def test_database_accounts_begin_update(self, resource_group): "networkAclBypass": "str", "networkAclBypassResourceIds": ["str"], "publicNetworkAccess": "str", + "softDeleteConfiguration": { + "minMinutesBeforePermanentDeletionAllowed": 0, + "softDeleteRetentionPeriodInMinutes": 0, + "softDeletionEnabled": bool, + }, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, "tags": {"str": "str"}, @@ -324,7 +366,7 @@ 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"}, + key_to_regenerate={"keyKind": "str", "skipAccountKeysLastUsageCheck": bool}, ).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_database_accounts_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_database_accounts_operations_async.py index 02566ee74321..6bf9e0066f0d 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 @@ -55,6 +55,7 @@ async def test_database_accounts_begin_create_or_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -74,13 +75,16 @@ async def test_database_accounts_begin_create_or_update(self, resource_group): "customerManagedKeyStatus": "str", "defaultIdentity": "str", "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, + "enableAllVersionsAndDeletesChangeFeed": bool, "enableAnalyticalStorage": bool, "enableAutomaticFailover": bool, "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, @@ -90,10 +94,22 @@ async def test_database_accounts_begin_create_or_update(self, resource_group): "isVirtualNetworkFilterEnabled": bool, "keyVaultKeyUri": "str", "keysMetadata": { - "primaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "primaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, + "primaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "primaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, }, "minimalTlsVersion": "str", "networkAclBypass": "str", @@ -109,6 +125,11 @@ async def test_database_accounts_begin_create_or_update(self, resource_group): "sourceBackupLocation": "str", "tablesToRestore": ["str"], }, + "softDeleteConfiguration": { + "minMinutesBeforePermanentDeletionAllowed": 0, + "softDeleteRetentionPeriodInMinutes": 0, + "softDeletionEnabled": bool, + }, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, "id": "str", @@ -151,6 +172,7 @@ async def test_database_accounts_begin_update(self, resource_group): "backupPolicy": "backup_policy", "capabilities": [{"name": "str"}], "capacity": {"totalThroughputLimit": 0}, + "capacityMode": "str", "connectorOffer": "str", "consistencyPolicy": { "defaultConsistencyLevel": "str", @@ -169,13 +191,16 @@ async def test_database_accounts_begin_update(self, resource_group): "customerManagedKeyStatus": "str", "defaultIdentity": "str", "defaultPriorityLevel": "str", + "diagnosticLogSettings": {"enableFullTextQuery": "str"}, "disableKeyBasedMetadataWriteAccess": bool, "disableLocalAuth": bool, + "enableAllVersionsAndDeletesChangeFeed": bool, "enableAnalyticalStorage": bool, "enableAutomaticFailover": bool, "enableBurstCapacity": bool, "enableCassandraConnector": bool, "enableFreeTier": bool, + "enableMaterializedViews": bool, "enableMultipleWriteLocations": bool, "enablePartitionMerge": bool, "enablePerRegionPerPartitionAutoscale": bool, @@ -185,10 +210,22 @@ async def test_database_accounts_begin_update(self, resource_group): "isVirtualNetworkFilterEnabled": bool, "keyVaultKeyUri": "str", "keysMetadata": { - "primaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "primaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryMasterKey": {"generationTime": "2020-02-20 00:00:00"}, - "secondaryReadonlyMasterKey": {"generationTime": "2020-02-20 00:00:00"}, + "primaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "primaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, + "secondaryReadonlyMasterKey": { + "approximateLastUsageTime": "2020-02-20 00:00:00", + "generationTime": "2020-02-20 00:00:00", + }, }, "locations": [ { @@ -204,6 +241,11 @@ async def test_database_accounts_begin_update(self, resource_group): "networkAclBypass": "str", "networkAclBypassResourceIds": ["str"], "publicNetworkAccess": "str", + "softDeleteConfiguration": { + "minMinutesBeforePermanentDeletionAllowed": 0, + "softDeleteRetentionPeriodInMinutes": 0, + "softDeletionEnabled": bool, + }, "virtualNetworkRules": [{"id": "str", "ignoreMissingVNetServiceEndpoint": bool}], }, "tags": {"str": "str"}, @@ -338,7 +380,7 @@ async def test_database_accounts_begin_regenerate_key(self, resource_group): await self.client.database_accounts.begin_regenerate_key( resource_group_name=resource_group.name, account_name="str", - key_to_regenerate={"keyKind": "str"}, + key_to_regenerate={"keyKind": "str", "skipAccountKeysLastUsageCheck": bool}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations.py new file mode 100644 index 000000000000..ac3417b05c06 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations.py @@ -0,0 +1,80 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementFleetAnalyticsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fleet_analytics_get(self, resource_group): + response = self.client.fleet_analytics.get( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fleet_analytics_create(self, resource_group): + response = self.client.fleet_analytics.create( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + body={ + "id": "str", + "name": "str", + "properties": {"provisioningState": "str", "storageLocationType": "str", "storageLocationUri": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fleet_analytics_begin_delete(self, resource_group): + response = self.client.fleet_analytics.begin_delete( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + ).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_fleet_analytics_list(self, resource_group): + response = self.client.fleet_analytics.list( + resource_group_name=resource_group.name, + fleet_name="str", + ) + 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_fleet_analytics_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations_async.py new file mode 100644 index 000000000000..b4026dc69e2c --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_fleet_analytics_operations_async.py @@ -0,0 +1,83 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementFleetAnalyticsOperationsAsync(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_fleet_analytics_get(self, resource_group): + response = await self.client.fleet_analytics.get( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fleet_analytics_create(self, resource_group): + response = await self.client.fleet_analytics.create( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + body={ + "id": "str", + "name": "str", + "properties": {"provisioningState": "str", "storageLocationType": "str", "storageLocationUri": "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", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_fleet_analytics_begin_delete(self, resource_group): + response = await ( + await self.client.fleet_analytics.begin_delete( + resource_group_name=resource_group.name, + fleet_name="str", + fleet_analytics_name="str", + ) + ).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_fleet_analytics_list(self, resource_group): + response = self.client.fleet_analytics.list( + resource_group_name=resource_group.name, + fleet_name="str", + ) + 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_garnet_clusters_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations.py new file mode 100644 index 000000000000..cf8d516870aa --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations.py @@ -0,0 +1,126 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementGarnetClustersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_garnet_clusters_get(self, resource_group): + response = self.client.garnet_clusters.get( + resource_group_name=resource_group.name, + cluster_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_garnet_clusters_begin_create_update(self, resource_group): + response = self.client.garnet_clusters.begin_create_update( + resource_group_name=resource_group.name, + cluster_name="str", + body={ + "location": "str", + "id": "str", + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "name": "str", + "properties": { + "allocationState": "str", + "authenticationMethod": "str", + "availabilityZone": bool, + "clusterType": "str", + "endPoints": [{"ipAddress": "str", "port": 0}], + "extensions": ["str"], + "nodeSku": "str", + "persistence": bool, + "provisionError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "provisioningState": "str", + "replicationFactor": 0, + "shardCount": 0, + "subnetId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).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_garnet_clusters_begin_update(self, resource_group): + response = self.client.garnet_clusters.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + body={ + "properties": { + "authenticationMethod": "str", + "clusterType": "str", + "extensions": ["str"], + "persistence": bool, + } + }, + ).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_garnet_clusters_begin_delete(self, resource_group): + response = self.client.garnet_clusters.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + ).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_garnet_clusters_list_by_resource_group(self, resource_group): + response = self.client.garnet_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_garnet_clusters_list_by_subscription(self, resource_group): + response = self.client.garnet_clusters.list_by_subscription() + 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_garnet_clusters_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations_async.py new file mode 100644 index 000000000000..b8f20ba6b39f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_garnet_clusters_operations_async.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementGarnetClustersOperationsAsync(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_garnet_clusters_get(self, resource_group): + response = await self.client.garnet_clusters.get( + resource_group_name=resource_group.name, + cluster_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_garnet_clusters_begin_create_update(self, resource_group): + response = await ( + await self.client.garnet_clusters.begin_create_update( + resource_group_name=resource_group.name, + cluster_name="str", + body={ + "location": "str", + "id": "str", + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "name": "str", + "properties": { + "allocationState": "str", + "authenticationMethod": "str", + "availabilityZone": bool, + "clusterType": "str", + "endPoints": [{"ipAddress": "str", "port": 0}], + "extensions": ["str"], + "nodeSku": "str", + "persistence": bool, + "provisionError": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "provisioningState": "str", + "replicationFactor": 0, + "shardCount": 0, + "subnetId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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_garnet_clusters_begin_update(self, resource_group): + response = await ( + await self.client.garnet_clusters.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + body={ + "properties": { + "authenticationMethod": "str", + "clusterType": "str", + "extensions": ["str"], + "persistence": bool, + } + }, + ) + ).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_garnet_clusters_begin_delete(self, resource_group): + response = await ( + await self.client.garnet_clusters.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + ) + ).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_garnet_clusters_list_by_resource_group(self, resource_group): + response = self.client.garnet_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + 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_garnet_clusters_list_by_subscription(self, resource_group): + response = self.client.garnet_clusters.list_by_subscription() + 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 new file mode 100644 index 000000000000..2319864e8e3f --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations.py @@ -0,0 +1,83 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementGraphResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + graph_name="str", + create_update_graph_parameters={ + "properties": { + "resource": {"id": "str"}, + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 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", + }, + ).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_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", + ).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_graph_resources_list_graphs(self, resource_group): + response = self.client.graph_resources.list_graphs( + resource_group_name=resource_group.name, + account_name="str", + ) + 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_graph_resources_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py new file mode 100644 index 000000000000..cf4736c0d655 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_graph_resources_operations_async.py @@ -0,0 +1,88 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementGraphResourcesOperationsAsync(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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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, + account_name="str", + graph_name="str", + create_update_graph_parameters={ + "properties": { + "resource": {"id": "str"}, + "options": {"autoscaleSettings": {"maxThroughput": 0}, "throughput": 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", + }, + ) + ).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_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", + ) + ).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_graph_resources_list_graphs(self, resource_group): + response = self.client.graph_resources.list_graphs( + resource_group_name=resource_group.name, + account_name="str", + ) + 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_gremlin_resources_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_gremlin_resources_operations.py index c215e8923adf..2f52d576ee84 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 @@ -50,6 +50,7 @@ def test_gremlin_resources_begin_update_gremlin_database_throughput(self, resour "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -127,6 +128,7 @@ def test_gremlin_resources_begin_update_gremlin_graph_throughput(self, resource_ "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", 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 8a46753a947f..5f7722e7e30d 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 @@ -52,6 +52,7 @@ async def test_gremlin_resources_begin_update_gremlin_database_throughput(self, "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -135,6 +136,7 @@ async def test_gremlin_resources_begin_update_gremlin_graph_throughput(self, res "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", 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 36d2ec62ccb9..f103b49f903a 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 @@ -50,6 +50,7 @@ def test_mongo_db_resources_begin_update_mongo_db_database_throughput(self, reso "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -93,6 +94,68 @@ def test_mongo_db_resources_begin_migrate_mongo_db_database_to_manual_throughput # 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={ + "properties": {"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", + }, + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ).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_get_mongo_db_collection_throughput(self, resource_group): @@ -127,6 +190,71 @@ def test_mongo_db_resources_begin_update_mongo_db_collection_throughput(self, re "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], + } + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ).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_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={ + "properties": {"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", + }, + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "throughputPolicy": "str", } }, "id": "str", @@ -244,6 +372,19 @@ def test_mongo_db_resources_list_mongo_db_databases(self, resource_group): # 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}, + ).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_get_mongo_db_collection(self, resource_group): @@ -323,6 +464,20 @@ def test_mongo_db_resources_list_mongo_db_collections(self, resource_group): # 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}, + ).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_retrieve_continuous_backup_information(self, resource_group): 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 f3fe0649378c..66fd5dce8e31 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 @@ -52,6 +52,7 @@ async def test_mongo_db_resources_begin_update_mongo_db_database_throughput(self "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -100,6 +101,72 @@ async def test_mongo_db_resources_begin_migrate_mongo_db_database_to_manual_thro # 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={ + "properties": {"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", + }, + ) + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ) + ).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): @@ -135,6 +202,75 @@ async def test_mongo_db_resources_begin_update_mongo_db_collection_throughput(se "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], + } + }, + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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_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={ + "properties": {"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", + }, + ) + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "throughputPolicy": "str", } }, "id": "str", @@ -261,6 +397,21 @@ async def test_mongo_db_resources_list_mongo_db_databases(self, resource_group): # 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}, + ) + ).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(self, resource_group): @@ -346,6 +497,22 @@ async def test_mongo_db_resources_list_mongo_db_collections(self, resource_group # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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}, + ) + ).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_retrieve_continuous_backup_information(self, resource_group): 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 new file mode 100644 index 000000000000..a1027b050b73 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations.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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementNetworkSecurityPerimeterConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ).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 new file mode 100644 index 000000000000..f7866b14eb7e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_network_security_perimeter_configurations_operations_async.py @@ -0,0 +1,57 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementNetworkSecurityPerimeterConfigurationsOperationsAsync(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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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", + ) + 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_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", + ) + ).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_soft_deleted_database_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations.py new file mode 100644 index 000000000000..f9e2474df9dc --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations.py @@ -0,0 +1,76 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedDatabaseAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_database_accounts_get(self, resource_group): + response = self.client.soft_deleted_database_accounts.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_database_accounts_list_by_location(self, resource_group): + response = self.client.soft_deleted_database_accounts.list_by_location( + location="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_database_accounts_list_by_resource_group_and_location(self, resource_group): + response = self.client.soft_deleted_database_accounts.list_by_resource_group_and_location( + resource_group_name=resource_group.name, + location="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_database_accounts_begin_restore(self, resource_group): + response = self.client.soft_deleted_database_accounts.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ).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_soft_deleted_database_accounts_begin_purge(self, resource_group): + response = self.client.soft_deleted_database_accounts.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ).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_soft_deleted_database_accounts_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations_async.py new file mode 100644 index 000000000000..04547021b1b2 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_database_accounts_operations_async.py @@ -0,0 +1,81 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedDatabaseAccountsOperationsAsync(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_soft_deleted_database_accounts_get(self, resource_group): + response = await self.client.soft_deleted_database_accounts.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_database_accounts_list_by_location(self, resource_group): + response = await self.client.soft_deleted_database_accounts.list_by_location( + location="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_database_accounts_list_by_resource_group_and_location(self, resource_group): + response = await self.client.soft_deleted_database_accounts.list_by_resource_group_and_location( + resource_group_name=resource_group.name, + location="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_database_accounts_begin_restore(self, resource_group): + response = await ( + await self.client.soft_deleted_database_accounts.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + ).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_soft_deleted_database_accounts_begin_purge(self, resource_group): + response = await ( + await self.client.soft_deleted_database_accounts.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + ).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_soft_deleted_sql_containers_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations.py new file mode 100644 index 000000000000..13ccf219dd54 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations.py @@ -0,0 +1,74 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedSqlContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_containers_get(self, resource_group): + response = self.client.soft_deleted_sql_containers.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_containers_list(self, resource_group): + response = self.client.soft_deleted_sql_containers.list( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_containers_begin_restore(self, resource_group): + response = self.client.soft_deleted_sql_containers.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ).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_soft_deleted_sql_containers_begin_purge(self, resource_group): + response = self.client.soft_deleted_sql_containers.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ).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_soft_deleted_sql_containers_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations_async.py new file mode 100644 index 000000000000..4a3e7822d405 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_containers_operations_async.py @@ -0,0 +1,79 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedSqlContainersOperationsAsync(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_soft_deleted_sql_containers_get(self, resource_group): + response = await self.client.soft_deleted_sql_containers.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_sql_containers_list(self, resource_group): + response = await self.client.soft_deleted_sql_containers.list( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_sql_containers_begin_restore(self, resource_group): + response = await ( + await self.client.soft_deleted_sql_containers.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ) + ).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_soft_deleted_sql_containers_begin_purge(self, resource_group): + response = await ( + await self.client.soft_deleted_sql_containers.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + container_name="str", + ) + ).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_soft_deleted_sql_databases_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations.py new file mode 100644 index 000000000000..48a80e3092a4 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations.py @@ -0,0 +1,70 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedSqlDatabasesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_databases_get(self, resource_group): + response = self.client.soft_deleted_sql_databases.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_databases_list(self, resource_group): + response = self.client.soft_deleted_sql_databases.list( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_soft_deleted_sql_databases_begin_restore(self, resource_group): + response = self.client.soft_deleted_sql_databases.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ).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_soft_deleted_sql_databases_begin_purge(self, resource_group): + response = self.client.soft_deleted_sql_databases.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ).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_soft_deleted_sql_databases_operations_async.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations_async.py new file mode 100644 index 000000000000..ccef8823e459 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_soft_deleted_sql_databases_operations_async.py @@ -0,0 +1,75 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementSoftDeletedSqlDatabasesOperationsAsync(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_soft_deleted_sql_databases_get(self, resource_group): + response = await self.client.soft_deleted_sql_databases.get( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_sql_databases_list(self, resource_group): + response = await self.client.soft_deleted_sql_databases.list( + resource_group_name=resource_group.name, + location="str", + account_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_soft_deleted_sql_databases_begin_restore(self, resource_group): + response = await ( + await self.client.soft_deleted_sql_databases.begin_restore( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + ).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_soft_deleted_sql_databases_begin_purge(self, resource_group): + response = await ( + await self.client.soft_deleted_sql_databases.begin_purge( + resource_group_name=resource_group.name, + location="str", + account_name="str", + database_name="str", + ) + ).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.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_sql_resources_operations.py index 713761e4d25b..94ad3c15dfd3 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 @@ -90,6 +90,19 @@ def test_sql_resources_list_sql_databases(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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}, + ).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_database_throughput(self, resource_group): @@ -122,6 +135,7 @@ def test_sql_resources_begin_update_sql_database_throughput(self, resource_group "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -165,6 +179,68 @@ def test_sql_resources_begin_migrate_sql_database_to_manual_throughput(self, res # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + retrieve_throughput_parameters={ + "properties": {"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", + }, + ).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_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", + redistribute_throughput_parameters={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ).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): @@ -199,6 +275,7 @@ def test_sql_resources_begin_update_sql_container_throughput(self, resource_grou "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -244,6 +321,70 @@ def test_sql_resources_begin_migrate_sql_container_to_manual_throughput(self, re # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + container_name="str", + retrieve_throughput_parameters={ + "properties": {"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", + }, + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ).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_client_encryption_key(self, resource_group): @@ -336,6 +477,11 @@ def test_sql_resources_begin_create_update_sql_container(self, resource_group): "mode": "str", }, "createMode": "str", + "dataMaskingPolicy": { + "excludedPaths": [{"path": "str"}], + "includedPaths": [{"path": "str", "length": 0, "startPosition": 0, "strategy": "str"}], + "isPolicyEnabled": bool, + }, "defaultTtl": 0, "fullTextPolicy": { "defaultLanguage": "str", @@ -361,6 +507,14 @@ def test_sql_resources_begin_create_update_sql_container(self, resource_group): } ], }, + "materializedViewDefinition": { + "definition": "str", + "sourceCollectionId": "str", + "sourceCollectionRid": "str", + "throughputBucketForBuild": 0, + }, + "materializedViews": [{"_rid": "str", "id": "str"}], + "materializedViewsProperties": {"throughputBucketForBuild": 0}, "partitionKey": {"kind": "str", "paths": ["str"], "systemKey": bool, "version": 0}, "restoreParameters": { "restoreSource": "str", @@ -418,6 +572,20 @@ def test_sql_resources_list_sql_containers(self, resource_group): # 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}, + ).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_retrieve_continuous_backup_information(self, resource_group): 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 5049e2d78ebb..fa7b8fa85179 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 @@ -95,6 +95,21 @@ async def test_sql_resources_list_sql_databases(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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}, + ) + ).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_database_throughput(self, resource_group): @@ -128,6 +143,7 @@ async def test_sql_resources_begin_update_sql_database_throughput(self, resource "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -176,6 +192,72 @@ async def test_sql_resources_begin_migrate_sql_database_to_manual_throughput(sel # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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={ + "properties": {"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", + }, + ) + ).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_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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ) + ).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): @@ -211,6 +293,7 @@ async def test_sql_resources_begin_update_sql_container_throughput(self, resourc "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", @@ -261,6 +344,74 @@ async def test_sql_resources_begin_migrate_sql_container_to_manual_throughput(se # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_sql_resources_begin_sql_container_retrieve_throughput_distribution(self, resource_group): + response = await ( + await self.client.sql_resources.begin_sql_container_retrieve_throughput_distribution( + resource_group_name=resource_group.name, + account_name="str", + database_name="str", + container_name="str", + retrieve_throughput_parameters={ + "properties": {"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", + }, + ) + ).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={ + "properties": { + "resource": { + "sourcePhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "throughput": 0.0} + ], + "targetPhysicalPartitionThroughputInfo": [ + {"id": "str", "targetThroughput": 0.0, "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", + }, + ) + ).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_client_encryption_key(self, resource_group): @@ -356,6 +507,11 @@ async def test_sql_resources_begin_create_update_sql_container(self, resource_gr "mode": "str", }, "createMode": "str", + "dataMaskingPolicy": { + "excludedPaths": [{"path": "str"}], + "includedPaths": [{"path": "str", "length": 0, "startPosition": 0, "strategy": "str"}], + "isPolicyEnabled": bool, + }, "defaultTtl": 0, "fullTextPolicy": { "defaultLanguage": "str", @@ -381,6 +537,14 @@ async def test_sql_resources_begin_create_update_sql_container(self, resource_gr } ], }, + "materializedViewDefinition": { + "definition": "str", + "sourceCollectionId": "str", + "sourceCollectionRid": "str", + "throughputBucketForBuild": 0, + }, + "materializedViews": [{"_rid": "str", "id": "str"}], + "materializedViewsProperties": {"throughputBucketForBuild": 0}, "partitionKey": {"kind": "str", "paths": ["str"], "systemKey": bool, "version": 0}, "restoreParameters": { "restoreSource": "str", @@ -441,6 +605,22 @@ async def test_sql_resources_list_sql_containers(self, resource_group): # 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}, + ) + ).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_retrieve_continuous_backup_information(self, resource_group): 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 9722baeca8e2..6b8752f7b695 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 @@ -50,6 +50,7 @@ def test_table_resources_begin_update_table_throughput(self, resource_group): "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", 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 86a70bc52b67..03e0283f1a3c 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 @@ -52,6 +52,7 @@ async def test_table_resources_begin_update_table_throughput(self, resource_grou "offerReplacePending": "str", "softAllowedMaximumThroughput": "str", "throughput": 0, + "throughputBuckets": [{"id": 0, "maxThroughputPercentage": 0, "isDefaultBucket": bool}], } }, "id": "str", 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 new file mode 100644 index 000000000000..33ffefc4d55d --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations.py @@ -0,0 +1,74 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolAccountOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + throughput_pool_account_name="str", + body={ + "id": "str", + "name": "str", + "properties": { + "accountInstanceId": "str", + "accountLocation": "str", + "accountResourceIdentifier": "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", + }, + ).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_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", + ).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 new file mode 100644 index 000000000000..88f860ea6ecf --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_account_operations_async.py @@ -0,0 +1,79 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolAccountOperationsAsync(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_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", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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, + throughput_pool_name="str", + throughput_pool_account_name="str", + body={ + "id": "str", + "name": "str", + "properties": { + "accountInstanceId": "str", + "accountLocation": "str", + "accountResourceIdentifier": "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", + }, + ) + ).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_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", + ) + ).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_accounts_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py new file mode 100644 index 000000000000..2fb5d4c1d796 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations.py @@ -0,0 +1,30 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolAccountsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + ) + 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 new file mode 100644 index 000000000000..4ff256c8ce00 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_accounts_operations_async.py @@ -0,0 +1,31 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolAccountsOperationsAsync(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_pool_accounts_list(self, resource_group): + response = self.client.throughput_pool_accounts.list( + resource_group_name=resource_group.name, + throughput_pool_name="str", + ) + 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 new file mode 100644 index 000000000000..6348b2d74776 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations.py @@ -0,0 +1,79 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CosmosDBManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_throughput_pool_get(self, resource_group): + response = self.client.throughput_pool.get( + resource_group_name=resource_group.name, + throughput_pool_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": {"maxThroughput": 0, "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", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ).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_throughput_pool_begin_update(self, resource_group): + response = self.client.throughput_pool.begin_update( + resource_group_name=resource_group.name, + throughput_pool_name="str", + ).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_throughput_pool_begin_delete(self, resource_group): + response = self.client.throughput_pool.begin_delete( + resource_group_name=resource_group.name, + throughput_pool_name="str", + ).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 new file mode 100644 index 000000000000..faaaf5c24e5e --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pool_operations_async.py @@ -0,0 +1,86 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +class TestCosmosDBManagementThroughputPoolOperationsAsync(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_pool_get(self, resource_group): + response = await self.client.throughput_pool.get( + resource_group_name=resource_group.name, + throughput_pool_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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, + throughput_pool_name="str", + body={ + "location": "str", + "id": "str", + "name": "str", + "properties": {"maxThroughput": 0, "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", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).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_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", + ) + ).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_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", + ) + ).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_pools_operations.py b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py new file mode 100644 index 000000000000..3965b078c3a3 --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations.py @@ -0,0 +1,37 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +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_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] + # please add some check logic here by yourself + # ... + + @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] + # 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 new file mode 100644 index 000000000000..63c3e3212dfd --- /dev/null +++ b/sdk/cosmos/azure-mgmt-cosmosdb/generated_tests/test_cosmos_db_management_throughput_pools_operations_async.py @@ -0,0 +1,38 @@ +# 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) Python 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.skip("you may need to update the auto-generated test case before run it") +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_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] + # please add some check logic here by yourself + # ... + + @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] + # please add some check logic here by yourself + # ... diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml b/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml index 40081be0f75e..856c73a5272a 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml +++ b/sdk/cosmos/azure-mgmt-cosmosdb/pyproject.toml @@ -13,7 +13,7 @@ authors = [ description = "Microsoft Azure Cosmosdb Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -79,7 +79,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/tsp-location.yaml b/sdk/cosmos/azure-mgmt-cosmosdb/tsp-location.yaml index 587583d9e183..491733fb4302 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/tsp-location.yaml +++ b/sdk/cosmos/azure-mgmt-cosmosdb/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/DocumentDB -commit: 9ee5902c9557817bc4a859ebc13f757515aac5d7 +commit: 9f5271b1ab4f354780443f12755bd097f148f9bc repo: Azure/azure-rest-api-specs additionalDirectories: From 32c6442b79575611eae204e7ce6b2bd8a1b7ac91 Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Fri, 21 Aug 2026 11:01:19 +0800 Subject: [PATCH 2/2] update Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md | 50 ++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md index 82a42833826c..b9a61844e929 100644 --- a/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md +++ b/sdk/cosmos/azure-mgmt-cosmosdb/CHANGELOG.md @@ -190,31 +190,31 @@ - Added model `ThroughputPoolProperties` - Added model `ThroughputPoolResource` - Added model `ThroughputPoolUpdate` - - Model `CassandraClustersOperations` added method `begin_invoke_command_async` - - Model `CassandraClustersOperations` added method `get_backup` - - Model `CassandraClustersOperations` added method `get_command_async` - - Model `CassandraClustersOperations` added method `list_backups` - - Model `CassandraClustersOperations` added method `list_command` - - Model `CassandraResourcesOperations` added method `begin_create_update_cassandra_view` - - Model `CassandraResourcesOperations` added method `begin_delete_cassandra_view` - - Model `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_autoscale` - - Model `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_manual_throughput` - - Model `CassandraResourcesOperations` added method `begin_update_cassandra_view_throughput` - - Model `CassandraResourcesOperations` added method `get_cassandra_view` - - Model `CassandraResourcesOperations` added method `get_cassandra_view_throughput` - - Model `CassandraResourcesOperations` added method `list_cassandra_views` - - Model `MongoDBResourcesOperations` added method `begin_list_mongo_db_collection_partition_merge` - - Model `MongoDBResourcesOperations` added method `begin_mongo_db_container_redistribute_throughput` - - Model `MongoDBResourcesOperations` added method `begin_mongo_db_container_retrieve_throughput_distribution` - - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_partition_merge` - - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_redistribute_throughput` - - Model `MongoDBResourcesOperations` added method `begin_mongo_db_database_retrieve_throughput_distribution` - - Model `SqlResourcesOperations` added method `begin_list_sql_container_partition_merge` - - Model `SqlResourcesOperations` added method `begin_sql_container_redistribute_throughput` - - Model `SqlResourcesOperations` added method `begin_sql_container_retrieve_throughput_distribution` - - Model `SqlResourcesOperations` added method `begin_sql_database_partition_merge` - - Model `SqlResourcesOperations` added method `begin_sql_database_redistribute_throughput` - - Model `SqlResourcesOperations` added method `begin_sql_database_retrieve_throughput_distribution` + - Operation group `CassandraClustersOperations` added method `begin_invoke_command_async` + - Operation group `CassandraClustersOperations` added method `get_backup` + - Operation group `CassandraClustersOperations` added method `get_command_async` + - Operation group `CassandraClustersOperations` added method `list_backups` + - Operation group `CassandraClustersOperations` added method `list_command` + - Operation group `CassandraResourcesOperations` added method `begin_create_update_cassandra_view` + - Operation group `CassandraResourcesOperations` added method `begin_delete_cassandra_view` + - Operation group `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_autoscale` + - Operation group `CassandraResourcesOperations` added method `begin_migrate_cassandra_view_to_manual_throughput` + - Operation group `CassandraResourcesOperations` added method `begin_update_cassandra_view_throughput` + - Operation group `CassandraResourcesOperations` added method `get_cassandra_view` + - Operation group `CassandraResourcesOperations` added method `get_cassandra_view_throughput` + - Operation group `CassandraResourcesOperations` added method `list_cassandra_views` + - Operation group `MongoDBResourcesOperations` added method `begin_list_mongo_db_collection_partition_merge` + - Operation group `MongoDBResourcesOperations` added method `begin_mongo_db_container_redistribute_throughput` + - Operation group `MongoDBResourcesOperations` added method `begin_mongo_db_container_retrieve_throughput_distribution` + - Operation group `MongoDBResourcesOperations` added method `begin_mongo_db_database_partition_merge` + - Operation group `MongoDBResourcesOperations` added method `begin_mongo_db_database_redistribute_throughput` + - Operation group `MongoDBResourcesOperations` added method `begin_mongo_db_database_retrieve_throughput_distribution` + - Operation group `SqlResourcesOperations` added method `begin_list_sql_container_partition_merge` + - Operation group `SqlResourcesOperations` added method `begin_sql_container_redistribute_throughput` + - Operation group `SqlResourcesOperations` added method `begin_sql_container_retrieve_throughput_distribution` + - Operation group `SqlResourcesOperations` added method `begin_sql_database_partition_merge` + - Operation group `SqlResourcesOperations` added method `begin_sql_database_redistribute_throughput` + - Operation group `SqlResourcesOperations` added method `begin_sql_database_retrieve_throughput_distribution` - Added operation group `ChaosFaultOperations` - Added operation group `CopyJobsOperations` - Added operation group `DataTransferJobsOperations`