// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_custom_charges::_put_custom_charges_input::PutCustomChargesInputBuilder;
pub use crate::operation::put_custom_charges::_put_custom_charges_output::PutCustomChargesOutputBuilder;
impl crate::operation::put_custom_charges::builders::PutCustomChargesInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::put_custom_charges::PutCustomChargesOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_custom_charges::PutCustomChargesError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.put_custom_charges();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `PutCustomCharges`.
///
/// Adds charges that you compute to the end user's next subscription invoice. The charges go to the billing period of the user's current subscription that contains the current time. You don't specify a period. Each charge has a `chargeId` that you choose. If you submit a `chargeId` again in the same billing period, the existing charge is replaced instead of added again. A `chargeId` belongs to the first billing period that accepts it, so use a value that is unique for this user across all billing periods, such as a UUID or your own invoice line ID. The request succeeds or fails as a whole: either every charge is accepted or none is. A successful response means that every charge was accepted. If you submit a `chargeId` after its billing period has ended, the request fails with a `ConflictException`. The charge is already recorded. Don't submit it again under a new `chargeId`, because that bills it twice. A billing period holds at most 100 `chargeId` values for each user. If a request would exceed 100, it fails with a `ServiceQuotaExceededException`. Submitting a `chargeId` that is already in the period doesn't count toward the limit.
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct PutCustomChargesFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::put_custom_charges::builders::PutCustomChargesInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::put_custom_charges::PutCustomChargesOutput,
crate::operation::put_custom_charges::PutCustomChargesError,
> for PutCustomChargesFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::put_custom_charges::PutCustomChargesOutput,
crate::operation::put_custom_charges::PutCustomChargesError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl PutCustomChargesFluentBuilder {
/// Creates a new `PutCustomChargesFluentBuilder`.
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
/// Access the PutCustomCharges as a reference.
pub fn as_input(&self) -> &crate::operation::put_custom_charges::builders::PutCustomChargesInputBuilder {
&self.inner
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::put_custom_charges::PutCustomChargesOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::put_custom_charges::PutCustomChargesError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins = crate::operation::put_custom_charges::PutCustomCharges::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::put_custom_charges::PutCustomCharges::orchestrate(&runtime_plugins, input).await
}
/// Consumes this builder, creating a customizable operation that can be modified before being sent.
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<
crate::operation::put_custom_charges::PutCustomChargesOutput,
crate::operation::put_custom_charges::PutCustomChargesError,
Self,
> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
/// The ID of the app.
pub fn app_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.app_id(input.into());
self
}
/// The ID of the app.
pub fn set_app_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_app_id(input);
self
}
/// The ID of the app.
pub fn get_app_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_app_id()
}
/// The end user these charges bill.
pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.user_id(input.into());
self
}
/// The end user these charges bill.
pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_user_id(input);
self
}
/// The end user these charges bill.
pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_user_id()
}
///
/// Appends an item to `charges`.
///
/// To override the contents of this collection use [`set_charges`](Self::set_charges).
///
/// The custom charges to add to this user's next invoice. Stored at the submitted grain; the service never splits a charge. Accepted all-or-nothing.
pub fn charges(mut self, input: crate::types::CustomCharge) -> Self {
self.inner = self.inner.charges(input);
self
}
/// The custom charges to add to this user's next invoice. Stored at the submitted grain; the service never splits a charge. Accepted all-or-nothing.
pub fn set_charges(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CustomCharge>>) -> Self {
self.inner = self.inner.set_charges(input);
self
}
/// The custom charges to add to this user's next invoice. Stored at the submitted grain; the service never splits a charge. Accepted all-or-nothing.
pub fn get_charges(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CustomCharge>> {
self.inner.get_charges()
}
/// Required. The environment: live or sandbox.
pub fn scope(mut self, input: crate::types::RequestScope) -> Self {
self.inner = self.inner.scope(input);
self
}
/// Required. The environment: live or sandbox.
pub fn set_scope(mut self, input: ::std::option::Option<crate::types::RequestScope>) -> Self {
self.inner = self.inner.set_scope(input);
self
}
/// Required. The environment: live or sandbox.
pub fn get_scope(&self) -> &::std::option::Option<crate::types::RequestScope> {
self.inner.get_scope()
}
}