Skip to content

Commit

Permalink
Add support for setting 'auto-increase-up-to' in quotas
Browse files Browse the repository at this point in the history
  • Loading branch information
annesylvie committed Feb 26, 2024
1 parent 54d18a1 commit b336eec
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
20 changes: 15 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# Unreleased

- Added support for `--auto-increase-up-to` when creating quotas.

# v0.22.2

- Fix a bug where some label annotations cannot be applied

# v0.22.1
- minor api improvements

- minor api improvements

# v0.22.0

- Add integration commands

# v0.21.5
- Fix a bug where stream responses were not correctly parsed
- Fix a bug where streams were not correctly advanced
# v0.21.5

- Fix a bug where stream responses were not correctly parsed
- Fix a bug where streams were not correctly advanced

# v0.21.4

- Add messages filters
- Fixes `required` field error when interacting with datasets

## v0.21.3
## v0.21.3

- Reduce batch size for parse emls

## v0.21.2
Expand Down
7 changes: 7 additions & 0 deletions api/src/resources/quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Copy)]
Expand Down
6 changes: 6 additions & 0 deletions cli/src/commands/create/quota.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64>,
}

pub fn create(client: &Client, args: &CreateQuotaArgs) -> Result<()> {
Expand All @@ -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) {
Expand All @@ -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")?;
Expand Down

0 comments on commit b336eec

Please sign in to comment.