Struct aws_sdk_pricing::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for AWS Price List Service
Client for invoking operations on AWS Price List Service. Each operation on AWS Price List Service 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_pricing::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_pricing::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 DescribeServices
operation has
a Client::describe_services
, 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.describe_services()
.service_code("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 describe_services(&self) -> DescribeServicesFluentBuilder
pub fn describe_services(&self) -> DescribeServicesFluentBuilder
Constructs a fluent builder for the DescribeServices
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: falseThe code for the service whose information you want to retrieve, such as
AmazonEC2
. You can use theServiceCode
to filter the results in aGetProducts
call. To retrieve a list of all services, leave this blank.format_version(impl Into<String>)
/set_format_version(Option<String>)
:
required: falseThe format version that you want the response to be in.
Valid values are:
aws_v1
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe pagination token that indicates the next set of results that you want to retrieve.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results that you want returned in the response.
- On success, responds with
DescribeServicesOutput
with field(s):services(Option<Vec::<Service>>)
:The service metadata for the service or services in the response.
format_version(Option<String>)
:The format version of the response. For example,
aws_v1
.next_token(Option<String>)
:The pagination token for the next set of retrievable results.
- On failure, responds with
SdkError<DescribeServicesError>
source§impl Client
impl Client
sourcepub fn get_attribute_values(&self) -> GetAttributeValuesFluentBuilder
pub fn get_attribute_values(&self) -> GetAttributeValuesFluentBuilder
Constructs a fluent builder for the GetAttributeValues
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: trueThe service code for the service whose attributes you want to retrieve. For example, if you want the retrieve an EC2 attribute, use
AmazonEC2
.attribute_name(impl Into<String>)
/set_attribute_name(Option<String>)
:
required: trueThe name of the attribute that you want to retrieve the values for, such as
volumeType
.next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe pagination token that indicates the next set of results that you want to retrieve.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return in response.
- On success, responds with
GetAttributeValuesOutput
with field(s):attribute_values(Option<Vec::<AttributeValue>>)
:The list of values for an attribute. For example,
Throughput Optimized HDD
andProvisioned IOPS
are two available values for theAmazonEC2
volumeType
.next_token(Option<String>)
:The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<GetAttributeValuesError>
source§impl Client
impl Client
sourcepub fn get_price_list_file_url(&self) -> GetPriceListFileUrlFluentBuilder
pub fn get_price_list_file_url(&self) -> GetPriceListFileUrlFluentBuilder
Constructs a fluent builder for the GetPriceListFileUrl
operation.
- The fluent builder is configurable:
price_list_arn(impl Into<String>)
/set_price_list_arn(Option<String>)
:
required: trueThe unique identifier that maps to where your Price List files are located.
PriceListArn
can be obtained from the ListPriceLists response.file_format(impl Into<String>)
/set_file_format(Option<String>)
:
required: trueThe format that you want to retrieve your Price List files in. The
FileFormat
can be obtained from the ListPriceLists response.
- On success, responds with
GetPriceListFileUrlOutput
with field(s):url(Option<String>)
:The URL to download your Price List file from.
- On failure, responds with
SdkError<GetPriceListFileUrlError>
source§impl Client
impl Client
sourcepub fn get_products(&self) -> GetProductsFluentBuilder
pub fn get_products(&self) -> GetProductsFluentBuilder
Constructs a fluent builder for the GetProducts
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: trueThe code for the service whose products you want to retrieve.
filters(Filter)
/set_filters(Option<Vec::<Filter>>)
:
required: falseThe list of filters that limit the returned products. only products that match all filters are returned.
format_version(impl Into<String>)
/set_format_version(Option<String>)
:
required: falseThe format version that you want the response to be in.
Valid values are:
aws_v1
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe pagination token that indicates the next set of results that you want to retrieve.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return in the response.
- On success, responds with
GetProductsOutput
with field(s):format_version(Option<String>)
:The format version of the response. For example, aws_v1.
price_list(Option<Vec::<String>>)
:The list of products that match your filters. The list contains both the product metadata and the price information.
next_token(Option<String>)
:The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<GetProductsError>
source§impl Client
impl Client
sourcepub fn list_price_lists(&self) -> ListPriceListsFluentBuilder
pub fn list_price_lists(&self) -> ListPriceListsFluentBuilder
Constructs a fluent builder for the ListPriceLists
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
service_code(impl Into<String>)
/set_service_code(Option<String>)
:
required: trueThe service code or the Savings Plan service code for the attributes that you want to retrieve. For example, to get the list of applicable Amazon EC2 price lists, use
AmazonEC2
. For a full list of service codes containing On-Demand and Reserved Instance (RI) pricing, use the DescribeServices API.To retrieve the Reserved Instance and Compute Savings Plan price lists, use
ComputeSavingsPlans
.To retrieve Machine Learning Savings Plans price lists, use
MachineLearningSavingsPlans
.effective_date(DateTime)
/set_effective_date(Option<DateTime>)
:
required: trueThe date that the Price List file prices are effective from.
region_code(impl Into<String>)
/set_region_code(Option<String>)
:
required: falseThis is used to filter the Price List by Amazon Web Services Region. For example, to get the price list only for the
US East (N. Virginia)
Region, useus-east-1
. If nothing is specified, you retrieve price lists for all applicable Regions. The availableRegionCode
list can be retrieved from GetAttributeValues API.currency_code(impl Into<String>)
/set_currency_code(Option<String>)
:
required: trueThe three alphabetical character ISO-4217 currency code that the Price List files are denominated in.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe pagination token that indicates the next set of results that you want to retrieve.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of results to return in the response.
- On success, responds with
ListPriceListsOutput
with field(s):price_lists(Option<Vec::<PriceList>>)
:The type of price list references that match your request.
next_token(Option<String>)
:The pagination token that indicates the next set of results to retrieve.
- On failure, responds with
SdkError<ListPriceListsError>
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