use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct AccountsTurnstileWidgetCreate<'a> {
client: &'a crate::Client,
account_id: Result<types::TurnstileIdentifier, String>,
direction: Result<Option<types::AccountsTurnstileWidgetCreateDirection>, String>,
filter: Result<Option<::std::string::String>, String>,
order: Result<Option<types::AccountsTurnstileWidgetCreateOrder>, String>,
page: Result<Option<f64>, String>,
per_page: Result<Option<f64>, String>,
body: Result<types::builder::AccountsTurnstileWidgetCreateBody, String>,
}
impl<'a> AccountsTurnstileWidgetCreate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
direction: Ok(None),
filter: Ok(None),
order: Ok(None),
page: Ok(None),
per_page: Ok(None),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TurnstileIdentifier` for account_id failed".to_string()
});
self
}
pub fn direction<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountsTurnstileWidgetCreateDirection>,
{
self.direction = value.try_into().map(Some).map_err(|_| {
"conversion to `AccountsTurnstileWidgetCreateDirection` for direction failed"
.to_string()
});
self
}
pub fn filter<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.filter = value.try_into().map(Some).map_err(|_| {
"conversion to `:: std :: string :: String` for filter failed".to_string()
});
self
}
pub fn order<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountsTurnstileWidgetCreateOrder>,
{
self.order = value.try_into().map(Some).map_err(|_| {
"conversion to `AccountsTurnstileWidgetCreateOrder` for order failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.page = value
.try_into()
.map(Some)
.map_err(|_| "conversion to `f64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.per_page = value
.try_into()
.map(Some)
.map_err(|_| "conversion to `f64` for per_page failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountsTurnstileWidgetCreateBody>,
<V as std::convert::TryInto<types::AccountsTurnstileWidgetCreateBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountsTurnstileWidgetCreateBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountsTurnstileWidgetCreateBody,
) -> types::builder::AccountsTurnstileWidgetCreateBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
direction,
filter,
order,
page,
per_page,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let direction = direction.map_err(Error::InvalidRequest)?;
let filter = filter.map_err(Error::InvalidRequest)?;
let order = order.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountsTurnstileWidgetCreateBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/challenges/widgets",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.query(&progenitor_client::QueryParam::new("direction", &direction))
.query(&progenitor_client::QueryParam::new("filter", &filter))
.query(&progenitor_client::QueryParam::new("order", &order))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "accounts_turnstile_widget_create",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountsTurnstileWidgetGet<'a> {
client: &'a crate::Client,
account_id: Result<types::TurnstileIdentifier, String>,
sitekey: Result<types::TurnstileSitekey, String>,
}
impl<'a> AccountsTurnstileWidgetGet<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
sitekey: Err("sitekey was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TurnstileIdentifier` for account_id failed".to_string()
});
self
}
pub fn sitekey<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileSitekey>,
{
self.sitekey = value
.try_into()
.map_err(|_| "conversion to `TurnstileSitekey` for sitekey failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
sitekey,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let sitekey = sitekey.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/challenges/widgets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&sitekey.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "accounts_turnstile_widget_get",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountsTurnstileWidgetUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::TurnstileIdentifier, String>,
sitekey: Result<types::TurnstileSitekey, String>,
body: Result<types::builder::AccountsTurnstileWidgetUpdateBody, String>,
}
impl<'a> AccountsTurnstileWidgetUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
sitekey: Err("sitekey was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TurnstileIdentifier` for account_id failed".to_string()
});
self
}
pub fn sitekey<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileSitekey>,
{
self.sitekey = value
.try_into()
.map_err(|_| "conversion to `TurnstileSitekey` for sitekey failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountsTurnstileWidgetUpdateBody>,
<V as std::convert::TryInto<types::AccountsTurnstileWidgetUpdateBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountsTurnstileWidgetUpdateBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountsTurnstileWidgetUpdateBody,
) -> types::builder::AccountsTurnstileWidgetUpdateBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
sitekey,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let sitekey = sitekey.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountsTurnstileWidgetUpdateBody::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/challenges/widgets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&sitekey.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "accounts_turnstile_widget_update",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountsTurnstileWidgetDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::TurnstileIdentifier, String>,
sitekey: Result<types::TurnstileSitekey, String>,
}
impl<'a> AccountsTurnstileWidgetDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
sitekey: Err("sitekey was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TurnstileIdentifier` for account_id failed".to_string()
});
self
}
pub fn sitekey<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileSitekey>,
{
self.sitekey = value
.try_into()
.map_err(|_| "conversion to `TurnstileSitekey` for sitekey failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
sitekey,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let sitekey = sitekey.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/challenges/widgets/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&sitekey.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "accounts_turnstile_widget_delete",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountsTurnstileWidgetRotateSecret<'a> {
client: &'a crate::Client,
account_id: Result<types::TurnstileIdentifier, String>,
sitekey: Result<types::TurnstileSitekey, String>,
body: Result<types::builder::AccountsTurnstileWidgetRotateSecretBody, String>,
}
impl<'a> AccountsTurnstileWidgetRotateSecret<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
sitekey: Err("sitekey was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `TurnstileIdentifier` for account_id failed".to_string()
});
self
}
pub fn sitekey<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::TurnstileSitekey>,
{
self.sitekey = value
.try_into()
.map_err(|_| "conversion to `TurnstileSitekey` for sitekey failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountsTurnstileWidgetRotateSecretBody>,
<V as std::convert::TryInto<types::AccountsTurnstileWidgetRotateSecretBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountsTurnstileWidgetRotateSecretBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountsTurnstileWidgetRotateSecretBody,
)
-> types::builder::AccountsTurnstileWidgetRotateSecretBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
sitekey,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let sitekey = sitekey.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountsTurnstileWidgetRotateSecretBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/challenges/widgets/{}/rotate_secret",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&sitekey.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "accounts_turnstile_widget_rotate_secret",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountPermissionGroupList<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
id: Result<types::AccountPermissionGroupListId, String>,
label: Result<::std::string::String, String>,
name: Result<::std::string::String, String>,
page: Result<f64, String>,
per_page: Result<f64, String>,
}
impl<'a> AccountPermissionGroupList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
label: Err("label was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountPermissionGroupListId>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `AccountPermissionGroupListId` for id failed".to_string()
});
self
}
pub fn label<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.label = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for label failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for name failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `f64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `f64` for per_page failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
id,
label,
name,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let label = label.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/permission_groups",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("id", &id))
.query(&progenitor_client::QueryParam::new("label", &label))
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_permission_group_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountPermissionGroupDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
permission_group_id: Result<types::IamPermissionGroupIdentifier, String>,
}
impl<'a> AccountPermissionGroupDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
permission_group_id: Err("permission_group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn permission_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamPermissionGroupIdentifier>,
{
self.permission_group_id = value.try_into().map_err(|_| {
"conversion to `IamPermissionGroupIdentifier` for permission_group_id failed"
.to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
permission_group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let permission_group_id = permission_group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/permission_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&permission_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_permission_group_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountResourceGroupList<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
id: Result<types::IamResourceGroupIdentifier, String>,
name: Result<::std::string::String, String>,
}
impl<'a> AccountResourceGroupList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
id: Err("id was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamResourceGroupIdentifier>,
{
self.id = value.try_into().map_err(|_| {
"conversion to `IamResourceGroupIdentifier` for id failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for name failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
id,
name,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let id = id.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/resource_groups",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("id", &id))
.query(&progenitor_client::QueryParam::new("name", &name))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_resource_group_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountResourceGroupCreate<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
body: Result<types::builder::IamRequestCreateResourceGroup, String>,
}
impl<'a> AccountResourceGroupCreate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamRequestCreateResourceGroup>,
<V as std::convert::TryInto<types::IamRequestCreateResourceGroup>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `IamRequestCreateResourceGroup` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::IamRequestCreateResourceGroup,
) -> types::builder::IamRequestCreateResourceGroup,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::IamRequestCreateResourceGroup::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/resource_groups",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_resource_group_create",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountResourceGroupDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
resource_group_id: Result<types::IamResourceGroupIdentifier, String>,
}
impl<'a> AccountResourceGroupDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
resource_group_id: Err("resource_group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn resource_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamResourceGroupIdentifier>,
{
self.resource_group_id = value.try_into().map_err(|_| {
"conversion to `IamResourceGroupIdentifier` for resource_group_id failed"
.to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
resource_group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let resource_group_id = resource_group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/resource_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&resource_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_resource_group_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountResourceGroupUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
resource_group_id: Result<types::IamResourceGroupIdentifier, String>,
body: Result<types::builder::IamRequestUpdateResourceGroup, String>,
}
impl<'a> AccountResourceGroupUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
resource_group_id: Err("resource_group_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn resource_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamResourceGroupIdentifier>,
{
self.resource_group_id = value.try_into().map_err(|_| {
"conversion to `IamResourceGroupIdentifier` for resource_group_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamRequestUpdateResourceGroup>,
<V as std::convert::TryInto<types::IamRequestUpdateResourceGroup>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `IamRequestUpdateResourceGroup` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::IamRequestUpdateResourceGroup,
) -> types::builder::IamRequestUpdateResourceGroup,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
resource_group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let resource_group_id = resource_group_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::IamRequestUpdateResourceGroup::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/resource_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&resource_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_resource_group_update",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountResourceGroupDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
resource_group_id: Result<types::IamResourceGroupIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountResourceGroupDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
resource_group_id: Err("resource_group_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn resource_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamResourceGroupIdentifier>,
{
self.resource_group_id = value.try_into().map_err(|_| {
"conversion to `IamResourceGroupIdentifier` for resource_group_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
resource_group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let resource_group_id = resource_group_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/resource_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&resource_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_resource_group_delete",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
}
impl<'a> AccountUserGroupDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
body: Result<types::builder::IamUpdateUserGroupBody, String>,
}
impl<'a> AccountUserGroupUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUpdateUserGroupBody>,
<V as std::convert::TryInto<types::IamUpdateUserGroupBody>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `IamUpdateUserGroupBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::IamUpdateUserGroupBody,
) -> types::builder::IamUpdateUserGroupBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::IamUpdateUserGroupBody::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_update",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
}
impl<'a> AccountUserGroupDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_delete",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupMemberList<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
page: Result<f64, String>,
per_page: Result<f64, String>,
}
impl<'a> AccountUserGroupMemberList<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `f64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `f64` for per_page failed".to_string());
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}/members",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_member_list",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupMembersUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
body: Result<::std::vec::Vec<types::UpdateUserGroupMembersItem>, String>,
}
impl<'a> AccountUserGroupMembersUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::UpdateUserGroupMembersItem>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < UpdateUserGroupMembersItem >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}/members",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_members_update",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupMemberCreate<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
body: Result<::std::vec::Vec<types::AccountUserGroupMemberCreateBodyItem>, String>,
}
impl<'a> AccountUserGroupMemberCreate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::vec::Vec<types::AccountUserGroupMemberCreateBodyItem>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: std :: vec :: Vec < AccountUserGroupMemberCreateBodyItem >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}/members",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_member_create",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountUserGroupMemberDelete<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
user_group_id: Result<types::IamUserGroupIdentifier, String>,
member_id: Result<types::IamUserGroupMemberIdentifier, String>,
}
impl<'a> AccountUserGroupMemberDelete<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
user_group_id: Err("user_group_id was not initialized".to_string()),
member_id: Err("member_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn user_group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupIdentifier>,
{
self.user_group_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupIdentifier` for user_group_id failed".to_string()
});
self
}
pub fn member_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamUserGroupMemberIdentifier>,
{
self.member_id = value.try_into().map_err(|_| {
"conversion to `IamUserGroupMemberIdentifier` for member_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
user_group_id,
member_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let user_group_id = user_group_id.map_err(Error::InvalidRequest)?;
let member_id = member_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/iam/user_groups/{}/members/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&user_group_id.to_string()),
encode_path(&member_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_user_group_member_delete",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsListMonitors<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
}
impl<'a> AccountLoadBalancerMonitorsListMonitors<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self { client, account_id } = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_list_monitors",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsCreateMonitor<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
body: Result<types::builder::LoadBalancingMonitorEditable, String>,
}
impl<'a> AccountLoadBalancerMonitorsCreateMonitor<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingMonitorEditable>,
<V as std::convert::TryInto<types::LoadBalancingMonitorEditable>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `LoadBalancingMonitorEditable` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::LoadBalancingMonitorEditable,
) -> types::builder::LoadBalancingMonitorEditable,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::LoadBalancingMonitorEditable::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_create_monitor",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsMonitorDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor_id: Result<types::LoadBalancingIdentifier, String>,
}
impl<'a> AccountLoadBalancerMonitorsMonitorDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor_id: Err("monitor_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingIdentifier>,
{
self.monitor_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingIdentifier` for monitor_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor_id = monitor_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&monitor_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_monitor_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsUpdateMonitor<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor_id: Result<types::LoadBalancingIdentifier, String>,
body: Result<types::builder::LoadBalancingMonitorEditable, String>,
}
impl<'a> AccountLoadBalancerMonitorsUpdateMonitor<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor_id: Err("monitor_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingIdentifier>,
{
self.monitor_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingIdentifier` for monitor_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingMonitorEditable>,
<V as std::convert::TryInto<types::LoadBalancingMonitorEditable>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `LoadBalancingMonitorEditable` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::LoadBalancingMonitorEditable,
) -> types::builder::LoadBalancingMonitorEditable,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor_id = monitor_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::LoadBalancingMonitorEditable::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&monitor_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_update_monitor",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsDeleteMonitor<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor_id: Result<types::LoadBalancingIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountLoadBalancerMonitorsDeleteMonitor<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor_id: Err("monitor_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingIdentifier>,
{
self.monitor_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingIdentifier` for monitor_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor_id = monitor_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&monitor_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_delete_monitor",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsPatchMonitor<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor_id: Result<types::LoadBalancingIdentifier, String>,
body: Result<types::builder::LoadBalancingMonitorEditable, String>,
}
impl<'a> AccountLoadBalancerMonitorsPatchMonitor<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor_id: Err("monitor_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingIdentifier>,
{
self.monitor_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingIdentifier` for monitor_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingMonitorEditable>,
<V as std::convert::TryInto<types::LoadBalancingMonitorEditable>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `LoadBalancingMonitorEditable` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::LoadBalancingMonitorEditable,
) -> types::builder::LoadBalancingMonitorEditable,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor_id = monitor_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::LoadBalancingMonitorEditable::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&monitor_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_patch_monitor",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsPreviewMonitor<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor_id: Result<types::LoadBalancingIdentifier, String>,
body: Result<types::builder::LoadBalancingMonitorEditable, String>,
}
impl<'a> AccountLoadBalancerMonitorsPreviewMonitor<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor_id: Err("monitor_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingIdentifier>,
{
self.monitor_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingIdentifier` for monitor_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingMonitorEditable>,
<V as std::convert::TryInto<types::LoadBalancingMonitorEditable>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `LoadBalancingMonitorEditable` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::LoadBalancingMonitorEditable,
) -> types::builder::LoadBalancingMonitorEditable,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor_id = monitor_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::LoadBalancingMonitorEditable::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/monitors/{}/preview",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&monitor_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_preview_monitor",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsListPools<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
monitor: Result<::std::string::String, String>,
}
impl<'a> AccountLoadBalancerPoolsListPools<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
monitor: Err("monitor was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn monitor<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.monitor = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for monitor failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
monitor,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let monitor = monitor.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("monitor", &monitor))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_list_pools",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsCreatePool<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
body: Result<types::builder::AccountLoadBalancerPoolsCreatePoolBody, String>,
}
impl<'a> AccountLoadBalancerPoolsCreatePool<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountLoadBalancerPoolsCreatePoolBody>,
<V as std::convert::TryInto<types::AccountLoadBalancerPoolsCreatePoolBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountLoadBalancerPoolsCreatePoolBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountLoadBalancerPoolsCreatePoolBody,
)
-> types::builder::AccountLoadBalancerPoolsCreatePoolBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountLoadBalancerPoolsCreatePoolBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_create_pool",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsPatchPools<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
body: Result<::std::string::String, String>,
}
impl<'a> AccountLoadBalancerPoolsPatchPools<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.body = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for body failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_patch_pools",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsPoolDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
}
impl<'a> AccountLoadBalancerPoolsPoolDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_pool_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsUpdatePool<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
body: Result<types::builder::AccountLoadBalancerPoolsUpdatePoolBody, String>,
}
impl<'a> AccountLoadBalancerPoolsUpdatePool<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountLoadBalancerPoolsUpdatePoolBody>,
<V as std::convert::TryInto<types::AccountLoadBalancerPoolsUpdatePoolBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountLoadBalancerPoolsUpdatePoolBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountLoadBalancerPoolsUpdatePoolBody,
)
-> types::builder::AccountLoadBalancerPoolsUpdatePoolBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountLoadBalancerPoolsUpdatePoolBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_update_pool",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsDeletePool<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountLoadBalancerPoolsDeletePool<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_delete_pool",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsPatchPool<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
body: Result<types::builder::AccountLoadBalancerPoolsPatchPoolBody, String>,
}
impl<'a> AccountLoadBalancerPoolsPatchPool<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountLoadBalancerPoolsPatchPoolBody>,
<V as std::convert::TryInto<types::AccountLoadBalancerPoolsPatchPoolBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountLoadBalancerPoolsPatchPoolBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountLoadBalancerPoolsPatchPoolBody,
)
-> types::builder::AccountLoadBalancerPoolsPatchPoolBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountLoadBalancerPoolsPatchPoolBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.patch(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_patch_pool",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsPoolHealthDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
}
impl<'a> AccountLoadBalancerPoolsPoolHealthDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}/health",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_pool_health_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsPreviewPool<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
body: Result<types::builder::LoadBalancingMonitorEditable, String>,
}
impl<'a> AccountLoadBalancerPoolsPreviewPool<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingMonitorEditable>,
<V as std::convert::TryInto<types::LoadBalancingMonitorEditable>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `LoadBalancingMonitorEditable` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::LoadBalancingMonitorEditable,
) -> types::builder::LoadBalancingMonitorEditable,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::LoadBalancingMonitorEditable::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}/preview",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_preview_pool",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerPoolsListPoolReferences<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
pool_id: Result<types::LoadBalancingSchemasIdentifier, String>,
}
impl<'a> AccountLoadBalancerPoolsListPoolReferences<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
pool_id: Err("pool_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn pool_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasIdentifier>,
{
self.pool_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasIdentifier` for pool_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
pool_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let pool_id = pool_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/pools/{}/references",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&pool_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_pools_list_pool_references",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerMonitorsPreviewResult<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
preview_id: Result<types::LoadBalancingSchemasPreviewId, String>,
}
impl<'a> AccountLoadBalancerMonitorsPreviewResult<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
preview_id: Err("preview_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn preview_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingSchemasPreviewId>,
{
self.preview_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingSchemasPreviewId` for preview_id failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
preview_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let preview_id = preview_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/preview/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&preview_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_monitors_preview_result",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountLoadBalancerSearchSearchResources<'a> {
client: &'a crate::Client,
account_id: Result<types::LoadBalancingComponentsSchemasIdentifier, String>,
page: Result<f64, String>,
per_page: Result<f64, String>,
query: Result<::std::string::String, String>,
references: Result<types::AccountLoadBalancerSearchSearchResourcesReferences, String>,
}
impl<'a> AccountLoadBalancerSearchSearchResources<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
query: Err("query was not initialized".to_string()),
references: Err("references was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::LoadBalancingComponentsSchemasIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `LoadBalancingComponentsSchemasIdentifier` for account_id failed"
.to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `f64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<f64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `f64` for per_page failed".to_string());
self
}
pub fn query<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.query = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for query failed".to_string()
});
self
}
pub fn references<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountLoadBalancerSearchSearchResourcesReferences>,
{
self . references = value . try_into () . map_err (| _ | "conversion to `AccountLoadBalancerSearchSearchResourcesReferences` for references failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
page,
per_page,
query,
references,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let query = query.map_err(Error::InvalidRequest)?;
let references = references.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/load_balancers/search",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("query", &query))
.query(&progenitor_client::QueryParam::new(
"references",
&references,
))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_load_balancer_search_search_resources",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountMembersMemberDetails<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
member_id: Result<types::IamMembershipComponentsSchemasIdentifier, String>,
}
impl<'a> AccountMembersMemberDetails<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
member_id: Err("member_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn member_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamMembershipComponentsSchemasIdentifier>,
{
self.member_id = value.try_into().map_err(|_| {
"conversion to `IamMembershipComponentsSchemasIdentifier` for member_id failed"
.to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
member_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let member_id = member_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/members/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&member_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_members_member_details",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountMembersUpdateMember<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
member_id: Result<types::IamMembershipComponentsSchemasIdentifier, String>,
body: Result<types::AccountMembersUpdateMemberBody, String>,
}
impl<'a> AccountMembersUpdateMember<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
member_id: Err("member_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn member_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamMembershipComponentsSchemasIdentifier>,
{
self.member_id = value.try_into().map_err(|_| {
"conversion to `IamMembershipComponentsSchemasIdentifier` for member_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountMembersUpdateMemberBody>,
{
self.body = value.try_into().map_err(|_| {
"conversion to `AccountMembersUpdateMemberBody` for body failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
member_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let member_id = member_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/members/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&member_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_members_update_member",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountMembersRemoveMember<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
member_id: Result<types::IamMembershipComponentsSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountMembersRemoveMember<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
member_id: Err("member_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn member_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamMembershipComponentsSchemasIdentifier>,
{
self.member_id = value.try_into().map_err(|_| {
"conversion to `IamMembershipComponentsSchemasIdentifier` for member_id failed"
.to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
member_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let member_id = member_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/members/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&member_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_members_remove_member",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountRequestTracerRequestTrace<'a> {
client: &'a crate::Client,
account_id: Result<types::RequestTracerIdentifier, String>,
body: Result<types::builder::AccountRequestTracerRequestTraceBody, String>,
}
impl<'a> AccountRequestTracerRequestTrace<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::RequestTracerIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `RequestTracerIdentifier` for account_id failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccountRequestTracerRequestTraceBody>,
<V as std::convert::TryInto<types::AccountRequestTracerRequestTraceBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccountRequestTracerRequestTraceBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccountRequestTracerRequestTraceBody,
)
-> types::builder::AccountRequestTracerRequestTraceBody,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccountRequestTracerRequestTraceBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/request-tracer/trace",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_request_tracer_request_trace",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountSubscriptionsUpdateSubscription<'a> {
client: &'a crate::Client,
account_id: Result<types::BillSubsApiIdentifier, String>,
subscription_identifier: Result<types::BillSubsApiSchemasIdentifier, String>,
body: Result<types::builder::BillSubsApiSubscriptionV2, String>,
}
impl<'a> AccountSubscriptionsUpdateSubscription<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
subscription_identifier: Err(
"subscription_identifier was not initialized".to_string()
),
body: Ok(::std::default::Default::default()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::BillSubsApiIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `BillSubsApiIdentifier` for account_id failed".to_string()
});
self
}
pub fn subscription_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::BillSubsApiSchemasIdentifier>,
{
self . subscription_identifier = value . try_into () . map_err (| _ | "conversion to `BillSubsApiSchemasIdentifier` for subscription_identifier failed" . to_string ()) ;
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::BillSubsApiSubscriptionV2>,
<V as std::convert::TryInto<types::BillSubsApiSubscriptionV2>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `BillSubsApiSubscriptionV2` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::BillSubsApiSubscriptionV2,
) -> types::builder::BillSubsApiSubscriptionV2,
{
self.body = self.body.map(f);
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
subscription_identifier,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let subscription_identifier = subscription_identifier.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::BillSubsApiSubscriptionV2::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/subscriptions/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&subscription_identifier.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_subscriptions_update_subscription",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountSubscriptionsDeleteSubscription<'a> {
client: &'a crate::Client,
account_id: Result<types::BillSubsApiIdentifier, String>,
subscription_identifier: Result<types::BillSubsApiSchemasIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountSubscriptionsDeleteSubscription<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
subscription_identifier: Err(
"subscription_identifier was not initialized".to_string()
),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::BillSubsApiIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `BillSubsApiIdentifier` for account_id failed".to_string()
});
self
}
pub fn subscription_identifier<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::BillSubsApiSchemasIdentifier>,
{
self . subscription_identifier = value . try_into () . map_err (| _ | "conversion to `BillSubsApiSchemasIdentifier` for subscription_identifier failed" . to_string ()) ;
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
subscription_identifier,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let subscription_identifier = subscription_identifier.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/subscriptions/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&subscription_identifier.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_subscriptions_delete_subscription",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountApiTokensDeleteToken<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
token_id: Result<types::IamTokenIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountApiTokensDeleteToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
token_id: Err("token_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamTokenIdentifier>,
{
self.token_id = value
.try_into()
.map_err(|_| "conversion to `IamTokenIdentifier` for token_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
token_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let token_id = token_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/tokens/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&token_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.delete(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_api_tokens_delete_token",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountApiTokensRollToken<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
token_id: Result<types::IamTokenIdentifier, String>,
body: Result<::serde_json::Map<::std::string::String, ::serde_json::Value>, String>,
}
impl<'a> AccountApiTokensRollToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
token_id: Err("token_id was not initialized".to_string()),
body: Err("body was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamTokenIdentifier>,
{
self.token_id = value
.try_into()
.map_err(|_| "conversion to `IamTokenIdentifier` for token_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
{
self . body = value . try_into () . map_err (| _ | "conversion to `:: serde_json :: Map < :: std :: string :: String , :: serde_json :: Value >` for body failed" . to_string ()) ;
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
token_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let token_id = token_id.map_err(Error::InvalidRequest)?;
let body = body.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/tokens/{}/value",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&token_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.put(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_api_tokens_roll_token",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccountApiTokensListPermissionGroups<'a> {
client: &'a crate::Client,
account_id: Result<types::IamAccountIdentifier, String>,
name: Result<::std::string::String, String>,
scope: Result<::std::string::String, String>,
}
impl<'a> AccountApiTokensListPermissionGroups<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
name: Err("name was not initialized".to_string()),
scope: Err("scope was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::IamAccountIdentifier>,
{
self.account_id = value.try_into().map_err(|_| {
"conversion to `IamAccountIdentifier` for account_id failed".to_string()
});
self
}
pub fn name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.name = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for name failed".to_string()
});
self
}
pub fn scope<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.scope = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for scope failed".to_string()
});
self
}
pub async fn send(
self,
) -> Result<
ResponseValue<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
Error<()>,
> {
let Self {
client,
account_id,
name,
scope,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let name = name.map_err(Error::InvalidRequest)?;
let scope = scope.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/tokens/permission_groups",
client.baseurl,
encode_path(&account_id.to_string()),
);
let mut header_map = ::reqwest::header::HeaderMap::with_capacity(1usize);
header_map.append(
::reqwest::header::HeaderName::from_static("api-version"),
::reqwest::header::HeaderValue::from_static(crate::Client::api_version()),
);
#[allow(unused_mut)]
let mut request = client
.client
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.query(&progenitor_client::QueryParam::new("name", &name))
.query(&progenitor_client::QueryParam::new("scope", &scope))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "account_api_tokens_list_permission_groups",
};
client.pre(&mut request, &info).await?;
let result = client.exec(request, &info).await;
client.post(&result, &info).await?;
let response = result?;
match response.status().as_u16() {
200u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}