Struct aws_sdk_savingsplans::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for AWS Savings Plans
Client for invoking operations on AWS Savings Plans. Each operation on AWS Savings Plans is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
§Constructing a Client
A Config
is required to construct a client. For most use cases, the aws-config
crate should be used to automatically resolve this config using
aws_config::load_from_env()
, since this will resolve an SdkConfig
which can be shared
across multiple different AWS SDK clients. This config resolution process can be customized
by calling aws_config::from_env()
instead, which returns a ConfigLoader
that uses
the builder pattern to customize the default config.
In the simplest case, creating a client looks as follows:
let config = aws_config::load_from_env().await;
let client = aws_sdk_savingsplans::Client::new(&config);
Occasionally, SDKs may have additional service-specific values that can be set on the Config
that
is absent from SdkConfig
, or slightly different settings for a specific client may be desired.
The Config
struct implements From<&SdkConfig>
, so setting these specific settings can be
done as follows:
let sdk_config = ::aws_config::load_from_env().await;
let config = aws_sdk_savingsplans::config::Builder::from(&sdk_config)
.some_service_specific_setting("value")
.build();
See the aws-config
docs and Config
for more information on customizing configuration.
Note: Client construction is expensive due to connection thread pool initialization, and should be done once at application start-up.
§Using the Client
A client has a function for every operation that can be performed by the service.
For example, the CreateSavingsPlan
operation has
a Client::create_savings_plan
, function which returns a builder for that operation.
The fluent builder ultimately has a send()
function that returns an async future that
returns a result, as illustrated below:
let result = client.create_savings_plan()
.savings_plan_offering_id("example")
.send()
.await;
The underlying HTTP requests that get made by this can be modified with the customize_operation
function on the fluent builder. See the customize
module for more
information.
Implementations§
source§impl Client
impl Client
sourcepub fn create_savings_plan(&self) -> CreateSavingsPlanFluentBuilder
pub fn create_savings_plan(&self) -> CreateSavingsPlanFluentBuilder
Constructs a fluent builder for the CreateSavingsPlan
operation.
- The fluent builder is configurable:
savings_plan_offering_id(impl Into<String>)
/set_savings_plan_offering_id(Option<String>)
:
required: trueThe ID of the offering.
commitment(impl Into<String>)
/set_commitment(Option<String>)
:
required: trueThe hourly commitment, in the same currency of the
savingsPlanOfferingId
. This is a value between 0.001 and 1 million. You cannot specify more than five digits after the decimal point.upfront_payment_amount(impl Into<String>)
/set_upfront_payment_amount(Option<String>)
:
required: falseThe up-front payment amount. This is a whole number between 50 and 99 percent of the total value of the Savings Plan. This parameter is only supported if the payment option is
Partial Upfront
.purchase_time(DateTime)
/set_purchase_time(Option<DateTime>)
:
required: falseThe purchase time of the Savings Plan in UTC format (YYYY-MM-DDTHH:MM:SSZ).
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseA unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: falseOne or more tags.
- On success, responds with
CreateSavingsPlanOutput
with field(s):savings_plan_id(Option<String>)
:The ID of the Savings Plan.
- On failure, responds with
SdkError<CreateSavingsPlanError>
source§impl Client
impl Client
sourcepub fn delete_queued_savings_plan(&self) -> DeleteQueuedSavingsPlanFluentBuilder
pub fn delete_queued_savings_plan(&self) -> DeleteQueuedSavingsPlanFluentBuilder
Constructs a fluent builder for the DeleteQueuedSavingsPlan
operation.
- The fluent builder is configurable:
savings_plan_id(impl Into<String>)
/set_savings_plan_id(Option<String>)
:
required: trueThe ID of the Savings Plan.
- On success, responds with
DeleteQueuedSavingsPlanOutput
- On failure, responds with
SdkError<DeleteQueuedSavingsPlanError>
source§impl Client
impl Client
sourcepub fn describe_savings_plan_rates(
&self
) -> DescribeSavingsPlanRatesFluentBuilder
pub fn describe_savings_plan_rates( &self ) -> DescribeSavingsPlanRatesFluentBuilder
Constructs a fluent builder for the DescribeSavingsPlanRates
operation.
- The fluent builder is configurable:
savings_plan_id(impl Into<String>)
/set_savings_plan_id(Option<String>)
:
required: trueThe ID of the Savings Plan.
filters(SavingsPlanRateFilter)
/set_filters(Option<Vec::<SavingsPlanRateFilter>>)
:
required: falseThe filters.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next page of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return with a single call. To retrieve additional results, make another call with the returned token value.
- On success, responds with
DescribeSavingsPlanRatesOutput
with field(s):savings_plan_id(Option<String>)
:The ID of the Savings Plan.
search_results(Option<Vec::<SavingsPlanRate>>)
:Information about the Savings Plan rates.
next_token(Option<String>)
:The token to use to retrieve the next page of results. This value is null when there are no more results to return.
- On failure, responds with
SdkError<DescribeSavingsPlanRatesError>
source§impl Client
impl Client
sourcepub fn describe_savings_plans(&self) -> DescribeSavingsPlansFluentBuilder
pub fn describe_savings_plans(&self) -> DescribeSavingsPlansFluentBuilder
Constructs a fluent builder for the DescribeSavingsPlans
operation.
- The fluent builder is configurable:
savings_plan_arns(impl Into<String>)
/set_savings_plan_arns(Option<Vec::<String>>)
:
required: falseThe Amazon Resource Names (ARN) of the Savings Plans.
savings_plan_ids(impl Into<String>)
/set_savings_plan_ids(Option<Vec::<String>>)
:
required: falseThe IDs of the Savings Plans.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next page of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return with a single call. To retrieve additional results, make another call with the returned token value.
states(SavingsPlanState)
/set_states(Option<Vec::<SavingsPlanState>>)
:
required: falseThe current states of the Savings Plans.
filters(SavingsPlanFilter)
/set_filters(Option<Vec::<SavingsPlanFilter>>)
:
required: falseThe filters.
- On success, responds with
DescribeSavingsPlansOutput
with field(s):savings_plans(Option<Vec::<SavingsPlan>>)
:Information about the Savings Plans.
next_token(Option<String>)
:The token to use to retrieve the next page of results. This value is null when there are no more results to return.
- On failure, responds with
SdkError<DescribeSavingsPlansError>
source§impl Client
impl Client
sourcepub fn describe_savings_plans_offering_rates(
&self
) -> DescribeSavingsPlansOfferingRatesFluentBuilder
pub fn describe_savings_plans_offering_rates( &self ) -> DescribeSavingsPlansOfferingRatesFluentBuilder
Constructs a fluent builder for the DescribeSavingsPlansOfferingRates
operation.
- The fluent builder is configurable:
savings_plan_offering_ids(impl Into<String>)
/set_savings_plan_offering_ids(Option<Vec::<String>>)
:
required: falseThe IDs of the offerings.
savings_plan_payment_options(SavingsPlanPaymentOption)
/set_savings_plan_payment_options(Option<Vec::<SavingsPlanPaymentOption>>)
:
required: falseThe payment options.
savings_plan_types(SavingsPlanType)
/set_savings_plan_types(Option<Vec::<SavingsPlanType>>)
:
required: falseThe plan types.
products(SavingsPlanProductType)
/set_products(Option<Vec::<SavingsPlanProductType>>)
:
required: falseThe Amazon Web Services products.
service_codes(SavingsPlanRateServiceCode)
/set_service_codes(Option<Vec::<SavingsPlanRateServiceCode>>)
:
required: falseThe services.
usage_types(impl Into<String>)
/set_usage_types(Option<Vec::<String>>)
:
required: falseThe usage details of the line item in the billing report.
operations(impl Into<String>)
/set_operations(Option<Vec::<String>>)
:
required: falseThe specific Amazon Web Services operation for the line item in the billing report.
filters(SavingsPlanOfferingRateFilterElement)
/set_filters(Option<Vec::<SavingsPlanOfferingRateFilterElement>>)
:
required: falseThe filters.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next page of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return with a single call. To retrieve additional results, make another call with the returned token value.
- On success, responds with
DescribeSavingsPlansOfferingRatesOutput
with field(s):search_results(Option<Vec::<SavingsPlanOfferingRate>>)
:Information about the Savings Plans offering rates.
next_token(Option<String>)
:The token to use to retrieve the next page of results. This value is null when there are no more results to return.
- On failure, responds with
SdkError<DescribeSavingsPlansOfferingRatesError>
source§impl Client
impl Client
sourcepub fn describe_savings_plans_offerings(
&self
) -> DescribeSavingsPlansOfferingsFluentBuilder
pub fn describe_savings_plans_offerings( &self ) -> DescribeSavingsPlansOfferingsFluentBuilder
Constructs a fluent builder for the DescribeSavingsPlansOfferings
operation.
- The fluent builder is configurable:
offering_ids(impl Into<String>)
/set_offering_ids(Option<Vec::<String>>)
:
required: falseThe IDs of the offerings.
payment_options(SavingsPlanPaymentOption)
/set_payment_options(Option<Vec::<SavingsPlanPaymentOption>>)
:
required: falseThe payment options.
product_type(SavingsPlanProductType)
/set_product_type(Option<SavingsPlanProductType>)
:
required: falseThe product type.
plan_types(SavingsPlanType)
/set_plan_types(Option<Vec::<SavingsPlanType>>)
:
required: falseThe plan types.
durations(i64)
/set_durations(Option<Vec::<i64>>)
:
required: falseThe duration, in seconds.
currencies(CurrencyCode)
/set_currencies(Option<Vec::<CurrencyCode>>)
:
required: falseThe currencies.
descriptions(impl Into<String>)
/set_descriptions(Option<Vec::<String>>)
:
required: falseThe descriptions.
service_codes(impl Into<String>)
/set_service_codes(Option<Vec::<String>>)
:
required: falseThe services.
usage_types(impl Into<String>)
/set_usage_types(Option<Vec::<String>>)
:
required: falseThe usage details of the line item in the billing report.
operations(impl Into<String>)
/set_operations(Option<Vec::<String>>)
:
required: falseThe specific Amazon Web Services operation for the line item in the billing report.
filters(SavingsPlanOfferingFilterElement)
/set_filters(Option<Vec::<SavingsPlanOfferingFilterElement>>)
:
required: falseThe filters.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token for the next page of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return with a single call. To retrieve additional results, make another call with the returned token value.
- On success, responds with
DescribeSavingsPlansOfferingsOutput
with field(s):search_results(Option<Vec::<SavingsPlanOffering>>)
:Information about the Savings Plans offerings.
next_token(Option<String>)
:The token to use to retrieve the next page of results. This value is null when there are no more results to return.
- On failure, responds with
SdkError<DescribeSavingsPlansOfferingsError>
source§impl Client
impl Client
Constructs a fluent builder for the ListTagsForResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource.
- On success, responds with
ListTagsForResourceOutput
with field(s):tags(Option<HashMap::<String, String>>)
:Information about the tags.
- On failure, responds with
SdkError<ListTagsForResourceError>
source§impl Client
impl Client
sourcepub fn return_savings_plan(&self) -> ReturnSavingsPlanFluentBuilder
pub fn return_savings_plan(&self) -> ReturnSavingsPlanFluentBuilder
Constructs a fluent builder for the ReturnSavingsPlan
operation.
- The fluent builder is configurable:
savings_plan_id(impl Into<String>)
/set_savings_plan_id(Option<String>)
:
required: trueThe ID of the Savings Plan.
client_token(impl Into<String>)
/set_client_token(Option<String>)
:
required: falseA unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
- On success, responds with
ReturnSavingsPlanOutput
with field(s):savings_plan_id(Option<String>)
:The ID of the Savings Plan.
- On failure, responds with
SdkError<ReturnSavingsPlanError>
source§impl Client
impl Client
sourcepub fn tag_resource(&self) -> TagResourceFluentBuilder
pub fn tag_resource(&self) -> TagResourceFluentBuilder
Constructs a fluent builder for the TagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource.
tags(impl Into<String>, impl Into<String>)
/set_tags(Option<HashMap::<String, String>>)
:
required: trueOne or more tags. For example, { “tags”: {“key1”:“value1”, “key2”:“value2”} }.
- On success, responds with
TagResourceOutput
- On failure, responds with
SdkError<TagResourceError>
source§impl Client
impl Client
sourcepub fn untag_resource(&self) -> UntagResourceFluentBuilder
pub fn untag_resource(&self) -> UntagResourceFluentBuilder
Constructs a fluent builder for the UntagResource
operation.
- The fluent builder is configurable:
resource_arn(impl Into<String>)
/set_resource_arn(Option<String>)
:
required: trueThe Amazon Resource Name (ARN) of the resource.
tag_keys(impl Into<String>)
/set_tag_keys(Option<Vec::<String>>)
:
required: trueThe tag keys.
- On success, responds with
UntagResourceOutput
- On failure, responds with
SdkError<UntagResourceError>
source§impl Client
impl Client
sourcepub fn from_conf(conf: Config) -> Self
pub fn from_conf(conf: Config) -> Self
Creates a new client from the service Config
.
§Panics
This method will panic in the following cases:
- Retries or timeouts are enabled without a
sleep_impl
configured. - Identity caching is enabled without a
sleep_impl
andtime_source
configured. - No
behavior_version
is provided.
The panic message for each of these will have instructions on how to resolve them.
source§impl Client
impl Client
sourcepub fn new(sdk_config: &SdkConfig) -> Self
pub fn new(sdk_config: &SdkConfig) -> Self
Creates a new client from an SDK Config.
§Panics
- This method will panic if the
sdk_config
is missing an async sleep implementation. If you experience this panic, set thesleep_impl
on the Config passed into this function to fix it. - This method will panic if the
sdk_config
is missing an HTTP connector. If you experience this panic, set thehttp_connector
on the Config passed into this function to fix it. - This method will panic if no
BehaviorVersion
is provided. If you experience this panic, setbehavior_version
on the Config or enable thebehavior-version-latest
Cargo feature.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more