1use s2_common::types::{
2 self,
3 basin::{BasinName, BasinNamePrefix, BasinNameStartAfter},
4};
5use serde::{Deserialize, Serialize};
6
7use super::config::BasinConfig;
8
9#[rustfmt::skip]
10#[derive(Debug, Clone, Serialize, Deserialize)]
11#[cfg_attr(feature = "utoipa", derive(utoipa::IntoParams))]
12#[cfg_attr(feature = "utoipa", into_params(parameter_in = Query))]
13pub struct ListBasinsRequest {
14 #[cfg_attr(feature = "utoipa", param(value_type = String, default = "", required = false))]
16 pub prefix: Option<BasinNamePrefix>,
17 #[cfg_attr(feature = "utoipa", param(value_type = String, default = "", required = false))]
20 pub start_after: Option<BasinNameStartAfter>,
21 #[cfg_attr(feature = "utoipa", param(value_type = usize, maximum = 1000, default = 1000, required = false))]
23 pub limit: Option<usize>,
24}
25
26super::impl_list_request_conversions!(
27 ListBasinsRequest,
28 types::basin::BasinNamePrefix,
29 types::basin::BasinNameStartAfter
30);
31
32#[rustfmt::skip]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
35pub struct ListBasinsResponse {
36 #[cfg_attr(feature = "utoipa", schema(max_items = 1000))]
38 pub basins: Vec<BasinInfo>,
39 pub has_more: bool,
41}
42
43#[rustfmt::skip]
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
46pub struct BasinInfo {
47 pub name: BasinName,
49 pub scope: Option<BasinScope>,
51 pub state: BasinState,
53}
54
55impl From<types::basin::BasinInfo> for BasinInfo {
56 fn from(value: types::basin::BasinInfo) -> Self {
57 let types::basin::BasinInfo { name, scope, state } = value;
58
59 Self {
60 name,
61 scope: scope.map(Into::into),
62 state: state.into(),
63 }
64 }
65}
66
67#[rustfmt::skip]
68#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
69#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
70pub enum BasinScope {
71 #[serde(rename = "aws:us-east-1")]
73 AwsUsEast1,
74}
75
76impl From<BasinScope> for types::basin::BasinScope {
77 fn from(value: BasinScope) -> Self {
78 match value {
79 BasinScope::AwsUsEast1 => Self::AwsUsEast1,
80 }
81 }
82}
83
84impl From<types::basin::BasinScope> for BasinScope {
85 fn from(value: types::basin::BasinScope) -> Self {
86 match value {
87 types::basin::BasinScope::AwsUsEast1 => Self::AwsUsEast1,
88 }
89 }
90}
91
92#[rustfmt::skip]
93#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
94#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
95#[serde(rename_all = "kebab-case")]
96pub enum BasinState {
97 Active,
99 Creating,
101 Deleting,
103}
104
105impl From<types::basin::BasinState> for BasinState {
106 fn from(value: types::basin::BasinState) -> Self {
107 match value {
108 types::basin::BasinState::Active => Self::Active,
109 types::basin::BasinState::Creating => Self::Creating,
110 types::basin::BasinState::Deleting => Self::Deleting,
111 }
112 }
113}
114
115#[rustfmt::skip]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
118pub struct CreateOrReconfigureBasinRequest {
119 pub config: Option<BasinConfig>,
121 pub scope: Option<BasinScope>,
124}
125
126#[rustfmt::skip]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
129pub struct CreateBasinRequest {
130 pub basin: BasinName,
134 pub config: Option<BasinConfig>,
136 pub scope: Option<BasinScope>,
138}