use super::types;
use crate::{
ByteStream, ClientHooks, ClientInfo, Error, OperationInfo, RequestBuilderExt,
ResponseValue, encode_path,
};
#[derive(Debug, Clone)]
pub struct AccessApplicationsGetAnAccessApplication<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessAppId, String>,
}
impl<'a> AccessApplicationsGetAnAccessApplication<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppId>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessAppId` for app_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,
app_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_applications_get_an_access_application",
};
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 AccessApplicationsUpdateAnAccessApplication<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessAppId, String>,
body: Result<types::builder::AccessAppRequest, String>,
}
impl<'a> AccessApplicationsUpdateAnAccessApplication<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppId>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessAppId` for app_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppRequest>,
<V as std::convert::TryInto<types::AccessAppRequest>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `AccessAppRequest` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessAppRequest,
) -> types::builder::AccessAppRequest,
{
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,
app_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::AccessAppRequest::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_applications_update_an_access_application",
};
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 AccessApplicationsDeleteAnAccessApplication<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessAppId, String>,
}
impl<'a> AccessApplicationsDeleteAnAccessApplication<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppId>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessAppId` for app_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,
app_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_applications_delete_an_access_application",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessPoliciesListAccessAppPolicies<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
page: Result<i64, String>,
per_page: Result<i64, String>,
}
impl<'a> AccessPoliciesListAccessAppPolicies<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `i64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` 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,
app_id,
page,
per_page,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_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/{}/access/apps/{}/policies",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_policies_list_access_app_policies",
};
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 AccessPoliciesCreateAnAccessPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessAppPolicyRequest, String>,
}
impl<'a> AccessPoliciesCreateAnAccessPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppPolicyRequest>,
<V as std::convert::TryInto<types::AccessAppPolicyRequest>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccessAppPolicyRequest` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessAppPolicyRequest,
) -> types::builder::AccessAppPolicyRequest,
{
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,
app_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::AccessAppPolicyRequest::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/policies",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_policies_create_an_access_policy",
};
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() {
201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessPoliciesGetAnAccessPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
policy_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessPoliciesGetAnAccessPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for policy_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,
app_id,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_id.to_string()),
encode_path(&policy_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: "access_policies_get_an_access_policy",
};
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 AccessPoliciesUpdateAnAccessPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
policy_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessAppPolicyRequest, String>,
}
impl<'a> AccessPoliciesUpdateAnAccessPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
policy_id: Err("policy_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for policy_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppPolicyRequest>,
<V as std::convert::TryInto<types::AccessAppPolicyRequest>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccessAppPolicyRequest` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessAppPolicyRequest,
) -> types::builder::AccessAppPolicyRequest,
{
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,
app_id,
policy_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::AccessAppPolicyRequest::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_id.to_string()),
encode_path(&policy_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: "access_policies_update_an_access_policy",
};
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 AccessPoliciesDeleteAnAccessPolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
policy_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessPoliciesDeleteAnAccessPolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for policy_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,
app_id,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_id.to_string()),
encode_path(&policy_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: "access_policies_delete_an_access_policy",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessPoliciesConvertReusable<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessUuid, String>,
policy_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessPoliciesConvertReusable<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for app_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for policy_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,
app_id,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/policies/{}/make_reusable",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_id.to_string()),
encode_path(&policy_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_policies_convert_reusable",
};
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 AccessApplicationsRevokeServiceTokens<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessAppId, String>,
}
impl<'a> AccessApplicationsRevokeServiceTokens<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppId>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessAppId` for app_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,
app_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/revoke_tokens",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_applications_revoke_service_tokens",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessApplicationsTestAccessPolicies<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
app_id: Result<types::AccessAppId, String>,
}
impl<'a> AccessApplicationsTestAccessPolicies<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
app_id: Err("app_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn app_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessAppId>,
{
self.app_id = value
.try_into()
.map_err(|_| "conversion to `AccessAppId` for app_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,
app_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let app_id = app_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/apps/{}/user_policy_checks",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&app_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: "access_applications_test_access_policies",
};
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 AccessCustomPagesListCustomPages<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
page: Result<i64, String>,
per_page: Result<i64, String>,
}
impl<'a> AccessCustomPagesListCustomPages<'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()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `i64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` 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,
page,
per_page,
} = 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 url = format!(
"{}/accounts/{}/access/custom_pages",
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))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_custom_pages_list_custom_pages",
};
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 AccessCustomPagesCreateACustomPage<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
body: Result<types::builder::AccessCustomPage, String>,
}
impl<'a> AccessCustomPagesCreateACustomPage<'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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessCustomPage>,
<V as std::convert::TryInto<types::AccessCustomPage>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `AccessCustomPage` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessCustomPage,
) -> types::builder::AccessCustomPage,
{
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::AccessCustomPage::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/custom_pages",
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: "access_custom_pages_create_a_custom_page",
};
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() {
201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessCustomPagesGetACustomPage<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
custom_page_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessCustomPagesGetACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
custom_page_id: Err("custom_page_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn custom_page_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.custom_page_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for custom_page_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,
custom_page_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let custom_page_id = custom_page_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/custom_pages/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&custom_page_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: "access_custom_pages_get_a_custom_page",
};
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 AccessCustomPagesUpdateACustomPage<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
custom_page_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessCustomPage, String>,
}
impl<'a> AccessCustomPagesUpdateACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
custom_page_id: Err("custom_page_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn custom_page_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.custom_page_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for custom_page_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessCustomPage>,
<V as std::convert::TryInto<types::AccessCustomPage>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `AccessCustomPage` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessCustomPage,
) -> types::builder::AccessCustomPage,
{
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,
custom_page_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let custom_page_id = custom_page_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::AccessCustomPage::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/custom_pages/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&custom_page_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: "access_custom_pages_update_a_custom_page",
};
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 AccessCustomPagesDeleteACustomPage<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
custom_page_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessCustomPagesDeleteACustomPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
custom_page_id: Err("custom_page_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn custom_page_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.custom_page_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for custom_page_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,
custom_page_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let custom_page_id = custom_page_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/custom_pages/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&custom_page_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: "access_custom_pages_delete_a_custom_page",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessGatewayCaDeleteAnSshCa<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
certificate_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessGatewayCaDeleteAnSshCa<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
certificate_id: Err("certificate_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn certificate_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.certificate_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for certificate_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,
certificate_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let certificate_id = certificate_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/gateway_ca/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&certificate_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: "access_gateway_ca_delete_an_ssh_ca",
};
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 AccessGroupsGetAnAccessGroup<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
group_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessGroupsGetAnAccessGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
group_id: Err("group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.group_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for 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,
group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let group_id = group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "access_groups_get_an_access_group",
};
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 AccessGroupsUpdateAnAccessGroup<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
group_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessGroupsUpdateAnAccessGroupBody, String>,
}
impl<'a> AccessGroupsUpdateAnAccessGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
group_id: Err("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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.group_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for group_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessGroupsUpdateAnAccessGroupBody>,
<V as std::convert::TryInto<types::AccessGroupsUpdateAnAccessGroupBody>>::Error:
std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccessGroupsUpdateAnAccessGroupBody` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessGroupsUpdateAnAccessGroupBody,
) -> types::builder::AccessGroupsUpdateAnAccessGroupBody,
{
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,
group_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let group_id = group_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccessGroupsUpdateAnAccessGroupBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "access_groups_update_an_access_group",
};
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 AccessGroupsDeleteAnAccessGroup<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
group_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessGroupsDeleteAnAccessGroup<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
group_id: Err("group_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn group_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.group_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for 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,
group_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let group_id = group_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/groups/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&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: "access_groups_delete_an_access_group",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessKeyConfigurationRotateAccessKeys<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
}
impl<'a> AccessKeyConfigurationRotateAccessKeys<'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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` 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/{}/access/keys/rotate",
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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_key_configuration_rotate_access_keys",
};
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 AccessPoliciesGetAnAccessReusablePolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
policy_id: Result<types::AccessSchemasUuid, String>,
}
impl<'a> AccessPoliciesGetAnAccessReusablePolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessSchemasUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessSchemasUuid` for policy_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,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_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: "access_policies_get_an_access_reusable_policy",
};
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 AccessPoliciesUpdateAnAccessReusablePolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
policy_id: Result<types::AccessSchemasUuid, String>,
body: Result<types::builder::AccessPolicyReq, String>,
}
impl<'a> AccessPoliciesUpdateAnAccessReusablePolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessSchemasUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessSchemasUuid` for policy_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessPolicyReq>,
<V as std::convert::TryInto<types::AccessPolicyReq>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `AccessPolicyReq` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(types::builder::AccessPolicyReq) -> types::builder::AccessPolicyReq,
{
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,
policy_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| types::AccessPolicyReq::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_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: "access_policies_update_an_access_reusable_policy",
};
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 AccessPoliciesDeleteAnAccessReusablePolicy<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
policy_id: Result<types::AccessSchemasUuid, String>,
}
impl<'a> AccessPoliciesDeleteAnAccessReusablePolicy<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_id: Err("policy_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn policy_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessSchemasUuid>,
{
self.policy_id = value
.try_into()
.map_err(|_| "conversion to `AccessSchemasUuid` for policy_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,
policy_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_id = policy_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policies/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_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: "access_policies_delete_an_access_reusable_policy",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessPolicyTests<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
body: Result<types::builder::AccessPolicyInitReq, String>,
}
impl<'a> AccessPolicyTests<'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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessPolicyInitReq>,
<V as std::convert::TryInto<types::AccessPolicyInitReq>>::Error: std::fmt::Display,
{
self.body = value
.try_into()
.map(From::from)
.map_err(|s| format!("conversion to `AccessPolicyInitReq` for body failed: {}", s));
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessPolicyInitReq,
) -> types::builder::AccessPolicyInitReq,
{
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::AccessPolicyInitReq::try_from(v).map_err(|e| e.to_string()))
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policy-tests",
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: "access_policy_tests",
};
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 AccessPolicyTestsGetAnUpdate<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
policy_test_id: Result<types::AccessPolicyTestId, String>,
}
impl<'a> AccessPolicyTestsGetAnUpdate<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_test_id: Err("policy_test_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn policy_test_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessPolicyTestId>,
{
self.policy_test_id = value.try_into().map_err(|_| {
"conversion to `AccessPolicyTestId` for policy_test_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,
policy_test_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_test_id = policy_test_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policy-tests/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_test_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: "access_policy_tests_get_an_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 AccessPolicyTestsGetAUserPage<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
policy_test_id: Result<types::AccessPolicyTestId, String>,
page: Result<i64, String>,
per_page: Result<i64, String>,
status: Result<types::AccessPolicyTestsGetAUserPageStatus, String>,
}
impl<'a> AccessPolicyTestsGetAUserPage<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
policy_test_id: Err("policy_test_id was not initialized".to_string()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
status: Err("status was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn policy_test_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessPolicyTestId>,
{
self.policy_test_id = value.try_into().map_err(|_| {
"conversion to `AccessPolicyTestId` for policy_test_id failed".to_string()
});
self
}
pub fn page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `i64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` for per_page failed".to_string());
self
}
pub fn status<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessPolicyTestsGetAUserPageStatus>,
{
self.status = value.try_into().map_err(|_| {
"conversion to `AccessPolicyTestsGetAUserPageStatus` for status 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,
policy_test_id,
page,
per_page,
status,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let policy_test_id = policy_test_id.map_err(Error::InvalidRequest)?;
let page = page.map_err(Error::InvalidRequest)?;
let per_page = per_page.map_err(Error::InvalidRequest)?;
let status = status.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/policy-tests/{}/users",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&policy_test_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("status", &status))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_policy_tests_get_a_user_page",
};
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 AccessServiceTokensListServiceTokens<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
name: Result<::std::string::String, String>,
page: Result<i64, String>,
per_page: Result<i64, String>,
search: Result<::std::string::String, String>,
}
impl<'a> AccessServiceTokensListServiceTokens<'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()),
page: Err("page was not initialized".to_string()),
per_page: Err("per_page was not initialized".to_string()),
search: Err("search was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` 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 page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.page = value
.try_into()
.map_err(|_| "conversion to `i64` for page failed".to_string());
self
}
pub fn per_page<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<i64>,
{
self.per_page = value
.try_into()
.map_err(|_| "conversion to `i64` for per_page failed".to_string());
self
}
pub fn search<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<::std::string::String>,
{
self.search = value.try_into().map_err(|_| {
"conversion to `:: std :: string :: String` for search 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,
page,
per_page,
search,
} = self;
let account_id = account_id.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 search = search.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens",
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("page", &page))
.query(&progenitor_client::QueryParam::new("per_page", &per_page))
.query(&progenitor_client::QueryParam::new("search", &search))
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_service_tokens_list_service_tokens",
};
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 AccessServiceTokensCreateAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
body: Result<types::builder::AccessServiceTokensCreateAServiceTokenBody, String>,
}
impl<'a> AccessServiceTokensCreateAServiceToken<'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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessServiceTokensCreateAServiceTokenBody>,
<V as std::convert::TryInto<types::AccessServiceTokensCreateAServiceTokenBody>>::Error:
std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `AccessServiceTokensCreateAServiceTokenBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessServiceTokensCreateAServiceTokenBody,
)
-> types::builder::AccessServiceTokensCreateAServiceTokenBody,
{
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::AccessServiceTokensCreateAServiceTokenBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens",
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: "access_service_tokens_create_a_service_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() {
201u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}
#[derive(Debug, Clone)]
pub struct AccessServiceTokensGetAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
service_token_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessServiceTokensGetAServiceToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
service_token_id: Err("service_token_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn service_token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.service_token_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for service_token_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,
service_token_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let service_token_id = service_token_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&service_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
.get(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_service_tokens_get_a_service_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 AccessServiceTokensUpdateAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
service_token_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessServiceTokensUpdateAServiceTokenBody, String>,
}
impl<'a> AccessServiceTokensUpdateAServiceToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
service_token_id: Err("service_token_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn service_token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.service_token_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for service_token_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessServiceTokensUpdateAServiceTokenBody>,
<V as std::convert::TryInto<types::AccessServiceTokensUpdateAServiceTokenBody>>::Error:
std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `AccessServiceTokensUpdateAServiceTokenBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessServiceTokensUpdateAServiceTokenBody,
)
-> types::builder::AccessServiceTokensUpdateAServiceTokenBody,
{
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,
service_token_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let service_token_id = service_token_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccessServiceTokensUpdateAServiceTokenBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&service_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: "access_service_tokens_update_a_service_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 AccessServiceTokensDeleteAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
service_token_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessServiceTokensDeleteAServiceToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
service_token_id: Err("service_token_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn service_token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.service_token_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for service_token_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,
service_token_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let service_token_id = service_token_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&service_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"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_service_tokens_delete_a_service_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 AccessServiceTokensRefreshAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
service_token_id: Result<types::AccessUuid, String>,
}
impl<'a> AccessServiceTokensRefreshAServiceToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
service_token_id: Err("service_token_id was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn service_token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.service_token_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for service_token_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,
service_token_id,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let service_token_id = service_token_id.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens/{}/refresh",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&service_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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_service_tokens_refresh_a_service_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 AccessServiceTokensRotateAServiceToken<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
service_token_id: Result<types::AccessUuid, String>,
body: Result<types::builder::AccessServiceTokensRotateAServiceTokenBody, String>,
}
impl<'a> AccessServiceTokensRotateAServiceToken<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
service_token_id: Err("service_token_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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn service_token_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessUuid>,
{
self.service_token_id = value
.try_into()
.map_err(|_| "conversion to `AccessUuid` for service_token_id failed".to_string());
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessServiceTokensRotateAServiceTokenBody>,
<V as std::convert::TryInto<types::AccessServiceTokensRotateAServiceTokenBody>>::Error:
std::fmt::Display,
{
self . body = value . try_into () . map (From :: from) . map_err (| s | format ! ("conversion to `AccessServiceTokensRotateAServiceTokenBody` for body failed: {}" , s)) ;
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessServiceTokensRotateAServiceTokenBody,
)
-> types::builder::AccessServiceTokensRotateAServiceTokenBody,
{
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,
service_token_id,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let service_token_id = service_token_id.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccessServiceTokensRotateAServiceTokenBody::try_from(v)
.map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/service_tokens/{}/rotate",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&service_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
.post(url)
.header(
::reqwest::header::ACCEPT,
::reqwest::header::HeaderValue::from_static("application/json"),
)
.json(&body)
.headers(header_map)
.build()?;
let info = OperationInfo {
operation_id: "access_service_tokens_rotate_a_service_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 AccessTagsGetATag<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
tag_name: Result<types::AccessTagsComponentsSchemasName, String>,
}
impl<'a> AccessTagsGetATag<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tag_name: Err("tag_name was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn tag_name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessTagsComponentsSchemasName>,
{
self.tag_name = value.try_into().map_err(|_| {
"conversion to `AccessTagsComponentsSchemasName` for tag_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,
tag_name,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tag_name = tag_name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/tags/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tag_name.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: "access_tags_get_a_tag",
};
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 AccessTagsUpdateATag<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
tag_name: Result<types::AccessTagsComponentsSchemasName, String>,
body: Result<types::builder::AccessTagWithoutAppCount, String>,
}
impl<'a> AccessTagsUpdateATag<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tag_name: Err("tag_name 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::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn tag_name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessTagsComponentsSchemasName>,
{
self.tag_name = value.try_into().map_err(|_| {
"conversion to `AccessTagsComponentsSchemasName` for tag_name failed".to_string()
});
self
}
pub fn body<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessTagWithoutAppCount>,
<V as std::convert::TryInto<types::AccessTagWithoutAppCount>>::Error: std::fmt::Display,
{
self.body = value.try_into().map(From::from).map_err(|s| {
format!(
"conversion to `AccessTagWithoutAppCount` for body failed: {}",
s
)
});
self
}
pub fn body<F>(mut self, f: F) -> Self
where
F: std::ops::FnOnce(
types::builder::AccessTagWithoutAppCount,
) -> types::builder::AccessTagWithoutAppCount,
{
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,
tag_name,
body,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tag_name = tag_name.map_err(Error::InvalidRequest)?;
let body = body
.and_then(|v| {
types::AccessTagWithoutAppCount::try_from(v).map_err(|e| e.to_string())
})
.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/tags/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tag_name.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: "access_tags_update_a_tag",
};
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 AccessTagsDeleteATag<'a> {
client: &'a crate::Client,
account_id: Result<types::AccessIdentifier, String>,
tag_name: Result<types::AccessTagsComponentsSchemasName, String>,
}
impl<'a> AccessTagsDeleteATag<'a> {
pub fn new(client: &'a crate::Client) -> Self {
Self {
client: client,
account_id: Err("account_id was not initialized".to_string()),
tag_name: Err("tag_name was not initialized".to_string()),
}
}
pub fn account_id<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessIdentifier>,
{
self.account_id = value
.try_into()
.map_err(|_| "conversion to `AccessIdentifier` for account_id failed".to_string());
self
}
pub fn tag_name<V>(mut self, value: V) -> Self
where
V: std::convert::TryInto<types::AccessTagsComponentsSchemasName>,
{
self.tag_name = value.try_into().map_err(|_| {
"conversion to `AccessTagsComponentsSchemasName` for tag_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,
tag_name,
} = self;
let account_id = account_id.map_err(Error::InvalidRequest)?;
let tag_name = tag_name.map_err(Error::InvalidRequest)?;
let url = format!(
"{}/accounts/{}/access/tags/{}",
client.baseurl,
encode_path(&account_id.to_string()),
encode_path(&tag_name.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: "access_tags_delete_a_tag",
};
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() {
202u16 => ResponseValue::from_response(response).await,
_ => Err(Error::UnexpectedResponse(response)),
}
}
}