pub struct Client { /* private fields */ }Expand description
Client for AWS Payments
Client for invoking operations on AWS Payments. Each operation on AWS Payments 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_payments::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 Builder 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_payments::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 GetAccountBalance operation has
a Client::get_account_balance, 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_account_balance()
.balance_type("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 batch_get_financial_record(&self) -> BatchGetFinancialRecordFluentBuilder
pub fn batch_get_financial_record(&self) -> BatchGetFinancialRecordFluentBuilder
Constructs a fluent builder for the BatchGetFinancialRecord operation.
- The fluent builder is configurable:
keys(FinancialRecordKey)/set_keys(Option<Vec::<FinancialRecordKey>>):
required: trueThe keys of the financial records to retrieve. Each key is either the record’s ID or its invoice ID.
- On success, responds with
BatchGetFinancialRecordOutputwith field(s):financial_records(Vec::<FinancialRecord>):The financial records that the operation retrieved, in no particular order. This list contains fewer records than you requested when
errorsnames one or more keys.errors(Vec::<FinancialRecordError>):The errors for the records that the operation couldn’t retrieve, one for each record, with the key as you requested it and the reason. This list is empty when the operation retrieved every record.
- On failure, responds with
SdkError<BatchGetFinancialRecordError>
Source§impl Client
impl Client
Sourcepub fn get_account_balance(&self) -> GetAccountBalanceFluentBuilder
pub fn get_account_balance(&self) -> GetAccountBalanceFluentBuilder
Constructs a fluent builder for the GetAccountBalance operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
balance_type(BalanceType)/set_balance_type(Option<BalanceType>):
required: trueThe balance to retrieve. You can specify only one balance type in a single request. Each balance adds up the
outstandingbalance of the records that have the statusOUTSTANDING. A record that isPROCESSING,SETTLED, orCANCELEDisn’t included, even when part of its amount is outstanding. The following values are valid:-
INVOICES_DUE– The outstanding balance of yourOUTSTANDINGinvoices that aren’t past their due date, wheredueStatusisDUE. -
INVOICES_PAST_DUE– The outstanding balance of yourOUTSTANDINGinvoices that are past their due date, wheredueStatusisPAST_DUE. -
OUTSTANDING_CREDIT_MEMOS– The outstanding balance of yourOUTSTANDINGcredit memos: the credit that isn’t yet applied to an invoice.
-
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe pagination token from the
nextTokenof the previous response. Omit it to get the first page. Tokens expire. If the token is malformed or expired, or doesn’t match the original request, the request fails withValidationExceptionand the reasonINVALID_PAGINATION_TOKEN. In that case, start again from the first page.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of results to return in one page. The default is 100. A page can contain fewer results even when more remain. Use
nextTokento find out whether more results are available.
- On success, responds with
GetAccountBalanceOutputwith field(s):account_balances(Vec::<AccountBalance>):The balance, as one amount for each merchant of record and currency. This list is empty when your account has nothing in the requested balance.
next_token(Option<String>):The pagination token that indicates the next set of results to retrieve. This value is absent when there are no more results.
- On failure, responds with
SdkError<GetAccountBalanceError>
Source§impl Client
impl Client
Sourcepub fn get_financial_record(&self) -> GetFinancialRecordFluentBuilder
pub fn get_financial_record(&self) -> GetFinancialRecordFluentBuilder
Constructs a fluent builder for the GetFinancialRecord operation.
- The fluent builder is configurable:
identifier(impl Into<String>)/set_identifier(Option<String>):
required: falseThe ID that Amazon Web Services Payments issued for the financial record, as returned in
id.invoice_identifier(impl Into<String>)/set_invoice_identifier(Option<String>):
required: falseThe invoice ID that Amazon Web Services Invoicing issued for an invoice or a credit memo. The operation returns the record that has this invoice ID.
- On success, responds with
GetFinancialRecordOutputwith field(s):financial_record(Option<FinancialRecord>):The requested financial record.
- On failure, responds with
SdkError<GetFinancialRecordError>
Source§impl Client
impl Client
Sourcepub fn get_payment_instrument(&self) -> GetPaymentInstrumentFluentBuilder
pub fn get_payment_instrument(&self) -> GetPaymentInstrumentFluentBuilder
Constructs a fluent builder for the GetPaymentInstrument operation.
- The fluent builder is configurable:
identifier(impl Into<String>)/set_identifier(Option<String>):
required: trueThe instrument to retrieve. Specify one of the following:
-
The Amazon Resource Name (ARN) of the instrument, as
ListPaymentInstrumentsreturns inarn. The ARN must be for an instrument on your account. -
The ID of the instrument, as
ListPaymentInstrumentsreturns inid.
-
- On success, responds with
GetPaymentInstrumentOutputwith field(s):payment_instrument(Option<PaymentInstrument>):The payment instrument, including the details that are specific to its payment method.
- On failure, responds with
SdkError<GetPaymentInstrumentError>
Source§impl Client
impl Client
Sourcepub fn list_financial_records(&self) -> ListFinancialRecordsFluentBuilder
pub fn list_financial_records(&self) -> ListFinancialRecordsFluentBuilder
Constructs a fluent builder for the ListFinancialRecords operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
types(FinancialRecordType)/set_types(Option<Vec::<FinancialRecordType>>):
required: trueThe financial record types to return. The following values are valid:
-
INVOICE– An invoice: a bill from Amazon Web Services. Payments and credit memos applied to the invoice settle it. -
CREDIT_MEMO– A credit memo: a credit issued to your account, for example for a billing correction or a service credit. Applying it to one or more invoices settles it.
-
settlement_statuses(SettlementStatus)/set_settlement_statuses(Option<Vec::<SettlementStatus>>):
required: falseThe settlement statuses to filter by.
OPENreturns records whosestatusisOUTSTANDINGorPROCESSING.CLOSEDreturns records whosestatusisSETTLEDorCANCELED. When you omit this member, the operation returns records with both settlement statuses.issued_after(DateTime)/set_issued_after(Option<DateTime>):
required: falseThe earliest date and time to return records for, inclusive. The operation returns the records that were issued at or after this time.
issued_before(DateTime)/set_issued_before(Option<DateTime>):
required: falseThe latest date and time to return records for, exclusive. The operation returns the records that were issued before this time. When you specify both
issuedAfterandissuedBefore,issuedBeforemust be later thanissuedAfter.sort_by(FinancialRecordSortField)/set_sort_by(Option<FinancialRecordSortField>):
required: falseThe field to sort the results by. The default is
ISSUED_AT, the date and time when the record was issued.sort_order(SortOrder)/set_sort_order(Option<SortOrder>):
required: falseThe order to sort the results in. The default is
DESCENDING, which returns the newest records first.ASCENDINGreturns the oldest records first.next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe pagination token from the
nextTokenof the previous response. Omit it to get the first page. Tokens expire. If the token is malformed or expired, or doesn’t match the original request, the request fails withValidationExceptionand the reasonINVALID_PAGINATION_TOKEN. In that case, start again from the first page.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of results to return in one page. The default is 100. A page can contain fewer results even when more remain. Use
nextTokento find out whether more results are available.
- On success, responds with
ListFinancialRecordsOutputwith field(s):financial_record_summaries(Vec::<FinancialRecordSummary>):The financial record summaries that match your filters, in the requested order. This list is empty when no record matches.
next_token(Option<String>):The pagination token that indicates the next set of results to retrieve. This value is absent when there are no more results.
- On failure, responds with
SdkError<ListFinancialRecordsError>
Source§impl Client
impl Client
Sourcepub fn list_payment_instruments(&self) -> ListPaymentInstrumentsFluentBuilder
pub fn list_payment_instruments(&self) -> ListPaymentInstrumentsFluentBuilder
Constructs a fluent builder for the ListPaymentInstruments operation.
This operation supports pagination; See into_paginator().
- The fluent builder is configurable:
next_token(impl Into<String>)/set_next_token(Option<String>):
required: falseThe pagination token from the
nextTokenof the previous response. Omit it to get the first page. Tokens expire. If the token is malformed or expired, or doesn’t match the original request, the request fails withValidationExceptionand the reasonINVALID_PAGINATION_TOKEN. In that case, start again from the first page.max_results(i32)/set_max_results(Option<i32>):
required: falseThe maximum number of payment instruments to return in one page. The default is 25. A page can contain fewer payment instruments even when more remain. Use
nextTokento find out whether more payment instruments are available.
- On success, responds with
ListPaymentInstrumentsOutputwith field(s):payment_instrument_summaries(Vec::<PaymentInstrumentSummary>):The payment instruments on your account, one summary for each instrument. This list is empty when your account has no payment instruments.
next_token(Option<String>):The pagination token that indicates the next set of results to retrieve. This value is absent when there are no more results.
- On failure, responds with
SdkError<ListPaymentInstrumentsError>
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_implconfigured. - Identity caching is enabled without a
sleep_implandtime_sourceconfigured. - No
behavior_versionis 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_configis missing an async sleep implementation. If you experience this panic, set thesleep_implon the Config passed into this function to fix it. - This method will panic if the
sdk_configis missing an HTTP connector. If you experience this panic, set thehttp_connectoron the Config passed into this function to fix it. - This method will panic if no
BehaviorVersionis provided. If you experience this panic, setbehavior_versionon the Config or enable thebehavior-version-latestCargo feature.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Forget for Client
impl Freeze for Client
impl Move for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);