File tree Expand file tree Collapse file tree 3 files changed +69
-0
lines changed
Expand file tree Collapse file tree 3 files changed +69
-0
lines changed Original file line number Diff line number Diff line change @@ -1368,6 +1368,18 @@ pub enum CloudDatabaseCommands {
13681368 force : bool ,
13691369 } ,
13701370
1371+ /// Update Active-Active database regions
1372+ #[ command( name = "update-aa-regions" ) ]
1373+ UpdateAaRegions {
1374+ /// Database ID (format: subscription_id:database_id)
1375+ id : String ,
1376+ /// JSON file with region configuration (use @filename or - for stdin)
1377+ file : String ,
1378+ /// Async operation options
1379+ #[ command( flatten) ]
1380+ async_ops : crate :: commands:: cloud:: async_utils:: AsyncOperationArgs ,
1381+ } ,
1382+
13711383 /// Get available Redis versions for upgrade
13721384 AvailableVersions {
13731385 /// Database ID (format: subscription_id:database_id)
Original file line number Diff line number Diff line change @@ -243,6 +243,22 @@ pub async fn handle_database_command(
243243 )
244244 . await
245245 }
246+ CloudDatabaseCommands :: UpdateAaRegions {
247+ id,
248+ file,
249+ async_ops,
250+ } => {
251+ super :: database_impl:: update_aa_regions (
252+ conn_mgr,
253+ profile_name,
254+ id,
255+ file,
256+ async_ops,
257+ output_format,
258+ query,
259+ )
260+ . await
261+ }
246262 CloudDatabaseCommands :: AvailableVersions { id } => {
247263 super :: database_impl:: get_available_versions (
248264 conn_mgr,
Original file line number Diff line number Diff line change @@ -930,6 +930,47 @@ pub async fn flush_crdb(
930930 Ok ( ( ) )
931931}
932932
933+ /// Update Active-Active database regions
934+ pub async fn update_aa_regions (
935+ conn_mgr : & ConnectionManager ,
936+ profile_name : Option < & str > ,
937+ id : & str ,
938+ file : & str ,
939+ async_ops : & AsyncOperationArgs ,
940+ output_format : OutputFormat ,
941+ query : Option < & str > ,
942+ ) -> CliResult < ( ) > {
943+ let ( subscription_id, database_id) = parse_database_id ( id) ?;
944+ let client = conn_mgr. create_cloud_client ( profile_name) . await ?;
945+
946+ // Read the request body from file
947+ let file_content = read_file_input ( file) ?;
948+ let request_body: Value =
949+ serde_json:: from_str ( & file_content) . context ( "Failed to parse JSON input" ) ?;
950+
951+ let response = client
952+ . put_raw (
953+ & format ! (
954+ "/subscriptions/{}/databases/{}/regions" ,
955+ subscription_id, database_id
956+ ) ,
957+ request_body,
958+ )
959+ . await
960+ . context ( "Failed to update Active-Active database regions" ) ?;
961+
962+ handle_async_response (
963+ conn_mgr,
964+ profile_name,
965+ response,
966+ async_ops,
967+ output_format,
968+ query,
969+ "Update AA regions" ,
970+ )
971+ . await
972+ }
973+
933974/// Get Redis version upgrade status
934975pub async fn get_upgrade_status (
935976 conn_mgr : & ConnectionManager ,
You can’t perform that action at this time.
0 commit comments