diff --git a/api/src/resources/quota.rs b/api/src/resources/quota.rs index 4fdb735..a79715c 100644 --- a/api/src/resources/quota.rs +++ b/api/src/resources/quota.rs @@ -93,6 +93,13 @@ impl Display for TenantQuotaKind { #[derive(Debug, Clone, Serialize, PartialEq, Eq, Default)] pub struct CreateQuota { pub hard_limit: u64, + + // It is very important for this value not to be serialized if it is `None`. + // This is because the API will interpret `null` as "reset the auto-increase-up-to" value to + // its default value. If the field is not set, then the value will be left unchanged (which is + // what we want). + #[serde(skip_serializing_if = "Option::is_none")] + pub auto_increase_up_to: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Copy)] diff --git a/cli/src/commands/create/quota.rs b/cli/src/commands/create/quota.rs index 010ba0a..8a8cf98 100644 --- a/cli/src/commands/create/quota.rs +++ b/cli/src/commands/create/quota.rs @@ -27,6 +27,10 @@ pub struct CreateQuotaArgs { #[structopt(long = "limit")] /// New value of the quota to set hard_limit: u64, + + #[structopt(long = "auto-increase-up-to")] + /// If set, will also change the `auto-increase-up-to` value of the quota + auto_increase_up_to: Option, } pub fn create(client: &Client, args: &CreateQuotaArgs) -> Result<()> { @@ -35,6 +39,7 @@ pub fn create(client: &Client, args: &CreateQuotaArgs) -> Result<()> { uipath_tenant_id, tenant_quota_kind, hard_limit, + auto_increase_up_to, } = args; let tenant_id: TenantId = match (reinfer_tenant_id, uipath_tenant_id) { @@ -53,6 +58,7 @@ pub fn create(client: &Client, args: &CreateQuotaArgs) -> Result<()> { *tenant_quota_kind, CreateQuota { hard_limit: *hard_limit, + auto_increase_up_to: *auto_increase_up_to, }, ) .context("Operation to set quota has failed")?;