Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
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
34 changes: 2 additions & 32 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,7 @@ pub struct CreateBasinInput {
///
/// Defaults to [`AwsUsEast1`](BasinScope::AwsUsEast1).
pub scope: Option<BasinScope>,
/// Idempotency token for the operation.
///
/// When a request is retried, the same token is reused,
/// causing the server to return the original response instead of
/// performing the operation again.
///
/// Defaults to a random UUID.
pub idempotency_token: String,
idempotency_token: String,
}

impl CreateBasinInput {
Expand Down Expand Up @@ -908,14 +901,6 @@ impl CreateBasinInput {
..self
}
}

/// Set the idempotency token for the operation.
pub fn with_idempotency_token(self, idempotency_token: impl Into<String>) -> Self {
Self {
idempotency_token: idempotency_token.into(),
..self
}
}
}

impl From<CreateBasinInput> for (api::basin::CreateBasinRequest, String) {
Expand Down Expand Up @@ -2551,14 +2536,7 @@ pub struct CreateStreamInput {
///
/// See [`StreamConfig`] for defaults.
pub config: Option<StreamConfig>,
/// Idempotency token for the operation.
///
/// When a request is retried, the same token is reused,
/// causing the server to return the original response instead of
/// performing the operation again.
///
/// Defaults to a random UUID.
pub idempotency_token: String,
idempotency_token: String,
}

impl CreateStreamInput {
Expand All @@ -2578,14 +2556,6 @@ impl CreateStreamInput {
..self
}
}

/// Set the idempotency token for the operation.
pub fn with_idempotency_token(self, idempotency_token: impl Into<String>) -> Self {
Self {
idempotency_token: idempotency_token.into(),
..self
}
}
}

impl From<CreateStreamInput> for (api::stream::CreateStreamRequest, String) {
Expand Down
54 changes: 0 additions & 54 deletions tests/basin_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,60 +735,6 @@ async fn create_stream_delete_on_empty_min_age(basin: &SharedS2Basin) -> Result<
Ok(())
}

#[test_context(SharedS2Basin)]
#[tokio_shared_rt::test(shared)]
async fn create_stream_idempotent_same_token(basin: &SharedS2Basin) -> Result<(), S2Error> {
let stream_name = unique_stream_name();
let token = uuid();

let info_1 = basin
.create_stream(
CreateStreamInput::new(stream_name.clone()).with_idempotency_token(token.clone()),
)
.await?;
let info_2 = basin
.create_stream(CreateStreamInput::new(stream_name.clone()).with_idempotency_token(token))
.await?;

assert_eq!(info_1.name, stream_name);
assert_eq!(info_2.name, stream_name);

basin
.delete_stream(DeleteStreamInput::new(stream_name))
.await?;

Ok(())
}

#[test_context(SharedS2Basin)]
#[tokio_shared_rt::test(shared)]
async fn create_stream_idempotent_different_token_errors(
basin: &SharedS2Basin,
) -> Result<(), S2Error> {
let stream_name = unique_stream_name();

basin
.create_stream(CreateStreamInput::new(stream_name.clone()).with_idempotency_token(uuid()))
.await?;

let result = basin
.create_stream(CreateStreamInput::new(stream_name.clone()).with_idempotency_token(uuid()))
.await;

assert_matches!(
result,
Err(S2Error::Server(ErrorResponse { code, .. })) => {
assert_eq!(code, "resource_already_exists");
}
);

basin
.delete_stream(DeleteStreamInput::new(stream_name))
.await?;

Ok(())
}

#[test_context(SharedS2Basin)]
#[tokio_shared_rt::test(shared)]
async fn create_stream_invalid_retention_age_zero(basin: &SharedS2Basin) -> Result<(), S2Error> {
Expand Down
Loading