Skip to content

Commit ab5a636

Browse files
committed
feat(cloud): add --wait flag support for connectivity commands (WIP)
- Add AsyncOperationArgs to VPC Peering commands (6 commands) - Add AsyncOperationArgs to PSC commands (9 commands) - Add AsyncOperationArgs to TGW commands (7 commands) - Update VPC Peering handlers to use handle_async_response - Update match arms for PSC and TGW to include async_ops parameter - Add async_utils import to connectivity modules Note: This is a work in progress. Function signatures need updating for PSC and TGW handler implementations. Part of #196
1 parent 5f05783 commit ab5a636

File tree

4 files changed

+428
-117
lines changed

4 files changed

+428
-117
lines changed

crates/redisctl/src/cli.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ pub enum VpcPeeringCommands {
220220
subscription: i32,
221221
/// Configuration JSON file or string (use @filename for file)
222222
data: String,
223+
#[command(flatten)]
224+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
223225
},
224226
/// Update VPC peering
225227
Update {
@@ -231,6 +233,8 @@ pub enum VpcPeeringCommands {
231233
peering_id: i32,
232234
/// Configuration JSON file or string (use @filename for file)
233235
data: String,
236+
#[command(flatten)]
237+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
234238
},
235239
/// Delete VPC peering
236240
Delete {
@@ -243,6 +247,8 @@ pub enum VpcPeeringCommands {
243247
/// Skip confirmation prompt
244248
#[arg(long)]
245249
force: bool,
250+
#[command(flatten)]
251+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
246252
},
247253
/// List Active-Active VPC peerings
248254
#[command(name = "list-aa")]
@@ -259,6 +265,8 @@ pub enum VpcPeeringCommands {
259265
subscription: i32,
260266
/// Configuration JSON file or string (use @filename for file)
261267
data: String,
268+
#[command(flatten)]
269+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
262270
},
263271
/// Update Active-Active VPC peering
264272
#[command(name = "update-aa")]
@@ -271,6 +279,8 @@ pub enum VpcPeeringCommands {
271279
peering_id: i32,
272280
/// Configuration JSON file or string (use @filename for file)
273281
data: String,
282+
#[command(flatten)]
283+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
274284
},
275285
/// Delete Active-Active VPC peering
276286
#[command(name = "delete-aa")]
@@ -284,6 +294,8 @@ pub enum VpcPeeringCommands {
284294
/// Skip confirmation prompt
285295
#[arg(long)]
286296
force: bool,
297+
#[command(flatten)]
298+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
287299
},
288300
}
289301

@@ -302,6 +314,8 @@ pub enum PscCommands {
302314
ServiceCreate {
303315
/// Subscription ID
304316
subscription_id: i32,
317+
#[command(flatten)]
318+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
305319
},
306320
/// Delete PSC service
307321
#[command(name = "service-delete")]
@@ -311,6 +325,8 @@ pub enum PscCommands {
311325
/// Skip confirmation prompt
312326
#[arg(short, long)]
313327
yes: bool,
328+
#[command(flatten)]
329+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
314330
},
315331

316332
// Standard PSC Endpoint operations
@@ -327,6 +343,8 @@ pub enum PscCommands {
327343
subscription_id: i32,
328344
/// JSON file with endpoint configuration (use @filename or - for stdin)
329345
file: String,
346+
#[command(flatten)]
347+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
330348
},
331349
/// Update PSC endpoint
332350
#[command(name = "endpoint-update")]
@@ -337,6 +355,8 @@ pub enum PscCommands {
337355
endpoint_id: i32,
338356
/// JSON file with endpoint configuration (use @filename or - for stdin)
339357
file: String,
358+
#[command(flatten)]
359+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
340360
},
341361
/// Delete PSC endpoint
342362
#[command(name = "endpoint-delete")]
@@ -348,6 +368,8 @@ pub enum PscCommands {
348368
/// Skip confirmation prompt
349369
#[arg(short, long)]
350370
yes: bool,
371+
#[command(flatten)]
372+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
351373
},
352374
/// Get PSC endpoint creation script
353375
#[command(name = "endpoint-creation-script")]
@@ -378,6 +400,8 @@ pub enum PscCommands {
378400
AaServiceCreate {
379401
/// Subscription ID
380402
subscription_id: i32,
403+
#[command(flatten)]
404+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
381405
},
382406
/// Delete Active-Active PSC service
383407
#[command(name = "aa-service-delete")]
@@ -387,6 +411,8 @@ pub enum PscCommands {
387411
/// Skip confirmation prompt
388412
#[arg(short, long)]
389413
yes: bool,
414+
#[command(flatten)]
415+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
390416
},
391417

392418
// Active-Active PSC Endpoint operations
@@ -403,6 +429,8 @@ pub enum PscCommands {
403429
subscription_id: i32,
404430
/// JSON file with endpoint configuration (use @filename or - for stdin)
405431
file: String,
432+
#[command(flatten)]
433+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
406434
},
407435
/// Delete Active-Active PSC endpoint
408436
#[command(name = "aa-endpoint-delete")]
@@ -416,6 +444,8 @@ pub enum PscCommands {
416444
/// Skip confirmation prompt
417445
#[arg(short, long)]
418446
yes: bool,
447+
#[command(flatten)]
448+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
419449
},
420450
}
421451

@@ -436,6 +466,8 @@ pub enum TgwCommands {
436466
subscription_id: i32,
437467
/// JSON file with attachment configuration (use @filename or - for stdin)
438468
file: String,
469+
#[command(flatten)]
470+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
439471
},
440472
/// Create TGW attachment with ID in path
441473
#[command(name = "attachment-create-with-id")]
@@ -444,6 +476,8 @@ pub enum TgwCommands {
444476
subscription_id: i32,
445477
/// Transit Gateway ID
446478
tgw_id: String,
479+
#[command(flatten)]
480+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
447481
},
448482
/// Update TGW attachment CIDRs
449483
#[command(name = "attachment-update")]
@@ -454,6 +488,8 @@ pub enum TgwCommands {
454488
attachment_id: String,
455489
/// JSON file with CIDR configuration (use @filename or - for stdin)
456490
file: String,
491+
#[command(flatten)]
492+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
457493
},
458494
/// Delete TGW attachment
459495
#[command(name = "attachment-delete")]
@@ -465,6 +501,8 @@ pub enum TgwCommands {
465501
/// Skip confirmation prompt
466502
#[arg(short, long)]
467503
yes: bool,
504+
#[command(flatten)]
505+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
468506
},
469507

470508
// Standard TGW Invitation operations
@@ -507,6 +545,8 @@ pub enum TgwCommands {
507545
region_id: i32,
508546
/// JSON file with attachment configuration (use @filename or - for stdin)
509547
file: String,
548+
#[command(flatten)]
549+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
510550
},
511551
/// Update Active-Active TGW attachment CIDRs
512552
#[command(name = "aa-attachment-update")]
@@ -519,6 +559,8 @@ pub enum TgwCommands {
519559
attachment_id: String,
520560
/// JSON file with CIDR configuration (use @filename or - for stdin)
521561
file: String,
562+
#[command(flatten)]
563+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
522564
},
523565
/// Delete Active-Active TGW attachment
524566
#[command(name = "aa-attachment-delete")]
@@ -532,6 +574,8 @@ pub enum TgwCommands {
532574
/// Skip confirmation prompt
533575
#[arg(short, long)]
534576
yes: bool,
577+
#[command(flatten)]
578+
async_ops: crate::commands::cloud::async_utils::AsyncOperationArgs,
535579
},
536580

537581
// Active-Active TGW Invitation operations

0 commit comments

Comments
 (0)