use std::fmt::Write;
pub mod delete_human_loop_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) human_loop_name: std::option::Option<std::string::String>,
}
impl Builder {
pub fn human_loop_name(mut self, input: impl Into<std::string::String>) -> Self {
self.human_loop_name = Some(input.into());
self
}
pub fn set_human_loop_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.human_loop_name = input;
self
}
pub fn build(
self,
) -> Result<crate::input::DeleteHumanLoopInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteHumanLoopInput {
human_loop_name: self.human_loop_name,
})
}
}
}
impl DeleteHumanLoopInput {
#[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::DeleteHumanLoop,
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_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.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::DeleteHumanLoopInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.human_loop_name;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"human_loop_name",
"cannot be empty or unset",
)
})?;
let human_loop_name = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if human_loop_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"human_loop_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/human-loops/{HumanLoopName}",
HumanLoopName = human_loop_name
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteHumanLoopInput,
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);
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);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DeleteHumanLoop::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteHumanLoop",
"sagemakera2iruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_human_loop_input::Builder {
crate::input::delete_human_loop_input::Builder::default()
}
}
pub mod describe_human_loop_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) human_loop_name: std::option::Option<std::string::String>,
}
impl Builder {
pub fn human_loop_name(mut self, input: impl Into<std::string::String>) -> Self {
self.human_loop_name = Some(input.into());
self
}
pub fn set_human_loop_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.human_loop_name = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DescribeHumanLoopInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeHumanLoopInput {
human_loop_name: self.human_loop_name,
})
}
}
}
impl DescribeHumanLoopInput {
#[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::DescribeHumanLoop,
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_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.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::DescribeHumanLoopInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_2 = &_input.human_loop_name;
let input_2 = input_2.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"human_loop_name",
"cannot be empty or unset",
)
})?;
let human_loop_name = aws_smithy_http::label::fmt_string(
input_2,
aws_smithy_http::label::EncodingStrategy::Default,
);
if human_loop_name.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"human_loop_name",
"cannot be empty or unset",
),
);
}
write!(
output,
"/human-loops/{HumanLoopName}",
HumanLoopName = human_loop_name
)
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeHumanLoopInput,
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);
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);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DescribeHumanLoop::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeHumanLoop",
"sagemakera2iruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_human_loop_input::Builder {
crate::input::describe_human_loop_input::Builder::default()
}
}
pub mod list_human_loops_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) creation_time_after: std::option::Option<aws_smithy_types::DateTime>,
pub(crate) creation_time_before: std::option::Option<aws_smithy_types::DateTime>,
pub(crate) flow_definition_arn: std::option::Option<std::string::String>,
pub(crate) sort_order: std::option::Option<crate::model::SortOrder>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn creation_time_after(mut self, input: aws_smithy_types::DateTime) -> Self {
self.creation_time_after = Some(input);
self
}
pub fn set_creation_time_after(
mut self,
input: std::option::Option<aws_smithy_types::DateTime>,
) -> Self {
self.creation_time_after = input;
self
}
pub fn creation_time_before(mut self, input: aws_smithy_types::DateTime) -> Self {
self.creation_time_before = Some(input);
self
}
pub fn set_creation_time_before(
mut self,
input: std::option::Option<aws_smithy_types::DateTime>,
) -> Self {
self.creation_time_before = input;
self
}
pub fn flow_definition_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.flow_definition_arn = Some(input.into());
self
}
pub fn set_flow_definition_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.flow_definition_arn = input;
self
}
pub fn sort_order(mut self, input: crate::model::SortOrder) -> Self {
self.sort_order = Some(input);
self
}
pub fn set_sort_order(
mut self,
input: std::option::Option<crate::model::SortOrder>,
) -> Self {
self.sort_order = input;
self
}
pub fn next_token(mut self, input: impl Into<std::string::String>) -> Self {
self.next_token = Some(input.into());
self
}
pub fn set_next_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.next_token = input;
self
}
pub fn max_results(mut self, input: i32) -> Self {
self.max_results = Some(input);
self
}
pub fn set_max_results(mut self, input: std::option::Option<i32>) -> Self {
self.max_results = input;
self
}
pub fn build(
self,
) -> Result<crate::input::ListHumanLoopsInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::ListHumanLoopsInput {
creation_time_after: self.creation_time_after,
creation_time_before: self.creation_time_before,
flow_definition_arn: self.flow_definition_arn,
sort_order: self.sort_order,
next_token: self.next_token,
max_results: self.max_results,
})
}
}
}
impl ListHumanLoopsInput {
#[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::ListHumanLoops,
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_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.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::ListHumanLoopsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/human-loops").expect("formatting should succeed");
Ok(())
}
fn uri_query(
_input: &crate::input::ListHumanLoopsInput,
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_3) = &_input.creation_time_after {
{
query.push_kv(
"CreationTimeAfter",
&aws_smithy_http::query::fmt_timestamp(
inner_3,
aws_smithy_types::date_time::Format::DateTime,
)?,
);
}
}
if let Some(inner_4) = &_input.creation_time_before {
{
query.push_kv(
"CreationTimeBefore",
&aws_smithy_http::query::fmt_timestamp(
inner_4,
aws_smithy_types::date_time::Format::DateTime,
)?,
);
}
}
let inner_5 = &_input.flow_definition_arn;
let inner_5 = inner_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"flow_definition_arn",
"cannot be empty or unset",
)
})?;
if inner_5.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"flow_definition_arn",
"cannot be empty or unset",
),
);
}
query.push_kv(
"FlowDefinitionArn",
&aws_smithy_http::query::fmt_string(&inner_5),
);
if let Some(inner_6) = &_input.sort_order {
{
query.push_kv("SortOrder", &aws_smithy_http::query::fmt_string(&inner_6));
}
}
if let Some(inner_7) = &_input.next_token {
{
query.push_kv("NextToken", &aws_smithy_http::query::fmt_string(&inner_7));
}
}
if let Some(inner_8) = &_input.max_results {
if *inner_8 != 0 {
query.push_kv(
"MaxResults",
aws_smithy_types::primitive::Encoder::from(*inner_8).encode(),
);
}
}
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListHumanLoopsInput,
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);
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);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::ListHumanLoops::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListHumanLoops",
"sagemakera2iruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_human_loops_input::Builder {
crate::input::list_human_loops_input::Builder::default()
}
}
pub mod start_human_loop_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) human_loop_name: std::option::Option<std::string::String>,
pub(crate) flow_definition_arn: std::option::Option<std::string::String>,
pub(crate) human_loop_input: std::option::Option<crate::model::HumanLoopInput>,
pub(crate) data_attributes: std::option::Option<crate::model::HumanLoopDataAttributes>,
}
impl Builder {
pub fn human_loop_name(mut self, input: impl Into<std::string::String>) -> Self {
self.human_loop_name = Some(input.into());
self
}
pub fn set_human_loop_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.human_loop_name = input;
self
}
pub fn flow_definition_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.flow_definition_arn = Some(input.into());
self
}
pub fn set_flow_definition_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.flow_definition_arn = input;
self
}
pub fn human_loop_input(mut self, input: crate::model::HumanLoopInput) -> Self {
self.human_loop_input = Some(input);
self
}
pub fn set_human_loop_input(
mut self,
input: std::option::Option<crate::model::HumanLoopInput>,
) -> Self {
self.human_loop_input = input;
self
}
pub fn data_attributes(mut self, input: crate::model::HumanLoopDataAttributes) -> Self {
self.data_attributes = Some(input);
self
}
pub fn set_data_attributes(
mut self,
input: std::option::Option<crate::model::HumanLoopDataAttributes>,
) -> Self {
self.data_attributes = input;
self
}
pub fn build(
self,
) -> Result<crate::input::StartHumanLoopInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::StartHumanLoopInput {
human_loop_name: self.human_loop_name,
flow_definition_arn: self.flow_definition_arn,
human_loop_input: self.human_loop_input,
data_attributes: self.data_attributes,
})
}
}
}
impl StartHumanLoopInput {
#[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::StartHumanLoop,
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_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.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::StartHumanLoopInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/human-loops").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::StartHumanLoopInput,
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_start_human_loop(&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);
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);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::StartHumanLoop::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"StartHumanLoop",
"sagemakera2iruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::start_human_loop_input::Builder {
crate::input::start_human_loop_input::Builder::default()
}
}
pub mod stop_human_loop_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) human_loop_name: std::option::Option<std::string::String>,
}
impl Builder {
pub fn human_loop_name(mut self, input: impl Into<std::string::String>) -> Self {
self.human_loop_name = Some(input.into());
self
}
pub fn set_human_loop_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.human_loop_name = input;
self
}
pub fn build(
self,
) -> Result<crate::input::StopHumanLoopInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::StopHumanLoopInput {
human_loop_name: self.human_loop_name,
})
}
}
}
impl StopHumanLoopInput {
#[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::StopHumanLoop,
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_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.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::StopHumanLoopInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/human-loops/stop").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::StopHumanLoopInput,
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_stop_human_loop(&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);
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);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::StopHumanLoop::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"StopHumanLoop",
"sagemakera2iruntime",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::stop_human_loop_input::Builder {
crate::input::stop_human_loop_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct StopHumanLoopInput {
#[doc(hidden)]
pub human_loop_name: std::option::Option<std::string::String>,
}
impl StopHumanLoopInput {
pub fn human_loop_name(&self) -> std::option::Option<&str> {
self.human_loop_name.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct StartHumanLoopInput {
#[doc(hidden)]
pub human_loop_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub flow_definition_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub human_loop_input: std::option::Option<crate::model::HumanLoopInput>,
#[doc(hidden)]
pub data_attributes: std::option::Option<crate::model::HumanLoopDataAttributes>,
}
impl StartHumanLoopInput {
pub fn human_loop_name(&self) -> std::option::Option<&str> {
self.human_loop_name.as_deref()
}
pub fn flow_definition_arn(&self) -> std::option::Option<&str> {
self.flow_definition_arn.as_deref()
}
pub fn human_loop_input(&self) -> std::option::Option<&crate::model::HumanLoopInput> {
self.human_loop_input.as_ref()
}
pub fn data_attributes(&self) -> std::option::Option<&crate::model::HumanLoopDataAttributes> {
self.data_attributes.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListHumanLoopsInput {
#[doc(hidden)]
pub creation_time_after: std::option::Option<aws_smithy_types::DateTime>,
#[doc(hidden)]
pub creation_time_before: std::option::Option<aws_smithy_types::DateTime>,
#[doc(hidden)]
pub flow_definition_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub sort_order: std::option::Option<crate::model::SortOrder>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
}
impl ListHumanLoopsInput {
pub fn creation_time_after(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
self.creation_time_after.as_ref()
}
pub fn creation_time_before(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
self.creation_time_before.as_ref()
}
pub fn flow_definition_arn(&self) -> std::option::Option<&str> {
self.flow_definition_arn.as_deref()
}
pub fn sort_order(&self) -> std::option::Option<&crate::model::SortOrder> {
self.sort_order.as_ref()
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeHumanLoopInput {
#[doc(hidden)]
pub human_loop_name: std::option::Option<std::string::String>,
}
impl DescribeHumanLoopInput {
pub fn human_loop_name(&self) -> std::option::Option<&str> {
self.human_loop_name.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteHumanLoopInput {
#[doc(hidden)]
pub human_loop_name: std::option::Option<std::string::String>,
}
impl DeleteHumanLoopInput {
pub fn human_loop_name(&self) -> std::option::Option<&str> {
self.human_loop_name.as_deref()
}
}