aws_sdk_apigateway/operation/get_usage/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_usage::_get_usage_output::GetUsageOutputBuilder;
3
4pub use crate::operation::get_usage::_get_usage_input::GetUsageInputBuilder;
5
6impl crate::operation::get_usage::builders::GetUsageInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::get_usage::GetUsageOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::get_usage::GetUsageError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.get_usage();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `GetUsage`.
24///
25/// <p>Gets the usage data of a usage plan in a specified time interval.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct GetUsageFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::get_usage::builders::GetUsageInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::get_usage::GetUsageOutput, crate::operation::get_usage::GetUsageError>
33    for GetUsageFluentBuilder
34{
35    fn send(
36        self,
37        config_override: crate::config::Builder,
38    ) -> crate::client::customize::internal::BoxFuture<
39        crate::client::customize::internal::SendResult<crate::operation::get_usage::GetUsageOutput, crate::operation::get_usage::GetUsageError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl GetUsageFluentBuilder {
45    /// Creates a new `GetUsageFluentBuilder`.
46    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47        Self {
48            handle,
49            inner: ::std::default::Default::default(),
50            config_override: ::std::option::Option::None,
51        }
52    }
53    /// Access the GetUsage as a reference.
54    pub fn as_input(&self) -> &crate::operation::get_usage::builders::GetUsageInputBuilder {
55        &self.inner
56    }
57    /// Sends the request and returns the response.
58    ///
59    /// If an error occurs, an `SdkError` will be returned with additional details that
60    /// can be matched against.
61    ///
62    /// By default, any retryable failures will be retried twice. Retry behavior
63    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
64    /// set when configuring the client.
65    pub async fn send(
66        self,
67    ) -> ::std::result::Result<
68        crate::operation::get_usage::GetUsageOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::get_usage::GetUsageError,
71            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72        >,
73    > {
74        let input = self
75            .inner
76            .build()
77            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78        let runtime_plugins = crate::operation::get_usage::GetUsage::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::get_usage::GetUsage::orchestrate(&runtime_plugins, input).await
84    }
85
86    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
87    pub fn customize(
88        self,
89    ) -> crate::client::customize::CustomizableOperation<crate::operation::get_usage::GetUsageOutput, crate::operation::get_usage::GetUsageError, Self>
90    {
91        crate::client::customize::CustomizableOperation::new(self)
92    }
93    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
94        self.set_config_override(::std::option::Option::Some(config_override.into()));
95        self
96    }
97
98    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
99        self.config_override = config_override;
100        self
101    }
102    /// Create a paginator for this request
103    ///
104    /// Paginators are used by calling [`send().await`](crate::operation::get_usage::paginator::GetUsagePaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
105    pub fn into_paginator(self) -> crate::operation::get_usage::paginator::GetUsagePaginator {
106        crate::operation::get_usage::paginator::GetUsagePaginator::new(self.handle, self.inner)
107    }
108    /// <p>The Id of the usage plan associated with the usage data.</p>
109    pub fn usage_plan_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.inner = self.inner.usage_plan_id(input.into());
111        self
112    }
113    /// <p>The Id of the usage plan associated with the usage data.</p>
114    pub fn set_usage_plan_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115        self.inner = self.inner.set_usage_plan_id(input);
116        self
117    }
118    /// <p>The Id of the usage plan associated with the usage data.</p>
119    pub fn get_usage_plan_id(&self) -> &::std::option::Option<::std::string::String> {
120        self.inner.get_usage_plan_id()
121    }
122    /// <p>The Id of the API key associated with the resultant usage data.</p>
123    pub fn key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.key_id(input.into());
125        self
126    }
127    /// <p>The Id of the API key associated with the resultant usage data.</p>
128    pub fn set_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.inner = self.inner.set_key_id(input);
130        self
131    }
132    /// <p>The Id of the API key associated with the resultant usage data.</p>
133    pub fn get_key_id(&self) -> &::std::option::Option<::std::string::String> {
134        self.inner.get_key_id()
135    }
136    /// <p>The starting date (e.g., 2016-01-01) of the usage data.</p>
137    pub fn start_date(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.start_date(input.into());
139        self
140    }
141    /// <p>The starting date (e.g., 2016-01-01) of the usage data.</p>
142    pub fn set_start_date(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_start_date(input);
144        self
145    }
146    /// <p>The starting date (e.g., 2016-01-01) of the usage data.</p>
147    pub fn get_start_date(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_start_date()
149    }
150    /// <p>The ending date (e.g., 2016-12-31) of the usage data.</p>
151    pub fn end_date(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        self.inner = self.inner.end_date(input.into());
153        self
154    }
155    /// <p>The ending date (e.g., 2016-12-31) of the usage data.</p>
156    pub fn set_end_date(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157        self.inner = self.inner.set_end_date(input);
158        self
159    }
160    /// <p>The ending date (e.g., 2016-12-31) of the usage data.</p>
161    pub fn get_end_date(&self) -> &::std::option::Option<::std::string::String> {
162        self.inner.get_end_date()
163    }
164    /// <p>The current pagination position in the paged result set.</p>
165    pub fn position(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.inner = self.inner.position(input.into());
167        self
168    }
169    /// <p>The current pagination position in the paged result set.</p>
170    pub fn set_position(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.inner = self.inner.set_position(input);
172        self
173    }
174    /// <p>The current pagination position in the paged result set.</p>
175    pub fn get_position(&self) -> &::std::option::Option<::std::string::String> {
176        self.inner.get_position()
177    }
178    /// <p>The maximum number of returned results per page. The default value is 25 and the maximum value is 500.</p>
179    pub fn limit(mut self, input: i32) -> Self {
180        self.inner = self.inner.limit(input);
181        self
182    }
183    /// <p>The maximum number of returned results per page. The default value is 25 and the maximum value is 500.</p>
184    pub fn set_limit(mut self, input: ::std::option::Option<i32>) -> Self {
185        self.inner = self.inner.set_limit(input);
186        self
187    }
188    /// <p>The maximum number of returned results per page. The default value is 25 and the maximum value is 500.</p>
189    pub fn get_limit(&self) -> &::std::option::Option<i32> {
190        self.inner.get_limit()
191    }
192}