use std::fmt::Write;
pub mod create_scaling_plan_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_name: std::option::Option<std::string::String>,
pub(crate) application_source: std::option::Option<crate::model::ApplicationSource>,
pub(crate) scaling_instructions:
std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
}
impl Builder {
pub fn scaling_plan_name(mut self, input: impl Into<std::string::String>) -> Self {
self.scaling_plan_name = Some(input.into());
self
}
pub fn set_scaling_plan_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.scaling_plan_name = input;
self
}
pub fn application_source(mut self, input: crate::model::ApplicationSource) -> Self {
self.application_source = Some(input);
self
}
pub fn set_application_source(
mut self,
input: std::option::Option<crate::model::ApplicationSource>,
) -> Self {
self.application_source = input;
self
}
pub fn scaling_instructions(mut self, input: crate::model::ScalingInstruction) -> Self {
let mut v = self.scaling_instructions.unwrap_or_default();
v.push(input);
self.scaling_instructions = Some(v);
self
}
pub fn set_scaling_instructions(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
) -> Self {
self.scaling_instructions = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::CreateScalingPlanInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::CreateScalingPlanInput {
scaling_plan_name: self.scaling_plan_name,
application_source: self.application_source,
scaling_instructions: self.scaling_instructions,
})
}
}
}
impl CreateScalingPlanInput {
#[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::CreateScalingPlan,
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::CreateScalingPlanInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateScalingPlanInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.CreateScalingPlan",
);
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_scaling_plan(&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::CreateScalingPlan::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateScalingPlan",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_scaling_plan_input::Builder {
crate::input::create_scaling_plan_input::Builder::default()
}
}
pub mod delete_scaling_plan_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_name: std::option::Option<std::string::String>,
pub(crate) scaling_plan_version: std::option::Option<i64>,
}
impl Builder {
pub fn scaling_plan_name(mut self, input: impl Into<std::string::String>) -> Self {
self.scaling_plan_name = Some(input.into());
self
}
pub fn set_scaling_plan_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.scaling_plan_name = input;
self
}
pub fn scaling_plan_version(mut self, input: i64) -> Self {
self.scaling_plan_version = Some(input);
self
}
pub fn set_scaling_plan_version(mut self, input: std::option::Option<i64>) -> Self {
self.scaling_plan_version = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DeleteScalingPlanInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DeleteScalingPlanInput {
scaling_plan_name: self.scaling_plan_name,
scaling_plan_version: self.scaling_plan_version,
})
}
}
}
impl DeleteScalingPlanInput {
#[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::DeleteScalingPlan,
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::DeleteScalingPlanInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteScalingPlanInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.DeleteScalingPlan",
);
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_delete_scaling_plan(&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::DeleteScalingPlan::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteScalingPlan",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_scaling_plan_input::Builder {
crate::input::delete_scaling_plan_input::Builder::default()
}
}
pub mod describe_scaling_plan_resources_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_name: std::option::Option<std::string::String>,
pub(crate) scaling_plan_version: std::option::Option<i64>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) next_token: std::option::Option<std::string::String>,
}
impl Builder {
pub fn scaling_plan_name(mut self, input: impl Into<std::string::String>) -> Self {
self.scaling_plan_name = Some(input.into());
self
}
pub fn set_scaling_plan_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.scaling_plan_name = input;
self
}
pub fn scaling_plan_version(mut self, input: i64) -> Self {
self.scaling_plan_version = Some(input);
self
}
pub fn set_scaling_plan_version(mut self, input: std::option::Option<i64>) -> Self {
self.scaling_plan_version = 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 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 build(
self,
) -> Result<
crate::input::DescribeScalingPlanResourcesInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeScalingPlanResourcesInput {
scaling_plan_name: self.scaling_plan_name,
scaling_plan_version: self.scaling_plan_version,
max_results: self.max_results,
next_token: self.next_token,
})
}
}
}
impl DescribeScalingPlanResourcesInput {
#[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::DescribeScalingPlanResources,
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::DescribeScalingPlanResourcesInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeScalingPlanResourcesInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.DescribeScalingPlanResources",
);
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_describe_scaling_plan_resources(&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::DescribeScalingPlanResources::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeScalingPlanResources",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_scaling_plan_resources_input::Builder {
crate::input::describe_scaling_plan_resources_input::Builder::default()
}
}
pub mod describe_scaling_plans_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_names: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) scaling_plan_version: std::option::Option<i64>,
pub(crate) application_sources:
std::option::Option<std::vec::Vec<crate::model::ApplicationSource>>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) next_token: std::option::Option<std::string::String>,
}
impl Builder {
pub fn scaling_plan_names(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.scaling_plan_names.unwrap_or_default();
v.push(input.into());
self.scaling_plan_names = Some(v);
self
}
pub fn set_scaling_plan_names(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.scaling_plan_names = input;
self
}
pub fn scaling_plan_version(mut self, input: i64) -> Self {
self.scaling_plan_version = Some(input);
self
}
pub fn set_scaling_plan_version(mut self, input: std::option::Option<i64>) -> Self {
self.scaling_plan_version = input;
self
}
pub fn application_sources(mut self, input: crate::model::ApplicationSource) -> Self {
let mut v = self.application_sources.unwrap_or_default();
v.push(input);
self.application_sources = Some(v);
self
}
pub fn set_application_sources(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::ApplicationSource>>,
) -> Self {
self.application_sources = 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 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 build(
self,
) -> Result<
crate::input::DescribeScalingPlansInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeScalingPlansInput {
scaling_plan_names: self.scaling_plan_names,
scaling_plan_version: self.scaling_plan_version,
application_sources: self.application_sources,
max_results: self.max_results,
next_token: self.next_token,
})
}
}
}
impl DescribeScalingPlansInput {
#[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::DescribeScalingPlans,
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::DescribeScalingPlansInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeScalingPlansInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.DescribeScalingPlans",
);
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_describe_scaling_plans(
&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::DescribeScalingPlans::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeScalingPlans",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_scaling_plans_input::Builder {
crate::input::describe_scaling_plans_input::Builder::default()
}
}
pub mod get_scaling_plan_resource_forecast_data_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_name: std::option::Option<std::string::String>,
pub(crate) scaling_plan_version: std::option::Option<i64>,
pub(crate) service_namespace: std::option::Option<crate::model::ServiceNamespace>,
pub(crate) resource_id: std::option::Option<std::string::String>,
pub(crate) scalable_dimension: std::option::Option<crate::model::ScalableDimension>,
pub(crate) forecast_data_type: std::option::Option<crate::model::ForecastDataType>,
pub(crate) start_time: std::option::Option<aws_smithy_types::DateTime>,
pub(crate) end_time: std::option::Option<aws_smithy_types::DateTime>,
}
impl Builder {
pub fn scaling_plan_name(mut self, input: impl Into<std::string::String>) -> Self {
self.scaling_plan_name = Some(input.into());
self
}
pub fn set_scaling_plan_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.scaling_plan_name = input;
self
}
pub fn scaling_plan_version(mut self, input: i64) -> Self {
self.scaling_plan_version = Some(input);
self
}
pub fn set_scaling_plan_version(mut self, input: std::option::Option<i64>) -> Self {
self.scaling_plan_version = input;
self
}
pub fn service_namespace(mut self, input: crate::model::ServiceNamespace) -> Self {
self.service_namespace = Some(input);
self
}
pub fn set_service_namespace(
mut self,
input: std::option::Option<crate::model::ServiceNamespace>,
) -> Self {
self.service_namespace = input;
self
}
pub fn resource_id(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_id = Some(input.into());
self
}
pub fn set_resource_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_id = input;
self
}
pub fn scalable_dimension(mut self, input: crate::model::ScalableDimension) -> Self {
self.scalable_dimension = Some(input);
self
}
pub fn set_scalable_dimension(
mut self,
input: std::option::Option<crate::model::ScalableDimension>,
) -> Self {
self.scalable_dimension = input;
self
}
pub fn forecast_data_type(mut self, input: crate::model::ForecastDataType) -> Self {
self.forecast_data_type = Some(input);
self
}
pub fn set_forecast_data_type(
mut self,
input: std::option::Option<crate::model::ForecastDataType>,
) -> Self {
self.forecast_data_type = input;
self
}
pub fn start_time(mut self, input: aws_smithy_types::DateTime) -> Self {
self.start_time = Some(input);
self
}
pub fn set_start_time(
mut self,
input: std::option::Option<aws_smithy_types::DateTime>,
) -> Self {
self.start_time = input;
self
}
pub fn end_time(mut self, input: aws_smithy_types::DateTime) -> Self {
self.end_time = Some(input);
self
}
pub fn set_end_time(
mut self,
input: std::option::Option<aws_smithy_types::DateTime>,
) -> Self {
self.end_time = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::GetScalingPlanResourceForecastDataInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::GetScalingPlanResourceForecastDataInput {
scaling_plan_name: self.scaling_plan_name,
scaling_plan_version: self.scaling_plan_version,
service_namespace: self.service_namespace,
resource_id: self.resource_id,
scalable_dimension: self.scalable_dimension,
forecast_data_type: self.forecast_data_type,
start_time: self.start_time,
end_time: self.end_time,
})
}
}
}
impl GetScalingPlanResourceForecastDataInput {
#[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::GetScalingPlanResourceForecastData,
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::GetScalingPlanResourceForecastDataInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetScalingPlanResourceForecastDataInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.GetScalingPlanResourceForecastData",
);
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_get_scaling_plan_resource_forecast_data(&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::GetScalingPlanResourceForecastData::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetScalingPlanResourceForecastData",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_scaling_plan_resource_forecast_data_input::Builder {
crate::input::get_scaling_plan_resource_forecast_data_input::Builder::default()
}
}
pub mod update_scaling_plan_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) scaling_plan_name: std::option::Option<std::string::String>,
pub(crate) scaling_plan_version: std::option::Option<i64>,
pub(crate) application_source: std::option::Option<crate::model::ApplicationSource>,
pub(crate) scaling_instructions:
std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
}
impl Builder {
pub fn scaling_plan_name(mut self, input: impl Into<std::string::String>) -> Self {
self.scaling_plan_name = Some(input.into());
self
}
pub fn set_scaling_plan_name(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.scaling_plan_name = input;
self
}
pub fn scaling_plan_version(mut self, input: i64) -> Self {
self.scaling_plan_version = Some(input);
self
}
pub fn set_scaling_plan_version(mut self, input: std::option::Option<i64>) -> Self {
self.scaling_plan_version = input;
self
}
pub fn application_source(mut self, input: crate::model::ApplicationSource) -> Self {
self.application_source = Some(input);
self
}
pub fn set_application_source(
mut self,
input: std::option::Option<crate::model::ApplicationSource>,
) -> Self {
self.application_source = input;
self
}
pub fn scaling_instructions(mut self, input: crate::model::ScalingInstruction) -> Self {
let mut v = self.scaling_instructions.unwrap_or_default();
v.push(input);
self.scaling_instructions = Some(v);
self
}
pub fn set_scaling_instructions(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
) -> Self {
self.scaling_instructions = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::UpdateScalingPlanInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::UpdateScalingPlanInput {
scaling_plan_name: self.scaling_plan_name,
scaling_plan_version: self.scaling_plan_version,
application_source: self.application_source,
scaling_instructions: self.scaling_instructions,
})
}
}
}
impl UpdateScalingPlanInput {
#[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::UpdateScalingPlan,
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::UpdateScalingPlanInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UpdateScalingPlanInput,
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/x-amz-json-1.1",
);
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::HeaderName::from_static("x-amz-target"),
"AnyScaleScalingPlannerFrontendService.UpdateScalingPlan",
);
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_scaling_plan(&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::UpdateScalingPlan::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UpdateScalingPlan",
"autoscalingplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::update_scaling_plan_input::Builder {
crate::input::update_scaling_plan_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UpdateScalingPlanInput {
#[doc(hidden)]
pub scaling_plan_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub scaling_plan_version: std::option::Option<i64>,
#[doc(hidden)]
pub application_source: std::option::Option<crate::model::ApplicationSource>,
#[doc(hidden)]
pub scaling_instructions: std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
}
impl UpdateScalingPlanInput {
pub fn scaling_plan_name(&self) -> std::option::Option<&str> {
self.scaling_plan_name.as_deref()
}
pub fn scaling_plan_version(&self) -> std::option::Option<i64> {
self.scaling_plan_version
}
pub fn application_source(&self) -> std::option::Option<&crate::model::ApplicationSource> {
self.application_source.as_ref()
}
pub fn scaling_instructions(&self) -> std::option::Option<&[crate::model::ScalingInstruction]> {
self.scaling_instructions.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetScalingPlanResourceForecastDataInput {
#[doc(hidden)]
pub scaling_plan_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub scaling_plan_version: std::option::Option<i64>,
#[doc(hidden)]
pub service_namespace: std::option::Option<crate::model::ServiceNamespace>,
#[doc(hidden)]
pub resource_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub scalable_dimension: std::option::Option<crate::model::ScalableDimension>,
#[doc(hidden)]
pub forecast_data_type: std::option::Option<crate::model::ForecastDataType>,
#[doc(hidden)]
pub start_time: std::option::Option<aws_smithy_types::DateTime>,
#[doc(hidden)]
pub end_time: std::option::Option<aws_smithy_types::DateTime>,
}
impl GetScalingPlanResourceForecastDataInput {
pub fn scaling_plan_name(&self) -> std::option::Option<&str> {
self.scaling_plan_name.as_deref()
}
pub fn scaling_plan_version(&self) -> std::option::Option<i64> {
self.scaling_plan_version
}
pub fn service_namespace(&self) -> std::option::Option<&crate::model::ServiceNamespace> {
self.service_namespace.as_ref()
}
pub fn resource_id(&self) -> std::option::Option<&str> {
self.resource_id.as_deref()
}
pub fn scalable_dimension(&self) -> std::option::Option<&crate::model::ScalableDimension> {
self.scalable_dimension.as_ref()
}
pub fn forecast_data_type(&self) -> std::option::Option<&crate::model::ForecastDataType> {
self.forecast_data_type.as_ref()
}
pub fn start_time(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
self.start_time.as_ref()
}
pub fn end_time(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
self.end_time.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeScalingPlansInput {
#[doc(hidden)]
pub scaling_plan_names: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub scaling_plan_version: std::option::Option<i64>,
#[doc(hidden)]
pub application_sources: std::option::Option<std::vec::Vec<crate::model::ApplicationSource>>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
}
impl DescribeScalingPlansInput {
pub fn scaling_plan_names(&self) -> std::option::Option<&[std::string::String]> {
self.scaling_plan_names.as_deref()
}
pub fn scaling_plan_version(&self) -> std::option::Option<i64> {
self.scaling_plan_version
}
pub fn application_sources(&self) -> std::option::Option<&[crate::model::ApplicationSource]> {
self.application_sources.as_deref()
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeScalingPlanResourcesInput {
#[doc(hidden)]
pub scaling_plan_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub scaling_plan_version: std::option::Option<i64>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
}
impl DescribeScalingPlanResourcesInput {
pub fn scaling_plan_name(&self) -> std::option::Option<&str> {
self.scaling_plan_name.as_deref()
}
pub fn scaling_plan_version(&self) -> std::option::Option<i64> {
self.scaling_plan_version
}
pub fn max_results(&self) -> std::option::Option<i32> {
self.max_results
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteScalingPlanInput {
#[doc(hidden)]
pub scaling_plan_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub scaling_plan_version: std::option::Option<i64>,
}
impl DeleteScalingPlanInput {
pub fn scaling_plan_name(&self) -> std::option::Option<&str> {
self.scaling_plan_name.as_deref()
}
pub fn scaling_plan_version(&self) -> std::option::Option<i64> {
self.scaling_plan_version
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateScalingPlanInput {
#[doc(hidden)]
pub scaling_plan_name: std::option::Option<std::string::String>,
#[doc(hidden)]
pub application_source: std::option::Option<crate::model::ApplicationSource>,
#[doc(hidden)]
pub scaling_instructions: std::option::Option<std::vec::Vec<crate::model::ScalingInstruction>>,
}
impl CreateScalingPlanInput {
pub fn scaling_plan_name(&self) -> std::option::Option<&str> {
self.scaling_plan_name.as_deref()
}
pub fn application_source(&self) -> std::option::Option<&crate::model::ApplicationSource> {
self.application_source.as_ref()
}
pub fn scaling_instructions(&self) -> std::option::Option<&[crate::model::ScalingInstruction]> {
self.scaling_instructions.as_deref()
}
}