use std::fmt::Write;
pub mod create_savings_plan_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) savings_plan_offering_id: std::option::Option<std::string::String>,
pub(crate) commitment: std::option::Option<std::string::String>,
pub(crate) upfront_payment_amount: std::option::Option<std::string::String>,
pub(crate) purchase_time: std::option::Option<aws_smithy_types::DateTime>,
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn savings_plan_offering_id(mut self, input: impl Into<std::string::String>) -> Self {
self.savings_plan_offering_id = Some(input.into());
self
}
pub fn set_savings_plan_offering_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.savings_plan_offering_id = input;
self
}
pub fn commitment(mut self, input: impl Into<std::string::String>) -> Self {
self.commitment = Some(input.into());
self
}
pub fn set_commitment(mut self, input: std::option::Option<std::string::String>) -> Self {
self.commitment = input;
self
}
pub fn upfront_payment_amount(mut self, input: impl Into<std::string::String>) -> Self {
self.upfront_payment_amount = Some(input.into());
self
}
pub fn set_upfront_payment_amount(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.upfront_payment_amount = input;
self
}
pub fn purchase_time(mut self, input: aws_smithy_types::DateTime) -> Self {
self.purchase_time = Some(input);
self
}
pub fn set_purchase_time(
mut self,
input: std::option::Option<aws_smithy_types::DateTime>,
) -> Self {
self.purchase_time = input;
self
}
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::CreateSavingsPlanInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::CreateSavingsPlanInput {
savings_plan_offering_id: self.savings_plan_offering_id,
commitment: self.commitment,
upfront_payment_amount: self.upfront_payment_amount,
purchase_time: self.purchase_time,
client_token: self.client_token,
tags: self.tags,
})
}
}
}
impl CreateSavingsPlanInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
mut self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::CreateSavingsPlan,
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),
};
if self.client_token.is_none() {
self.client_token = Some(_config.make_token.make_idempotency_token());
}
let mut request = {
fn uri_base(
_input: &crate::input::CreateSavingsPlanInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/CreateSavingsPlan").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::CreateSavingsPlanInput,
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_savings_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::CreateSavingsPlan::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"CreateSavingsPlan",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::create_savings_plan_input::Builder {
crate::input::create_savings_plan_input::Builder::default()
}
}
pub mod delete_queued_savings_plan_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) savings_plan_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn savings_plan_id(mut self, input: impl Into<std::string::String>) -> Self {
self.savings_plan_id = Some(input.into());
self
}
pub fn set_savings_plan_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.savings_plan_id = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DeleteQueuedSavingsPlanInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DeleteQueuedSavingsPlanInput {
savings_plan_id: self.savings_plan_id,
})
}
}
}
impl DeleteQueuedSavingsPlanInput {
#[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::DeleteQueuedSavingsPlan,
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::DeleteQueuedSavingsPlanInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/DeleteQueuedSavingsPlan").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteQueuedSavingsPlanInput,
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_delete_queued_savings_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::DeleteQueuedSavingsPlan::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteQueuedSavingsPlan",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_queued_savings_plan_input::Builder {
crate::input::delete_queued_savings_plan_input::Builder::default()
}
}
pub mod describe_savings_plan_rates_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) savings_plan_id: std::option::Option<std::string::String>,
pub(crate) filters: std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateFilter>>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn savings_plan_id(mut self, input: impl Into<std::string::String>) -> Self {
self.savings_plan_id = Some(input.into());
self
}
pub fn set_savings_plan_id(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.savings_plan_id = input;
self
}
pub fn filters(mut self, input: crate::model::SavingsPlanRateFilter) -> Self {
let mut v = self.filters.unwrap_or_default();
v.push(input);
self.filters = Some(v);
self
}
pub fn set_filters(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateFilter>>,
) -> Self {
self.filters = 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::DescribeSavingsPlanRatesInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeSavingsPlanRatesInput {
savings_plan_id: self.savings_plan_id,
filters: self.filters,
next_token: self.next_token,
max_results: self.max_results,
})
}
}
}
impl DescribeSavingsPlanRatesInput {
#[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::DescribeSavingsPlanRates,
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::DescribeSavingsPlanRatesInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/DescribeSavingsPlanRates").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeSavingsPlanRatesInput,
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_describe_savings_plan_rates(
&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::DescribeSavingsPlanRates::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeSavingsPlanRates",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_savings_plan_rates_input::Builder {
crate::input::describe_savings_plan_rates_input::Builder::default()
}
}
pub mod describe_savings_plans_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) savings_plan_arns: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) savings_plan_ids: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
pub(crate) states: std::option::Option<std::vec::Vec<crate::model::SavingsPlanState>>,
pub(crate) filters: std::option::Option<std::vec::Vec<crate::model::SavingsPlanFilter>>,
}
impl Builder {
pub fn savings_plan_arns(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.savings_plan_arns.unwrap_or_default();
v.push(input.into());
self.savings_plan_arns = Some(v);
self
}
pub fn set_savings_plan_arns(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.savings_plan_arns = input;
self
}
pub fn savings_plan_ids(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.savings_plan_ids.unwrap_or_default();
v.push(input.into());
self.savings_plan_ids = Some(v);
self
}
pub fn set_savings_plan_ids(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.savings_plan_ids = 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 states(mut self, input: crate::model::SavingsPlanState) -> Self {
let mut v = self.states.unwrap_or_default();
v.push(input);
self.states = Some(v);
self
}
pub fn set_states(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanState>>,
) -> Self {
self.states = input;
self
}
pub fn filters(mut self, input: crate::model::SavingsPlanFilter) -> Self {
let mut v = self.filters.unwrap_or_default();
v.push(input);
self.filters = Some(v);
self
}
pub fn set_filters(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanFilter>>,
) -> Self {
self.filters = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::DescribeSavingsPlansInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeSavingsPlansInput {
savings_plan_arns: self.savings_plan_arns,
savings_plan_ids: self.savings_plan_ids,
next_token: self.next_token,
max_results: self.max_results,
states: self.states,
filters: self.filters,
})
}
}
}
impl DescribeSavingsPlansInput {
#[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::DescribeSavingsPlans,
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::DescribeSavingsPlansInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/DescribeSavingsPlans").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeSavingsPlansInput,
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_describe_savings_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::DescribeSavingsPlans::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeSavingsPlans",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_savings_plans_input::Builder {
crate::input::describe_savings_plans_input::Builder::default()
}
}
pub mod describe_savings_plans_offering_rates_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) savings_plan_offering_ids:
std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) savings_plan_payment_options:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
pub(crate) savings_plan_types:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
pub(crate) products:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanProductType>>,
pub(crate) service_codes:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateServiceCode>>,
pub(crate) usage_types: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) operations: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) filters:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanOfferingRateFilterElement>>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn savings_plan_offering_ids(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.savings_plan_offering_ids.unwrap_or_default();
v.push(input.into());
self.savings_plan_offering_ids = Some(v);
self
}
pub fn set_savings_plan_offering_ids(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.savings_plan_offering_ids = input;
self
}
pub fn savings_plan_payment_options(
mut self,
input: crate::model::SavingsPlanPaymentOption,
) -> Self {
let mut v = self.savings_plan_payment_options.unwrap_or_default();
v.push(input);
self.savings_plan_payment_options = Some(v);
self
}
pub fn set_savings_plan_payment_options(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
) -> Self {
self.savings_plan_payment_options = input;
self
}
pub fn savings_plan_types(mut self, input: crate::model::SavingsPlanType) -> Self {
let mut v = self.savings_plan_types.unwrap_or_default();
v.push(input);
self.savings_plan_types = Some(v);
self
}
pub fn set_savings_plan_types(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
) -> Self {
self.savings_plan_types = input;
self
}
pub fn products(mut self, input: crate::model::SavingsPlanProductType) -> Self {
let mut v = self.products.unwrap_or_default();
v.push(input);
self.products = Some(v);
self
}
pub fn set_products(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanProductType>>,
) -> Self {
self.products = input;
self
}
pub fn service_codes(mut self, input: crate::model::SavingsPlanRateServiceCode) -> Self {
let mut v = self.service_codes.unwrap_or_default();
v.push(input);
self.service_codes = Some(v);
self
}
pub fn set_service_codes(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateServiceCode>>,
) -> Self {
self.service_codes = input;
self
}
pub fn usage_types(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.usage_types.unwrap_or_default();
v.push(input.into());
self.usage_types = Some(v);
self
}
pub fn set_usage_types(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.usage_types = input;
self
}
pub fn operations(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.operations.unwrap_or_default();
v.push(input.into());
self.operations = Some(v);
self
}
pub fn set_operations(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.operations = input;
self
}
pub fn filters(
mut self,
input: crate::model::SavingsPlanOfferingRateFilterElement,
) -> Self {
let mut v = self.filters.unwrap_or_default();
v.push(input);
self.filters = Some(v);
self
}
pub fn set_filters(
mut self,
input: std::option::Option<
std::vec::Vec<crate::model::SavingsPlanOfferingRateFilterElement>,
>,
) -> Self {
self.filters = 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::DescribeSavingsPlansOfferingRatesInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeSavingsPlansOfferingRatesInput {
savings_plan_offering_ids: self.savings_plan_offering_ids,
savings_plan_payment_options: self.savings_plan_payment_options,
savings_plan_types: self.savings_plan_types,
products: self.products,
service_codes: self.service_codes,
usage_types: self.usage_types,
operations: self.operations,
filters: self.filters,
next_token: self.next_token,
max_results: self.max_results.unwrap_or_default(),
})
}
}
}
impl DescribeSavingsPlansOfferingRatesInput {
#[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::DescribeSavingsPlansOfferingRates,
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::DescribeSavingsPlansOfferingRatesInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/DescribeSavingsPlansOfferingRates")
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeSavingsPlansOfferingRatesInput,
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_describe_savings_plans_offering_rates(&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::DescribeSavingsPlansOfferingRates::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeSavingsPlansOfferingRates",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_savings_plans_offering_rates_input::Builder {
crate::input::describe_savings_plans_offering_rates_input::Builder::default()
}
}
pub mod describe_savings_plans_offerings_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) offering_ids: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) payment_options:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
pub(crate) product_type: std::option::Option<crate::model::SavingsPlanProductType>,
pub(crate) plan_types: std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
pub(crate) durations: std::option::Option<std::vec::Vec<i64>>,
pub(crate) currencies: std::option::Option<std::vec::Vec<crate::model::CurrencyCode>>,
pub(crate) descriptions: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) service_codes: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) usage_types: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) operations: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) filters:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanOfferingFilterElement>>,
pub(crate) next_token: std::option::Option<std::string::String>,
pub(crate) max_results: std::option::Option<i32>,
}
impl Builder {
pub fn offering_ids(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.offering_ids.unwrap_or_default();
v.push(input.into());
self.offering_ids = Some(v);
self
}
pub fn set_offering_ids(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.offering_ids = input;
self
}
pub fn payment_options(mut self, input: crate::model::SavingsPlanPaymentOption) -> Self {
let mut v = self.payment_options.unwrap_or_default();
v.push(input);
self.payment_options = Some(v);
self
}
pub fn set_payment_options(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
) -> Self {
self.payment_options = input;
self
}
pub fn product_type(mut self, input: crate::model::SavingsPlanProductType) -> Self {
self.product_type = Some(input);
self
}
pub fn set_product_type(
mut self,
input: std::option::Option<crate::model::SavingsPlanProductType>,
) -> Self {
self.product_type = input;
self
}
pub fn plan_types(mut self, input: crate::model::SavingsPlanType) -> Self {
let mut v = self.plan_types.unwrap_or_default();
v.push(input);
self.plan_types = Some(v);
self
}
pub fn set_plan_types(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
) -> Self {
self.plan_types = input;
self
}
pub fn durations(mut self, input: i64) -> Self {
let mut v = self.durations.unwrap_or_default();
v.push(input);
self.durations = Some(v);
self
}
pub fn set_durations(mut self, input: std::option::Option<std::vec::Vec<i64>>) -> Self {
self.durations = input;
self
}
pub fn currencies(mut self, input: crate::model::CurrencyCode) -> Self {
let mut v = self.currencies.unwrap_or_default();
v.push(input);
self.currencies = Some(v);
self
}
pub fn set_currencies(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::CurrencyCode>>,
) -> Self {
self.currencies = input;
self
}
pub fn descriptions(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.descriptions.unwrap_or_default();
v.push(input.into());
self.descriptions = Some(v);
self
}
pub fn set_descriptions(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.descriptions = input;
self
}
pub fn service_codes(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.service_codes.unwrap_or_default();
v.push(input.into());
self.service_codes = Some(v);
self
}
pub fn set_service_codes(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.service_codes = input;
self
}
pub fn usage_types(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.usage_types.unwrap_or_default();
v.push(input.into());
self.usage_types = Some(v);
self
}
pub fn set_usage_types(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.usage_types = input;
self
}
pub fn operations(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.operations.unwrap_or_default();
v.push(input.into());
self.operations = Some(v);
self
}
pub fn set_operations(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.operations = input;
self
}
pub fn filters(mut self, input: crate::model::SavingsPlanOfferingFilterElement) -> Self {
let mut v = self.filters.unwrap_or_default();
v.push(input);
self.filters = Some(v);
self
}
pub fn set_filters(
mut self,
input: std::option::Option<
std::vec::Vec<crate::model::SavingsPlanOfferingFilterElement>,
>,
) -> Self {
self.filters = 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::DescribeSavingsPlansOfferingsInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::DescribeSavingsPlansOfferingsInput {
offering_ids: self.offering_ids,
payment_options: self.payment_options,
product_type: self.product_type,
plan_types: self.plan_types,
durations: self.durations,
currencies: self.currencies,
descriptions: self.descriptions,
service_codes: self.service_codes,
usage_types: self.usage_types,
operations: self.operations,
filters: self.filters,
next_token: self.next_token,
max_results: self.max_results.unwrap_or_default(),
})
}
}
}
impl DescribeSavingsPlansOfferingsInput {
#[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::DescribeSavingsPlansOfferings,
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::DescribeSavingsPlansOfferingsInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/DescribeSavingsPlansOfferings")
.expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DescribeSavingsPlansOfferingsInput,
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_describe_savings_plans_offerings(&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::DescribeSavingsPlansOfferings::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DescribeSavingsPlansOfferings",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::describe_savings_plans_offerings_input::Builder {
crate::input::describe_savings_plans_offerings_input::Builder::default()
}
}
pub mod list_tags_for_resource_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::ListTagsForResourceInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::ListTagsForResourceInput {
resource_arn: self.resource_arn,
})
}
}
}
impl ListTagsForResourceInput {
#[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::ListTagsForResource,
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::ListTagsForResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/ListTagsForResource").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::ListTagsForResourceInput,
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_list_tags_for_resource(
&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::ListTagsForResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"ListTagsForResource",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::list_tags_for_resource_input::Builder {
crate::input::list_tags_for_resource_input::Builder::default()
}
}
pub mod tag_resource_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) tags: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn tags(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.tags.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.tags = Some(hash_map);
self
}
pub fn set_tags(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.tags = input;
self
}
pub fn build(
self,
) -> Result<crate::input::TagResourceInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::TagResourceInput {
resource_arn: self.resource_arn,
tags: self.tags,
})
}
}
}
impl TagResourceInput {
#[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::TagResource,
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::TagResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/TagResource").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::TagResourceInput,
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_tag_resource(&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::TagResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"TagResource",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::tag_resource_input::Builder {
crate::input::tag_resource_input::Builder::default()
}
}
pub mod untag_resource_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) resource_arn: std::option::Option<std::string::String>,
pub(crate) tag_keys: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl Builder {
pub fn resource_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.resource_arn = Some(input.into());
self
}
pub fn set_resource_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
self.resource_arn = input;
self
}
pub fn tag_keys(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.tag_keys.unwrap_or_default();
v.push(input.into());
self.tag_keys = Some(v);
self
}
pub fn set_tag_keys(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.tag_keys = input;
self
}
pub fn build(
self,
) -> Result<crate::input::UntagResourceInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::UntagResourceInput {
resource_arn: self.resource_arn,
tag_keys: self.tag_keys,
})
}
}
}
impl UntagResourceInput {
#[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::UntagResource,
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::UntagResourceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
write!(output, "/UntagResource").expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::UntagResourceInput,
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_untag_resource(&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::UntagResource::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"UntagResource",
"savingsplans",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::untag_resource_input::Builder {
crate::input::untag_resource_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct UntagResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tag_keys: std::option::Option<std::vec::Vec<std::string::String>>,
}
impl UntagResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn tag_keys(&self) -> std::option::Option<&[std::string::String]> {
self.tag_keys.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct TagResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl TagResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ListTagsForResourceInput {
#[doc(hidden)]
pub resource_arn: std::option::Option<std::string::String>,
}
impl ListTagsForResourceInput {
pub fn resource_arn(&self) -> std::option::Option<&str> {
self.resource_arn.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeSavingsPlansOfferingsInput {
#[doc(hidden)]
pub offering_ids: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub payment_options: std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
#[doc(hidden)]
pub product_type: std::option::Option<crate::model::SavingsPlanProductType>,
#[doc(hidden)]
pub plan_types: std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
#[doc(hidden)]
pub durations: std::option::Option<std::vec::Vec<i64>>,
#[doc(hidden)]
pub currencies: std::option::Option<std::vec::Vec<crate::model::CurrencyCode>>,
#[doc(hidden)]
pub descriptions: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub service_codes: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub usage_types: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub operations: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub filters: std::option::Option<std::vec::Vec<crate::model::SavingsPlanOfferingFilterElement>>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: i32,
}
impl DescribeSavingsPlansOfferingsInput {
pub fn offering_ids(&self) -> std::option::Option<&[std::string::String]> {
self.offering_ids.as_deref()
}
pub fn payment_options(
&self,
) -> std::option::Option<&[crate::model::SavingsPlanPaymentOption]> {
self.payment_options.as_deref()
}
pub fn product_type(&self) -> std::option::Option<&crate::model::SavingsPlanProductType> {
self.product_type.as_ref()
}
pub fn plan_types(&self) -> std::option::Option<&[crate::model::SavingsPlanType]> {
self.plan_types.as_deref()
}
pub fn durations(&self) -> std::option::Option<&[i64]> {
self.durations.as_deref()
}
pub fn currencies(&self) -> std::option::Option<&[crate::model::CurrencyCode]> {
self.currencies.as_deref()
}
pub fn descriptions(&self) -> std::option::Option<&[std::string::String]> {
self.descriptions.as_deref()
}
pub fn service_codes(&self) -> std::option::Option<&[std::string::String]> {
self.service_codes.as_deref()
}
pub fn usage_types(&self) -> std::option::Option<&[std::string::String]> {
self.usage_types.as_deref()
}
pub fn operations(&self) -> std::option::Option<&[std::string::String]> {
self.operations.as_deref()
}
pub fn filters(
&self,
) -> std::option::Option<&[crate::model::SavingsPlanOfferingFilterElement]> {
self.filters.as_deref()
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> i32 {
self.max_results
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeSavingsPlansOfferingRatesInput {
#[doc(hidden)]
pub savings_plan_offering_ids: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub savings_plan_payment_options:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanPaymentOption>>,
#[doc(hidden)]
pub savings_plan_types: std::option::Option<std::vec::Vec<crate::model::SavingsPlanType>>,
#[doc(hidden)]
pub products: std::option::Option<std::vec::Vec<crate::model::SavingsPlanProductType>>,
#[doc(hidden)]
pub service_codes: std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateServiceCode>>,
#[doc(hidden)]
pub usage_types: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub operations: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub filters:
std::option::Option<std::vec::Vec<crate::model::SavingsPlanOfferingRateFilterElement>>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: i32,
}
impl DescribeSavingsPlansOfferingRatesInput {
pub fn savings_plan_offering_ids(&self) -> std::option::Option<&[std::string::String]> {
self.savings_plan_offering_ids.as_deref()
}
pub fn savings_plan_payment_options(
&self,
) -> std::option::Option<&[crate::model::SavingsPlanPaymentOption]> {
self.savings_plan_payment_options.as_deref()
}
pub fn savings_plan_types(&self) -> std::option::Option<&[crate::model::SavingsPlanType]> {
self.savings_plan_types.as_deref()
}
pub fn products(&self) -> std::option::Option<&[crate::model::SavingsPlanProductType]> {
self.products.as_deref()
}
pub fn service_codes(
&self,
) -> std::option::Option<&[crate::model::SavingsPlanRateServiceCode]> {
self.service_codes.as_deref()
}
pub fn usage_types(&self) -> std::option::Option<&[std::string::String]> {
self.usage_types.as_deref()
}
pub fn operations(&self) -> std::option::Option<&[std::string::String]> {
self.operations.as_deref()
}
pub fn filters(
&self,
) -> std::option::Option<&[crate::model::SavingsPlanOfferingRateFilterElement]> {
self.filters.as_deref()
}
pub fn next_token(&self) -> std::option::Option<&str> {
self.next_token.as_deref()
}
pub fn max_results(&self) -> i32 {
self.max_results
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeSavingsPlansInput {
#[doc(hidden)]
pub savings_plan_arns: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub savings_plan_ids: std::option::Option<std::vec::Vec<std::string::String>>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
#[doc(hidden)]
pub states: std::option::Option<std::vec::Vec<crate::model::SavingsPlanState>>,
#[doc(hidden)]
pub filters: std::option::Option<std::vec::Vec<crate::model::SavingsPlanFilter>>,
}
impl DescribeSavingsPlansInput {
pub fn savings_plan_arns(&self) -> std::option::Option<&[std::string::String]> {
self.savings_plan_arns.as_deref()
}
pub fn savings_plan_ids(&self) -> std::option::Option<&[std::string::String]> {
self.savings_plan_ids.as_deref()
}
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
}
pub fn states(&self) -> std::option::Option<&[crate::model::SavingsPlanState]> {
self.states.as_deref()
}
pub fn filters(&self) -> std::option::Option<&[crate::model::SavingsPlanFilter]> {
self.filters.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DescribeSavingsPlanRatesInput {
#[doc(hidden)]
pub savings_plan_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub filters: std::option::Option<std::vec::Vec<crate::model::SavingsPlanRateFilter>>,
#[doc(hidden)]
pub next_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub max_results: std::option::Option<i32>,
}
impl DescribeSavingsPlanRatesInput {
pub fn savings_plan_id(&self) -> std::option::Option<&str> {
self.savings_plan_id.as_deref()
}
pub fn filters(&self) -> std::option::Option<&[crate::model::SavingsPlanRateFilter]> {
self.filters.as_deref()
}
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 DeleteQueuedSavingsPlanInput {
#[doc(hidden)]
pub savings_plan_id: std::option::Option<std::string::String>,
}
impl DeleteQueuedSavingsPlanInput {
pub fn savings_plan_id(&self) -> std::option::Option<&str> {
self.savings_plan_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct CreateSavingsPlanInput {
#[doc(hidden)]
pub savings_plan_offering_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub commitment: std::option::Option<std::string::String>,
#[doc(hidden)]
pub upfront_payment_amount: std::option::Option<std::string::String>,
#[doc(hidden)]
pub purchase_time: std::option::Option<aws_smithy_types::DateTime>,
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
#[doc(hidden)]
pub tags:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl CreateSavingsPlanInput {
pub fn savings_plan_offering_id(&self) -> std::option::Option<&str> {
self.savings_plan_offering_id.as_deref()
}
pub fn commitment(&self) -> std::option::Option<&str> {
self.commitment.as_deref()
}
pub fn upfront_payment_amount(&self) -> std::option::Option<&str> {
self.upfront_payment_amount.as_deref()
}
pub fn purchase_time(&self) -> std::option::Option<&aws_smithy_types::DateTime> {
self.purchase_time.as_ref()
}
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
pub fn tags(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.tags.as_ref()
}
}