Struct aws_sdk_costoptimizationhub::client::Client
source · pub struct Client { /* private fields */ }
Expand description
Client for Cost Optimization Hub
Client for invoking operations on Cost Optimization Hub. Each operation on Cost Optimization Hub 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_costoptimizationhub::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_costoptimizationhub::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 GetRecommendation
operation has
a Client::get_recommendation
, 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.get_recommendation()
.recommendation_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 get_preferences(&self) -> GetPreferencesFluentBuilder
pub fn get_preferences(&self) -> GetPreferencesFluentBuilder
Constructs a fluent builder for the GetPreferences
operation.
- The fluent builder takes no input, just
send
it. - On success, responds with
GetPreferencesOutput
with field(s):savings_estimation_mode(Option<SavingsEstimationMode>)
:Retrieves the status of the “savings estimation mode” preference.
member_account_discount_visibility(Option<MemberAccountDiscountVisibility>)
:Retrieves the status of the “member account discount visibility” preference.
- On failure, responds with
SdkError<GetPreferencesError>
source§impl Client
impl Client
sourcepub fn get_recommendation(&self) -> GetRecommendationFluentBuilder
pub fn get_recommendation(&self) -> GetRecommendationFluentBuilder
Constructs a fluent builder for the GetRecommendation
operation.
- The fluent builder is configurable:
recommendation_id(impl Into<String>)
/set_recommendation_id(Option<String>)
:
required: trueThe ID for the recommendation.
- On success, responds with
GetRecommendationOutput
with field(s):recommendation_id(Option<String>)
:The ID for the recommendation.
resource_id(Option<String>)
:The unique identifier for the resource. This is the same as the Amazon Resource Name (ARN), if available.
resource_arn(Option<String>)
:The Amazon Resource Name (ARN) of the resource.
account_id(Option<String>)
:The account that the recommendation is for.
currency_code(Option<String>)
:The currency code used for the recommendation.
recommendation_lookback_period_in_days(Option<i32>)
:The lookback period that’s used to generate the recommendation.
cost_calculation_lookback_period_in_days(Option<i32>)
:The lookback period used to calculate cost impact for a recommendation.
estimated_savings_percentage(Option<f64>)
:The estimated savings percentage relative to the total cost over the cost calculation lookback period.
estimated_savings_over_cost_calculation_lookback_period(Option<f64>)
:The estimated savings amount over the lookback period used to calculate cost impact for a recommendation.
current_resource_type(Option<ResourceType>)
:The type of resource.
recommended_resource_type(Option<ResourceType>)
:The resource type of the recommendation.
region(Option<String>)
:The Amazon Web Services Region of the resource.
source(Option<Source>)
:The source of the recommendation.
last_refresh_timestamp(Option<DateTime>)
:The time when the recommendation was last generated.
estimated_monthly_savings(Option<f64>)
:The estimated monthly savings amount for the recommendation.
estimated_monthly_cost(Option<f64>)
:The estimated monthly cost of the recommendation.
implementation_effort(Option<ImplementationEffort>)
:The effort required to implement the recommendation.
restart_needed(Option<bool>)
:Whether or not implementing the recommendation requires a restart.
action_type(Option<ActionType>)
:The type of action you can take by adopting the recommendation.
rollback_possible(Option<bool>)
:Whether or not implementing the recommendation can be rolled back.
current_resource_details(Option<ResourceDetails>)
:The details for the resource.
recommended_resource_details(Option<ResourceDetails>)
:The details about the recommended resource.
tags(Option<Vec::<Tag>>)
:A list of tags associated with the resource for which the recommendation exists.
- On failure, responds with
SdkError<GetRecommendationError>
source§impl Client
impl Client
sourcepub fn list_enrollment_statuses(&self) -> ListEnrollmentStatusesFluentBuilder
pub fn list_enrollment_statuses(&self) -> ListEnrollmentStatusesFluentBuilder
Constructs a fluent builder for the ListEnrollmentStatuses
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
include_organization_info(bool)
/set_include_organization_info(Option<bool>)
:
required: falseIndicates whether to return the enrollment status for the organization.
account_id(impl Into<String>)
/set_account_id(Option<String>)
:
required: falseThe account ID of a member account in the organization.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token to retrieve the next set of results.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of objects that are returned for the request.
- On success, responds with
ListEnrollmentStatusesOutput
with field(s):items(Option<Vec::<AccountEnrollmentStatus>>)
:The enrollment status of a specific account ID, including creation and last updated timestamps.
include_member_accounts(Option<bool>)
:The enrollment status of all member accounts in the organization if the account is the management account.
next_token(Option<String>)
:The token to retrieve the next set of results.
- On failure, responds with
SdkError<ListEnrollmentStatusesError>
source§impl Client
impl Client
sourcepub fn list_recommendation_summaries(
&self
) -> ListRecommendationSummariesFluentBuilder
pub fn list_recommendation_summaries( &self ) -> ListRecommendationSummariesFluentBuilder
Constructs a fluent builder for the ListRecommendationSummaries
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
filter(Filter)
/set_filter(Option<Filter>)
:
required: falseDescribes a filter that returns a more specific list of recommendations. Filters recommendations by different dimensions.
group_by(impl Into<String>)
/set_group_by(Option<String>)
:
required: trueThe grouping of recommendations by a dimension.
max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of recommendations that are returned for the request.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token to retrieve the next set of results.
- On success, responds with
ListRecommendationSummariesOutput
with field(s):estimated_total_deduped_savings(Option<f64>)
:The total overall savings for the aggregated view.
items(Option<Vec::<RecommendationSummary>>)
:List of all savings recommendations.
group_by(Option<String>)
:The dimension used to group the recommendations by.
currency_code(Option<String>)
:The currency code used for the recommendation.
next_token(Option<String>)
:The token to retrieve the next set of results.
- On failure, responds with
SdkError<ListRecommendationSummariesError>
source§impl Client
impl Client
sourcepub fn list_recommendations(&self) -> ListRecommendationsFluentBuilder
pub fn list_recommendations(&self) -> ListRecommendationsFluentBuilder
Constructs a fluent builder for the ListRecommendations
operation.
This operation supports pagination; See into_paginator()
.
- The fluent builder is configurable:
filter(Filter)
/set_filter(Option<Filter>)
:
required: falseThe constraints that you want all returned recommendations to match.
order_by(OrderBy)
/set_order_by(Option<OrderBy>)
:
required: falseThe ordering of recommendations by a dimension.
include_all_recommendations(bool)
/set_include_all_recommendations(Option<bool>)
:
required: falseList of all recommendations for a resource, or a single recommendation if de-duped by
resourceId
.max_results(i32)
/set_max_results(Option<i32>)
:
required: falseThe maximum number of recommendations that are returned for the request.
next_token(impl Into<String>)
/set_next_token(Option<String>)
:
required: falseThe token to retrieve the next set of results.
- On success, responds with
ListRecommendationsOutput
with field(s):items(Option<Vec::<Recommendation>>)
:List of all savings recommendations.
next_token(Option<String>)
:The token to retrieve the next set of results.
- On failure, responds with
SdkError<ListRecommendationsError>
source§impl Client
impl Client
sourcepub fn update_enrollment_status(&self) -> UpdateEnrollmentStatusFluentBuilder
pub fn update_enrollment_status(&self) -> UpdateEnrollmentStatusFluentBuilder
Constructs a fluent builder for the UpdateEnrollmentStatus
operation.
- The fluent builder is configurable:
status(EnrollmentStatus)
/set_status(Option<EnrollmentStatus>)
:
required: trueSets the account status.
include_member_accounts(bool)
/set_include_member_accounts(Option<bool>)
:
required: falseIndicates whether to enroll member accounts of the organization if the account is the management account.
- On success, responds with
UpdateEnrollmentStatusOutput
with field(s):status(Option<String>)
:The enrollment status of the account.
- On failure, responds with
SdkError<UpdateEnrollmentStatusError>
source§impl Client
impl Client
sourcepub fn update_preferences(&self) -> UpdatePreferencesFluentBuilder
pub fn update_preferences(&self) -> UpdatePreferencesFluentBuilder
Constructs a fluent builder for the UpdatePreferences
operation.
- The fluent builder is configurable:
savings_estimation_mode(SavingsEstimationMode)
/set_savings_estimation_mode(Option<SavingsEstimationMode>)
:
required: falseSets the “savings estimation mode” preference.
member_account_discount_visibility(MemberAccountDiscountVisibility)
/set_member_account_discount_visibility(Option<MemberAccountDiscountVisibility>)
:
required: falseSets the “member account discount visibility” preference.
- On success, responds with
UpdatePreferencesOutput
with field(s):savings_estimation_mode(Option<SavingsEstimationMode>)
:Shows the status of the “savings estimation mode” preference.
member_account_discount_visibility(Option<MemberAccountDiscountVisibility>)
:Shows the status of the “member account discount visibility” preference.
- On failure, responds with
SdkError<UpdatePreferencesError>
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