pub struct CreateBasinRequest {
pub basin: BasinName,
pub config: Option<BasinConfig>,
pub scope: Option<BasinScope>,
}
Expand description
Create basin request.
Fields§
§basin: BasinName
Basin name, which must be globally unique. The name must be between 8 and 48 characters, comprising lowercase letters, numbers and hyphens. It cannot begin or end with a hyphen.
config: Option<BasinConfig>
Basin configuration.
scope: Option<BasinScope>
Basin scope.
Implementations§
Source§impl CreateBasinRequest
impl CreateBasinRequest
Sourcepub fn new(basin: BasinName) -> Self
pub fn new(basin: BasinName) -> Self
Create a new request with basin name.
Examples found in repository?
examples/create_basin.rs (line 26)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let token = std::env::var("S2_ACCESS_TOKEN")?;
11 let config = ClientConfig::new(token);
12 let client = Client::new(config);
13
14 let basin: BasinName = "my-favorite-basin".parse()?;
15
16 let default_stream_config = StreamConfig::new().with_retention_policy(RetentionPolicy::Age(
17 // Set the default retention age to 10 days.
18 Duration::from_secs(10 * 24 * 60 * 60),
19 ));
20
21 let basin_config = BasinConfig::new()
22 .with_default_stream_config(default_stream_config)
23 .with_create_stream_on_append(false)
24 .with_create_stream_on_read(false);
25
26 let create_basin_request = CreateBasinRequest::new(basin.clone()).with_config(basin_config);
27
28 let created_basin = client.create_basin(create_basin_request).await?;
29 println!("{created_basin:#?}");
30
31 let basin_config = client.get_basin_config(basin).await?;
32 println!("{basin_config:#?}");
33
34 Ok(())
35}
Sourcepub fn with_config(self, config: BasinConfig) -> Self
pub fn with_config(self, config: BasinConfig) -> Self
Overwrite basin configuration.
Examples found in repository?
examples/create_basin.rs (line 26)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let token = std::env::var("S2_ACCESS_TOKEN")?;
11 let config = ClientConfig::new(token);
12 let client = Client::new(config);
13
14 let basin: BasinName = "my-favorite-basin".parse()?;
15
16 let default_stream_config = StreamConfig::new().with_retention_policy(RetentionPolicy::Age(
17 // Set the default retention age to 10 days.
18 Duration::from_secs(10 * 24 * 60 * 60),
19 ));
20
21 let basin_config = BasinConfig::new()
22 .with_default_stream_config(default_stream_config)
23 .with_create_stream_on_append(false)
24 .with_create_stream_on_read(false);
25
26 let create_basin_request = CreateBasinRequest::new(basin.clone()).with_config(basin_config);
27
28 let created_basin = client.create_basin(create_basin_request).await?;
29 println!("{created_basin:#?}");
30
31 let basin_config = client.get_basin_config(basin).await?;
32 println!("{basin_config:#?}");
33
34 Ok(())
35}
Sourcepub fn with_scope(self, scope: BasinScope) -> Self
pub fn with_scope(self, scope: BasinScope) -> Self
Overwrite basin scope.
Trait Implementations§
Source§impl Clone for CreateBasinRequest
impl Clone for CreateBasinRequest
Source§fn clone(&self) -> CreateBasinRequest
fn clone(&self) -> CreateBasinRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CreateBasinRequest
impl RefUnwindSafe for CreateBasinRequest
impl Send for CreateBasinRequest
impl Sync for CreateBasinRequest
impl Unpin for CreateBasinRequest
impl UnwindSafe for CreateBasinRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request