Skip to content

Commit

Permalink
Bump dependencies, progenitor to 66595ccf, oxide.json to omicron:5827…
Browse files Browse the repository at this point in the history
…1883 (#462)

* Rebuilt with latest dependency updates

* Rebuilt with latest dependency updates

* add new subcommands

* Rebuilt with latest dependency updates

---------

Co-authored-by: oxide-reflector-bot[bot] <130185838+oxide-reflector-bot[bot]@users.noreply.github.com>
Co-authored-by: Adam H. Leventhal <[email protected]>
  • Loading branch information
oxide-reflector-bot[bot] and ahl authored Dec 16, 2023
1 parent 1394f30 commit 5904a8c
Show file tree
Hide file tree
Showing 7 changed files with 1,736 additions and 190 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions cli/docs/cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,39 @@
}
]
},
{
"name": "utilization",
"subcommands": [
{
"name": "list",
"about": "List current utilization state for all silos",
"args": [
{
"long": "limit",
"help": "Maximum number of items returned by a single call"
},
{
"long": "sort-by",
"values": [
"name_ascending",
"name_descending",
"id_ascending"
]
}
]
},
{
"name": "view",
"about": "View the current utilization of a given silo",
"args": [
{
"long": "silo",
"help": "Name or ID of the silo"
}
]
}
]
},
{
"name": "view",
"about": "Fetch a silo",
Expand Down Expand Up @@ -2937,6 +2970,10 @@
}
]
},
{
"name": "utilization",
"about": "View the resource utilization of the user's current silo"
},
{
"name": "version",
"about": "Prints version information about the CLI."
Expand Down
3 changes: 3 additions & 0 deletions cli/src/cli_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ fn xxx<'a>(command: CliCommand) -> Option<&'a str> {
CliCommand::SystemQuotasList => Some("silo quotas list"),
CliCommand::SiloQuotasView => Some("silo quotas view"),
CliCommand::SiloQuotasUpdate => Some("silo quotas update"),
CliCommand::SiloUtilizationList => Some("silo utilization list"),
CliCommand::SiloUtilizationView => Some("silo utilization view"),

CliCommand::UtilizationView => Some("utilization"),
CliCommand::UserList => Some("user list"),

// VPCs
Expand Down
149 changes: 149 additions & 0 deletions cli/src/generated_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ impl Cli {
CliCommand::SiloUserView => Self::cli_silo_user_view(),
CliCommand::UserBuiltinList => Self::cli_user_builtin_list(),
CliCommand::UserBuiltinView => Self::cli_user_builtin_view(),
CliCommand::SiloUtilizationList => Self::cli_silo_utilization_list(),
CliCommand::SiloUtilizationView => Self::cli_silo_utilization_view(),
CliCommand::UserList => Self::cli_user_list(),
CliCommand::UtilizationView => Self::cli_utilization_view(),
CliCommand::VpcFirewallRulesView => Self::cli_vpc_firewall_rules_view(),
CliCommand::VpcFirewallRulesUpdate => Self::cli_vpc_firewall_rules_update(),
CliCommand::VpcSubnetList => Self::cli_vpc_subnet_list(),
Expand Down Expand Up @@ -4170,6 +4173,43 @@ impl Cli {
.about("Fetch a built-in user")
}

pub fn cli_silo_utilization_list() -> clap::Command {
clap::Command::new("")
.arg(
clap::Arg::new("limit")
.long("limit")
.value_parser(clap::value_parser!(std::num::NonZeroU32))
.required(false)
.help("Maximum number of items returned by a single call"),
)
.arg(
clap::Arg::new("sort-by")
.long("sort-by")
.value_parser(clap::builder::TypedValueParser::map(
clap::builder::PossibleValuesParser::new([
types::NameOrIdSortMode::NameAscending.to_string(),
types::NameOrIdSortMode::NameDescending.to_string(),
types::NameOrIdSortMode::IdAscending.to_string(),
]),
|s| types::NameOrIdSortMode::try_from(s).unwrap(),
))
.required(false),
)
.about("List current utilization state for all silos")
}

pub fn cli_silo_utilization_view() -> clap::Command {
clap::Command::new("")
.arg(
clap::Arg::new("silo")
.long("silo")
.value_parser(clap::value_parser!(types::NameOrId))
.required(true)
.help("Name or ID of the silo"),
)
.about("View the current utilization of a given silo")
}

pub fn cli_user_list() -> clap::Command {
clap::Command::new("")
.arg(
Expand Down Expand Up @@ -4199,6 +4239,10 @@ impl Cli {
.about("List users")
}

pub fn cli_utilization_view() -> clap::Command {
clap::Command::new("").about("View the resource utilization of the user's current silo")
}

pub fn cli_vpc_firewall_rules_view() -> clap::Command {
clap::Command::new("")
.arg(
Expand Down Expand Up @@ -5153,9 +5197,18 @@ impl<T: CliOverride> Cli<T> {
CliCommand::UserBuiltinView => {
self.execute_user_builtin_view(matches).await;
}
CliCommand::SiloUtilizationList => {
self.execute_silo_utilization_list(matches).await;
}
CliCommand::SiloUtilizationView => {
self.execute_silo_utilization_view(matches).await;
}
CliCommand::UserList => {
self.execute_user_list(matches).await;
}
CliCommand::UtilizationView => {
self.execute_utilization_view(matches).await;
}
CliCommand::VpcFirewallRulesView => {
self.execute_vpc_firewall_rules_view(matches).await;
}
Expand Down Expand Up @@ -9271,6 +9324,56 @@ impl<T: CliOverride> Cli<T> {
}
}

pub async fn execute_silo_utilization_list(&self, matches: &clap::ArgMatches) {
let mut request = self.client.silo_utilization_list();
if let Some(value) = matches.get_one::<std::num::NonZeroU32>("limit") {
request = request.limit(value.clone());
}

if let Some(value) = matches.get_one::<types::NameOrIdSortMode>("sort-by") {
request = request.sort_by(value.clone());
}

self.over
.execute_silo_utilization_list(matches, &mut request)
.unwrap();
let mut stream = request.stream();
loop {
match futures::TryStreamExt::try_next(&mut stream).await {
Err(r) => {
println!("error\n{:#?}", r);
break;
}
Ok(None) => {
break;
}
Ok(Some(value)) => {
println!("{:#?}", value);
}
}
}
}

pub async fn execute_silo_utilization_view(&self, matches: &clap::ArgMatches) {
let mut request = self.client.silo_utilization_view();
if let Some(value) = matches.get_one::<types::NameOrId>("silo") {
request = request.silo(value.clone());
}

self.over
.execute_silo_utilization_view(matches, &mut request)
.unwrap();
let result = request.send().await;
match result {
Ok(r) => {
println!("success\n{:#?}", r)
}
Err(r) => {
println!("error\n{:#?}", r)
}
}
}

pub async fn execute_user_list(&self, matches: &clap::ArgMatches) {
let mut request = self.client.user_list();
if let Some(value) = matches.get_one::<uuid::Uuid>("group") {
Expand Down Expand Up @@ -9303,6 +9406,22 @@ impl<T: CliOverride> Cli<T> {
}
}

pub async fn execute_utilization_view(&self, matches: &clap::ArgMatches) {
let mut request = self.client.utilization_view();
self.over
.execute_utilization_view(matches, &mut request)
.unwrap();
let result = request.send().await;
match result {
Ok(r) => {
println!("success\n{:#?}", r)
}
Err(r) => {
println!("error\n{:#?}", r)
}
}
}

pub async fn execute_vpc_firewall_rules_view(&self, matches: &clap::ArgMatches) {
let mut request = self.client.vpc_firewall_rules_view();
if let Some(value) = matches.get_one::<types::NameOrId>("project") {
Expand Down Expand Up @@ -10884,6 +11003,22 @@ pub trait CliOverride {
Ok(())
}

fn execute_silo_utilization_list(
&self,
matches: &clap::ArgMatches,
request: &mut builder::SiloUtilizationList,
) -> Result<(), String> {
Ok(())
}

fn execute_silo_utilization_view(
&self,
matches: &clap::ArgMatches,
request: &mut builder::SiloUtilizationView,
) -> Result<(), String> {
Ok(())
}

fn execute_user_list(
&self,
matches: &clap::ArgMatches,
Expand All @@ -10892,6 +11027,14 @@ pub trait CliOverride {
Ok(())
}

fn execute_utilization_view(
&self,
matches: &clap::ArgMatches,
request: &mut builder::UtilizationView,
) -> Result<(), String> {
Ok(())
}

fn execute_vpc_firewall_rules_view(
&self,
matches: &clap::ArgMatches,
Expand Down Expand Up @@ -11143,7 +11286,10 @@ pub enum CliCommand {
SiloUserView,
UserBuiltinList,
UserBuiltinView,
SiloUtilizationList,
SiloUtilizationView,
UserList,
UtilizationView,
VpcFirewallRulesView,
VpcFirewallRulesUpdate,
VpcSubnetList,
Expand Down Expand Up @@ -11305,7 +11451,10 @@ impl CliCommand {
CliCommand::SiloUserView,
CliCommand::UserBuiltinList,
CliCommand::UserBuiltinView,
CliCommand::SiloUtilizationList,
CliCommand::SiloUtilizationView,
CliCommand::UserList,
CliCommand::UtilizationView,
CliCommand::VpcFirewallRulesView,
CliCommand::VpcFirewallRulesUpdate,
CliCommand::VpcSubnetList,
Expand Down
Loading

0 comments on commit 5904a8c

Please sign in to comment.