diff --git a/cli/docs/cli.json b/cli/docs/cli.json index 83853c27..61199c3e 100644 --- a/cli/docs/cli.json +++ b/cli/docs/cli.json @@ -2140,6 +2140,14 @@ "long": "json-body-template", "help": "XXX" }, + { + "long": "memory", + "help": "The amount of memory to assign to this instance.; unit suffixes are in powers of two (1k = 1024 bytes) for example: 6GiB, 512k, 2048mib" + }, + { + "long": "ncpus", + "help": "The number of CPUs to assign to this instance." + }, { "long": "profile", "help": "Configuration profile to use for commands", diff --git a/cli/src/generated_cli.rs b/cli/src/generated_cli.rs index 605f97ee..b5dcf11a 100644 --- a/cli/src/generated_cli.rs +++ b/cli/src/generated_cli.rs @@ -1587,6 +1587,20 @@ impl Cli { .required(true) .help("Name or ID of the instance"), ) + .arg( + clap::Arg::new("memory") + .long("memory") + .value_parser(clap::value_parser!(types::ByteCount)) + .required_unless_present("json-body") + .help("The amount of memory to assign to this instance."), + ) + .arg( + clap::Arg::new("ncpus") + .long("ncpus") + .value_parser(clap::value_parser!(types::InstanceCpuCount)) + .required_unless_present("json-body") + .help("The number of CPUs to assign to this instance."), + ) .arg( clap::Arg::new("project") .long("project") @@ -8253,6 +8267,14 @@ impl Cli { request = request.instance(value.clone()); } + if let Some(value) = matches.get_one::("memory") { + request = request.body_map(|body| body.memory(value.clone())) + } + + if let Some(value) = matches.get_one::("ncpus") { + request = request.body_map(|body| body.ncpus(value.clone())) + } + if let Some(value) = matches.get_one::("project") { request = request.project(value.clone()); } diff --git a/oxide.json b/oxide.json index d4dfa6d3..b4abc02a 100644 --- a/oxide.json +++ b/oxide.json @@ -16491,8 +16491,28 @@ "$ref": "#/components/schemas/NameOrId" } ] + }, + "memory": { + "description": "The amount of memory to assign to this instance.", + "allOf": [ + { + "$ref": "#/components/schemas/ByteCount" + } + ] + }, + "ncpus": { + "description": "The number of CPUs to assign to this instance.", + "allOf": [ + { + "$ref": "#/components/schemas/InstanceCpuCount" + } + ] } - } + }, + "required": [ + "memory", + "ncpus" + ] }, "InternetGateway": { "description": "An internet gateway provides a path between VPC networks and external networks.", diff --git a/sdk/src/generated_sdk.rs b/sdk/src/generated_sdk.rs index cc50e500..815e47fa 100644 --- a/sdk/src/generated_sdk.rs +++ b/sdk/src/generated_sdk.rs @@ -13021,6 +13021,10 @@ pub mod types { /// "description": "Parameters of an `Instance` that can be reconfigured /// after creation.", /// "type": "object", + /// "required": [ + /// "memory", + /// "ncpus" + /// ], /// "properties": { /// "auto_restart_policy": { /// "description": "Sets the auto-restart policy for this @@ -13063,6 +13067,22 @@ pub mod types { /// ] /// } /// ] + /// }, + /// "memory": { + /// "description": "The amount of memory to assign to this instance.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/ByteCount" + /// } + /// ] + /// }, + /// "ncpus": { + /// "description": "The number of CPUs to assign to this instance.", + /// "allOf": [ + /// { + /// "$ref": "#/components/schemas/InstanceCpuCount" + /// } + /// ] /// } /// } /// } @@ -13094,6 +13114,10 @@ pub mod types { /// If not provided, unset the instance's boot disk. #[serde(default, skip_serializing_if = "Option::is_none")] pub boot_disk: Option, + /// The amount of memory to assign to this instance. + pub memory: ByteCount, + /// The number of CPUs to assign to this instance. + pub ncpus: InstanceCpuCount, } impl From<&InstanceUpdate> for InstanceUpdate { @@ -37213,6 +37237,8 @@ pub mod types { pub struct InstanceUpdate { auto_restart_policy: Result, String>, boot_disk: Result, String>, + memory: Result, + ncpus: Result, } impl Default for InstanceUpdate { @@ -37220,6 +37246,8 @@ pub mod types { Self { auto_restart_policy: Ok(Default::default()), boot_disk: Ok(Default::default()), + memory: Err("no value supplied for memory".to_string()), + ncpus: Err("no value supplied for ncpus".to_string()), } } } @@ -37248,6 +37276,26 @@ pub mod types { .map_err(|e| format!("error converting supplied value for boot_disk: {}", e)); self } + pub fn memory(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.memory = value + .try_into() + .map_err(|e| format!("error converting supplied value for memory: {}", e)); + self + } + pub fn ncpus(mut self, value: T) -> Self + where + T: std::convert::TryInto, + T::Error: std::fmt::Display, + { + self.ncpus = value + .try_into() + .map_err(|e| format!("error converting supplied value for ncpus: {}", e)); + self + } } impl std::convert::TryFrom for super::InstanceUpdate { @@ -37256,6 +37304,8 @@ pub mod types { Ok(Self { auto_restart_policy: value.auto_restart_policy?, boot_disk: value.boot_disk?, + memory: value.memory?, + ncpus: value.ncpus?, }) } } @@ -37265,6 +37315,8 @@ pub mod types { Self { auto_restart_policy: Ok(value.auto_restart_policy), boot_disk: Ok(value.boot_disk), + memory: Ok(value.memory), + ncpus: Ok(value.ncpus), } } }