use std::fmt::Write;
pub mod create_user_input {
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) home_directory: std::option::Option<std::string::String>,
pub(crate) description: std::option::Option<std::string::String>,
pub(crate) password_options: std::option::Option<crate::model::PasswordOptions>,
}
impl Builder {
pub fn home_directory(mut self, input: impl Into<std::string::String>) -> Self {
self.home_directory = Some(input.into());
self
}
pub fn set_home_directory(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.home_directory = input;
self
}
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
#[allow(missing_docs)] pub fn password_options(mut self, input: crate::model::PasswordOptions) -> Self {
self.password_options = Some(input);
self
}
#[allow(missing_docs)] pub fn set_password_options(
mut self,
input: std::option::Option<crate::model::PasswordOptions>,
) -> Self {
self.password_options = input;
self
}
pub fn build(
self,
) -> Result<crate::input::CreateUserInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::CreateUserInput {
home_directory: self.home_directory,
description: self.description,
password_options: self.password_options,
})
}
}
}
impl CreateUserInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateUser,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_endpoint(_config.endpoint_url.clone())
.set_stage(_config.stage.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::CreateUserInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/users").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateUserInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_create_user(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
if let Some(api_key_config) = _config.api_key() {
request.properties_mut().insert(api_key_config.clone());
let api_key = api_key_config.api_key();
let auth_definition = aws_smithy_http_auth::definition::HttpAuthDefinition::header(
"Authorization".to_owned(),
Some("Key".to_owned()),
);
let name = auth_definition.name();
let value = match auth_definition.scheme() {
Some(value) => format!("{value} {api_key}"),
None => api_key.to_owned(),
};
request.http_mut().headers_mut().insert(
http::header::HeaderName::from_bytes(name.as_bytes())
.expect("valid header name for api key auth"),
http::header::HeaderValue::from_bytes(value.as_bytes())
.expect("valid header value for api key auth"),
);
}
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::CreateUser::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateUser",
"sftp",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_user_input::Builder {
crate::input::create_user_input::Builder::default()
}
}
pub mod delete_user_input {
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) username: std::option::Option<std::string::String>,
}
impl Builder {
pub fn username(mut self, input: impl Into<std::string::String>) -> Self {
self.username = Some(input.into());
self
}
pub fn set_username(mut self, input: std::option::Option<std::string::String>) -> Self {
self.username = input;
self
}
pub fn build(
self,
) -> Result<crate::input::DeleteUserInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteUserInput {
username: self.username,
})
}
}
}
impl DeleteUserInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::DeleteUser,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_endpoint(_config.endpoint_url.clone())
.set_stage(_config.stage.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::DeleteUserInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.username;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
)
})?;
let username = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if username.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
),
);
}
write!(output, "/users/{username}", username = username)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteUserInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
if let Some(api_key_config) = _config.api_key() {
request.properties_mut().insert(api_key_config.clone());
let api_key = api_key_config.api_key();
let auth_definition = aws_smithy_http_auth::definition::HttpAuthDefinition::header(
"Authorization".to_owned(),
Some("Key".to_owned()),
);
let name = auth_definition.name();
let value = match auth_definition.scheme() {
Some(value) => format!("{value} {api_key}"),
None => api_key.to_owned(),
};
request.http_mut().headers_mut().insert(
http::header::HeaderName::from_bytes(name.as_bytes())
.expect("valid header name for api key auth"),
http::header::HeaderValue::from_bytes(value.as_bytes())
.expect("valid header value for api key auth"),
);
}
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DeleteUser::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteUser",
"sftp",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_user_input::Builder {
crate::input::delete_user_input::Builder::default()
}
}
pub mod list_users_input {
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) page_size: std::option::Option<i32>,
pub(crate) page_token: std::option::Option<std::string::String>,
}
impl Builder {
pub fn page_size(mut self, input: i32) -> Self {
self.page_size = Some(input);
self
}
pub fn set_page_size(mut self, input: std::option::Option<i32>) -> Self {
self.page_size = input;
self
}
pub fn page_token(mut self, input: impl Into<std::string::String>) -> Self {
self.page_token = Some(input.into());
self
}
pub fn set_page_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.page_token = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ListUsersInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ListUsersInput {
page_size: self.page_size,
page_token: self.page_token,
})
}
}
}
impl ListUsersInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::ListUsers,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_endpoint(_config.endpoint_url.clone())
.set_stage(_config.stage.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::ListUsersInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/users").expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListUsersInput,
mut output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let mut query = aws_smithy_http::query::Writer::new(&mut output);
if let Some(inner_2) = &_input.page_size {
if *inner_2 != 0 {
query.push_kv(
"pageSize",
aws_smithy_types::primitive::Encoder::from(*inner_2).encode(),
);
}
}
if let Some(inner_3) = &_input.page_token {
{
query.push_kv("pageToken", &aws_smithy_http::query::fmt_string(&inner_3));
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListUsersInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
uri_query(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
if let Some(api_key_config) = _config.api_key() {
request.properties_mut().insert(api_key_config.clone());
let api_key = api_key_config.api_key();
let auth_definition = aws_smithy_http_auth::definition::HttpAuthDefinition::header(
"Authorization".to_owned(),
Some("Key".to_owned()),
);
let name = auth_definition.name();
let value = match auth_definition.scheme() {
Some(value) => format!("{value} {api_key}"),
None => api_key.to_owned(),
};
request.http_mut().headers_mut().insert(
http::header::HeaderName::from_bytes(name.as_bytes())
.expect("valid header name for api key auth"),
http::header::HeaderValue::from_bytes(value.as_bytes())
.expect("valid header value for api key auth"),
);
}
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::ListUsers::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListUsers",
"sftp",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_users_input::Builder {
crate::input::list_users_input::Builder::default()
}
}
pub mod read_user_input {
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) username: std::option::Option<std::string::String>,
}
impl Builder {
pub fn username(mut self, input: impl Into<std::string::String>) -> Self {
self.username = Some(input.into());
self
}
pub fn set_username(mut self, input: std::option::Option<std::string::String>) -> Self {
self.username = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ReadUserInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ReadUserInput {
username: self.username,
})
}
}
}
impl ReadUserInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::ReadUser,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_endpoint(_config.endpoint_url.clone())
.set_stage(_config.stage.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::ReadUserInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_4 = &_input.username;
let input_4 = input_4.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
)
})?;
let username = aws_smithy_http::label::fmt_string(
input_4,
aws_smithy_http::label::EncodingStrategy::Default,
);
if username.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
),
);
}
write!(output, "/users/{username}", username = username)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ReadUserInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
if let Some(api_key_config) = _config.api_key() {
request.properties_mut().insert(api_key_config.clone());
let api_key = api_key_config.api_key();
let auth_definition = aws_smithy_http_auth::definition::HttpAuthDefinition::header(
"Authorization".to_owned(),
Some("Key".to_owned()),
);
let name = auth_definition.name();
let value = match auth_definition.scheme() {
Some(value) => format!("{value} {api_key}"),
None => api_key.to_owned(),
};
request.http_mut().headers_mut().insert(
http::header::HeaderName::from_bytes(name.as_bytes())
.expect("valid header name for api key auth"),
http::header::HeaderValue::from_bytes(value.as_bytes())
.expect("valid header value for api key auth"),
);
}
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
let op =
aws_smithy_http::operation::Operation::new(request, crate::operation::ReadUser::new())
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ReadUser", "sftp",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::read_user_input::Builder {
crate::input::read_user_input::Builder::default()
}
}
pub mod update_user_input {
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) username: std::option::Option<std::string::String>,
pub(crate) description: std::option::Option<std::string::String>,
}
impl Builder {
pub fn username(mut self, input: impl Into<std::string::String>) -> Self {
self.username = Some(input.into());
self
}
pub fn set_username(mut self, input: std::option::Option<std::string::String>) -> Self {
self.username = input;
self
}
pub fn description(mut self, input: impl Into<std::string::String>) -> Self {
self.description = Some(input.into());
self
}
pub fn set_description(mut self, input: std::option::Option<std::string::String>) -> Self {
self.description = input;
self
}
pub fn build(
self,
) -> Result<crate::input::UpdateUserInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::UpdateUserInput {
username: self.username,
description: self.description,
})
}
}
}
impl UpdateUserInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::UpdateUser,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_endpoint(_config.endpoint_url.clone())
.set_stage(_config.stage.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::UpdateUserInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_5 = &_input.username;
let input_5 = input_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
)
})?;
let username = aws_smithy_http::label::fmt_string(
input_5,
aws_smithy_http::label::EncodingStrategy::Default,
);
if username.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"username",
"cannot be empty or unset",
),
);
}
write!(output, "/users/{username}", username = username)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UpdateUserInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("PUT").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_update_user(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
if let Some(api_key_config) = _config.api_key() {
request.properties_mut().insert(api_key_config.clone());
let api_key = api_key_config.api_key();
let auth_definition = aws_smithy_http_auth::definition::HttpAuthDefinition::header(
"Authorization".to_owned(),
Some("Key".to_owned()),
);
let name = auth_definition.name();
let value = match auth_definition.scheme() {
Some(value) => format!("{value} {api_key}"),
None => api_key.to_owned(),
};
request.http_mut().headers_mut().insert(
http::header::HeaderName::from_bytes(name.as_bytes())
.expect("valid header name for api key auth"),
http::header::HeaderValue::from_bytes(value.as_bytes())
.expect("valid header value for api key auth"),
);
}
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(aws_smithy_http::http_versions::DEFAULT_HTTP_VERSION_LIST.clone());
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::UpdateUser::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UpdateUser",
"sftp",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::update_user_input::Builder {
crate::input::update_user_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListUsersInput {
#[doc(hidden)]
pub page_size: std::option::Option<i32>,
#[doc(hidden)]
pub page_token: std::option::Option<std::string::String>,
}
impl ListUsersInput {
pub fn page_size(&self) -> std::option::Option<i32> {
self.page_size
}
pub fn page_token(&self) -> std::option::Option<&str> {
self.page_token.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateUserInput {
#[doc(hidden)]
pub home_directory: std::option::Option<std::string::String>,
#[doc(hidden)]
pub description: std::option::Option<std::string::String>,
#[allow(missing_docs)] #[doc(hidden)]
pub password_options: std::option::Option<crate::model::PasswordOptions>,
}
impl CreateUserInput {
pub fn home_directory(&self) -> std::option::Option<&str> {
self.home_directory.as_deref()
}
pub fn description(&self) -> std::option::Option<&str> {
self.description.as_deref()
}
#[allow(missing_docs)] pub fn password_options(&self) -> std::option::Option<&crate::model::PasswordOptions> {
self.password_options.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteUserInput {
#[doc(hidden)]
pub username: std::option::Option<std::string::String>,
}
impl DeleteUserInput {
pub fn username(&self) -> std::option::Option<&str> {
self.username.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UpdateUserInput {
#[doc(hidden)]
pub username: std::option::Option<std::string::String>,
#[doc(hidden)]
pub description: std::option::Option<std::string::String>,
}
impl UpdateUserInput {
pub fn username(&self) -> std::option::Option<&str> {
self.username.as_deref()
}
pub fn description(&self) -> std::option::Option<&str> {
self.description.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ReadUserInput {
#[doc(hidden)]
pub username: std::option::Option<std::string::String>,
}
impl ReadUserInput {
pub fn username(&self) -> std::option::Option<&str> {
self.username.as_deref()
}
}