Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions api/src/v1/basin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ impl From<types::basin::BasinScope> for BasinScope {
pub enum BasinState {
/// Basin is active.
Active,
/// Basin is being created.
Creating,
/// Basin is being deleted.
Deleting,
}
Expand All @@ -106,7 +104,6 @@ impl From<types::basin::BasinState> for BasinState {
fn from(value: types::basin::BasinState) -> Self {
match value {
types::basin::BasinState::Active => Self::Active,
types::basin::BasinState::Creating => Self::Creating,
types::basin::BasinState::Deleting => Self::Deleting,
}
}
Expand Down
2 changes: 0 additions & 2 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ async fn run() -> Result<(), CliError> {
let info = ops::create_basin(&s2, args).await?;

let message = match info.state {
BasinState::Creating => "✓ Basin creation requested".yellow().bold(),
BasinState::Active => "✓ Basin created".green().bold(),
BasinState::Deleting => "Basin is being deleted".red().bold(),
};
Expand Down Expand Up @@ -627,7 +626,6 @@ async fn run() -> Result<(), CliError> {
fn format_basin_state(state: BasinState) -> colored::ColoredString {
match state {
BasinState::Active => "active".green(),
BasinState::Creating => "creating".yellow(),
BasinState::Deleting => "deleting".red(),
}
}
Expand Down
2 changes: 0 additions & 2 deletions cli/src/tui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const BORDER_DIM: Color = GRAY_850;
const BORDER_TITLE: Color = GRAY_900;

const BADGE_ACTIVE: Color = Color::Rgb(22, 101, 52);
const BADGE_PENDING: Color = Color::Rgb(113, 63, 18);
const BADGE_DANGER: Color = Color::Rgb(127, 29, 29);

const STAT_MIN: Color = Color::Rgb(96, 165, 250);
Expand Down Expand Up @@ -2471,7 +2470,6 @@ fn draw_basins(f: &mut Frame, area: Rect, state: &BasinsState) {

let (state_text, state_bg) = match basin.state {
s2_sdk::types::BasinState::Active => ("Active", BADGE_ACTIVE),
s2_sdk::types::BasinState::Creating => ("Creating", BADGE_PENDING),
s2_sdk::types::BasinState::Deleting => ("Deleting", BADGE_DANGER),
};

Expand Down
1 change: 0 additions & 1 deletion common/src/types/basin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ pub type ListBasinsRequest = ListItemsRequest<BasinNamePrefix, BasinNameStartAft
#[derive(Debug, Clone, Copy)]
pub enum BasinState {
Active,
Creating,
Deleting,
}

Expand Down
17 changes: 13 additions & 4 deletions lite/tests/backend/control_plane/basin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use s2_common::{
resources::{CreateMode, ListItemsRequestParts, RequestToken},
},
};
use s2_lite::backend::error::{
CreateBasinError, DeleteBasinError, GetBasinConfigError, ReconfigureBasinError,
use s2_lite::backend::{
CreatedOrReconfigured,
error::{CreateBasinError, DeleteBasinError, GetBasinConfigError, ReconfigureBasinError},
};

use super::common::*;
Expand All @@ -26,23 +27,31 @@ async fn test_create_basin_idempotency_respects_request_token() {

let token1: RequestToken = "token-1".parse().unwrap();

backend
let created = backend
.create_basin(
basin_name.clone(),
config.clone(),
CreateMode::CreateOnly(Some(token1.clone())),
)
.await
.expect("Failed to create basin");
assert!(matches!(
created,
CreatedOrReconfigured::Created(ref info) if matches!(info.state, BasinState::Active)
));

backend
let idempotent = backend
.create_basin(
basin_name.clone(),
config.clone(),
CreateMode::CreateOnly(Some(token1.clone())),
)
.await
.expect("Idempotent create should succeed with same request token");
assert!(matches!(
idempotent,
CreatedOrReconfigured::Created(ref info) if matches!(info.state, BasinState::Active)
));

let different_token: RequestToken = "token-2".parse().unwrap();
let different_token_result = backend
Expand Down
3 changes: 0 additions & 3 deletions sdk/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,6 @@ impl ListAllBasinsInput {
pub enum BasinState {
/// Active
Active,
/// Creating
Creating,
/// Deleting
Deleting,
}
Expand All @@ -1136,7 +1134,6 @@ impl From<api::basin::BasinState> for BasinState {
fn from(value: api::basin::BasinState) -> Self {
match value {
api::basin::BasinState::Active => BasinState::Active,
api::basin::BasinState::Creating => BasinState::Creating,
api::basin::BasinState::Deleting => BasinState::Deleting,
}
}
Expand Down
1 change: 1 addition & 0 deletions sdk/tests/account_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async fn create_list_and_delete_basin() -> Result<(), S2Error> {
.await?;

assert_eq!(basin_info.name, basin_name);
assert_eq!(basin_info.state, BasinState::Active);

let page = s2
.list_basins(ListBasinsInput::new().with_prefix(basin_name.clone().into()))
Expand Down
Loading