@@ -41,6 +41,7 @@ use nexus_types::deployment::{
41
41
use nexus_types:: deployment:: { OmicronZoneNic , TargetReleaseDescription } ;
42
42
use nexus_types:: external_api:: views:: SledPolicy ;
43
43
use nexus_types:: external_api:: views:: SledProvisionPolicy ;
44
+ use nexus_types:: inventory:: CollectionDisplayCliFilter ;
44
45
use omicron_common:: address:: REPO_DEPOT_PORT ;
45
46
use omicron_common:: api:: external:: Name ;
46
47
use omicron_common:: api:: external:: { Generation , TufRepoDescription } ;
@@ -236,6 +237,7 @@ fn process_command(
236
237
Commands :: SiloRemove ( args) => cmd_silo_remove ( sim, args) ,
237
238
Commands :: InventoryList => cmd_inventory_list ( sim) ,
238
239
Commands :: InventoryGenerate => cmd_inventory_generate ( sim) ,
240
+ Commands :: InventoryShow ( args) => cmd_inventory_show ( sim, args) ,
239
241
Commands :: BlueprintList => cmd_blueprint_list ( sim) ,
240
242
Commands :: BlueprintBlippy ( args) => cmd_blueprint_blippy ( sim, args) ,
241
243
Commands :: BlueprintEdit ( args) => cmd_blueprint_edit ( sim, args) ,
@@ -298,6 +300,8 @@ enum Commands {
298
300
InventoryList ,
299
301
/// generates an inventory collection from the configured sleds
300
302
InventoryGenerate ,
303
+ /// show details about an inventory collection
304
+ InventoryShow ( InventoryShowArgs ) ,
301
305
302
306
/// list all blueprints
303
307
BlueprintList ,
@@ -511,9 +515,16 @@ struct SiloAddRemoveArgs {
511
515
}
512
516
513
517
#[ derive( Debug , Args ) ]
514
- struct InventoryArgs {
515
- /// id of the inventory collection to use in planning
516
- collection_id : CollectionUuid ,
518
+ struct InventoryShowArgs {
519
+ /// id of the inventory collection to show or "latest"
520
+ collection_id : CollectionIdOpt ,
521
+
522
+ /// show long strings in their entirety
523
+ #[ clap( long) ]
524
+ show_long_strings : bool ,
525
+
526
+ #[ clap( subcommand) ]
527
+ filter : Option < CollectionDisplayCliFilter > ,
517
528
}
518
529
519
530
#[ derive( Debug , Args ) ]
@@ -992,14 +1003,6 @@ enum CliDnsGroup {
992
1003
External ,
993
1004
}
994
1005
995
- #[ derive( Debug , Args ) ]
996
- struct BlueprintDiffInventoryArgs {
997
- /// id of the inventory collection
998
- collection_id : CollectionUuid ,
999
- /// id of the blueprint, "latest", or "target"
1000
- blueprint_id : BlueprintIdOpt ,
1001
- }
1002
-
1003
1006
#[ derive( Debug , Args ) ]
1004
1007
struct BlueprintSaveArgs {
1005
1008
/// id of the blueprint, "latest", or "target"
@@ -1463,6 +1466,24 @@ fn cmd_inventory_generate(
1463
1466
Ok ( Some ( rv) )
1464
1467
}
1465
1468
1469
+ fn cmd_inventory_show (
1470
+ sim : & mut ReconfiguratorSim ,
1471
+ args : InventoryShowArgs ,
1472
+ ) -> anyhow:: Result < Option < String > > {
1473
+ let state = sim. current_state ( ) ;
1474
+ let system = state. system ( ) ;
1475
+ let resolved = system. resolve_collection_id ( args. collection_id . into ( ) ) ?;
1476
+ let collection = system. get_collection ( & resolved) ?;
1477
+
1478
+ let mut display = collection. display ( ) ;
1479
+ if let Some ( filter) = & args. filter {
1480
+ display. apply_cli_filter ( filter) ;
1481
+ }
1482
+ display. show_long_strings ( args. show_long_strings ) ;
1483
+
1484
+ Ok ( Some ( display. to_string ( ) ) )
1485
+ }
1486
+
1466
1487
fn cmd_blueprint_list (
1467
1488
sim : & mut ReconfiguratorSim ,
1468
1489
) -> anyhow:: Result < Option < String > > {
0 commit comments