aws_sdk_apigatewayv2/operation/create_api/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_api::_create_api_output::CreateApiOutputBuilder;
3
4pub use crate::operation::create_api::_create_api_input::CreateApiInputBuilder;
5
6impl crate::operation::create_api::builders::CreateApiInputBuilder {
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::create_api::CreateApiOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_api::CreateApiError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_api();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateApi`.
24///
25/// <p>Creates an Api resource.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateApiFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_api::builders::CreateApiInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::create_api::CreateApiOutput, crate::operation::create_api::CreateApiError>
33    for CreateApiFluentBuilder
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::create_api::CreateApiOutput, crate::operation::create_api::CreateApiError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl CreateApiFluentBuilder {
45    /// Creates a new `CreateApiFluentBuilder`.
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 CreateApi as a reference.
54    pub fn as_input(&self) -> &crate::operation::create_api::builders::CreateApiInputBuilder {
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::create_api::CreateApiOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::create_api::CreateApiError,
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::create_api::CreateApi::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::create_api::CreateApi::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<
90        crate::operation::create_api::CreateApiOutput,
91        crate::operation::create_api::CreateApiError,
92        Self,
93    > {
94        crate::client::customize::CustomizableOperation::new(self)
95    }
96    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
97        self.set_config_override(::std::option::Option::Some(config_override.into()));
98        self
99    }
100
101    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
102        self.config_override = config_override;
103        self
104    }
105    /// <p>An API key selection expression. Supported only for WebSocket APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions">API Key Selection Expressions</a>.</p>
106    pub fn api_key_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.inner = self.inner.api_key_selection_expression(input.into());
108        self
109    }
110    /// <p>An API key selection expression. Supported only for WebSocket APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions">API Key Selection Expressions</a>.</p>
111    pub fn set_api_key_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.inner = self.inner.set_api_key_selection_expression(input);
113        self
114    }
115    /// <p>An API key selection expression. Supported only for WebSocket APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-selection-expressions.html#apigateway-websocket-api-apikey-selection-expressions">API Key Selection Expressions</a>.</p>
116    pub fn get_api_key_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
117        self.inner.get_api_key_selection_expression()
118    }
119    /// <p>A CORS configuration. Supported only for HTTP APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html">Configuring CORS</a> for more information.</p>
120    pub fn cors_configuration(mut self, input: crate::types::Cors) -> Self {
121        self.inner = self.inner.cors_configuration(input);
122        self
123    }
124    /// <p>A CORS configuration. Supported only for HTTP APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html">Configuring CORS</a> for more information.</p>
125    pub fn set_cors_configuration(mut self, input: ::std::option::Option<crate::types::Cors>) -> Self {
126        self.inner = self.inner.set_cors_configuration(input);
127        self
128    }
129    /// <p>A CORS configuration. Supported only for HTTP APIs. See <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-cors.html">Configuring CORS</a> for more information.</p>
130    pub fn get_cors_configuration(&self) -> &::std::option::Option<crate::types::Cors> {
131        self.inner.get_cors_configuration()
132    }
133    /// <p>This property is part of quick create. It specifies the credentials required for the integration, if any. For a Lambda integration, three options are available. To specify an IAM Role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To require that the caller's identity be passed through from the request, specify arn:aws:iam::*:user/*. To use resource-based permissions on supported AWS services, specify null. Currently, this property is not used for HTTP integrations. Supported only for HTTP APIs.</p>
134    pub fn credentials_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.credentials_arn(input.into());
136        self
137    }
138    /// <p>This property is part of quick create. It specifies the credentials required for the integration, if any. For a Lambda integration, three options are available. To specify an IAM Role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To require that the caller's identity be passed through from the request, specify arn:aws:iam::*:user/*. To use resource-based permissions on supported AWS services, specify null. Currently, this property is not used for HTTP integrations. Supported only for HTTP APIs.</p>
139    pub fn set_credentials_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_credentials_arn(input);
141        self
142    }
143    /// <p>This property is part of quick create. It specifies the credentials required for the integration, if any. For a Lambda integration, three options are available. To specify an IAM Role for API Gateway to assume, use the role's Amazon Resource Name (ARN). To require that the caller's identity be passed through from the request, specify arn:aws:iam::*:user/*. To use resource-based permissions on supported AWS services, specify null. Currently, this property is not used for HTTP integrations. Supported only for HTTP APIs.</p>
144    pub fn get_credentials_arn(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_credentials_arn()
146    }
147    /// <p>The description of the API.</p>
148    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.description(input.into());
150        self
151    }
152    /// <p>The description of the API.</p>
153    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_description(input);
155        self
156    }
157    /// <p>The description of the API.</p>
158    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_description()
160    }
161    /// <p>Avoid validating models when creating a deployment. Supported only for WebSocket APIs.</p>
162    pub fn disable_schema_validation(mut self, input: bool) -> Self {
163        self.inner = self.inner.disable_schema_validation(input);
164        self
165    }
166    /// <p>Avoid validating models when creating a deployment. Supported only for WebSocket APIs.</p>
167    pub fn set_disable_schema_validation(mut self, input: ::std::option::Option<bool>) -> Self {
168        self.inner = self.inner.set_disable_schema_validation(input);
169        self
170    }
171    /// <p>Avoid validating models when creating a deployment. Supported only for WebSocket APIs.</p>
172    pub fn get_disable_schema_validation(&self) -> &::std::option::Option<bool> {
173        self.inner.get_disable_schema_validation()
174    }
175    /// <p>Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.</p>
176    pub fn disable_execute_api_endpoint(mut self, input: bool) -> Self {
177        self.inner = self.inner.disable_execute_api_endpoint(input);
178        self
179    }
180    /// <p>Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.</p>
181    pub fn set_disable_execute_api_endpoint(mut self, input: ::std::option::Option<bool>) -> Self {
182        self.inner = self.inner.set_disable_execute_api_endpoint(input);
183        self
184    }
185    /// <p>Specifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.</p>
186    pub fn get_disable_execute_api_endpoint(&self) -> &::std::option::Option<bool> {
187        self.inner.get_disable_execute_api_endpoint()
188    }
189    /// <p>The IP address types that can invoke the API.</p>
190    pub fn ip_address_type(mut self, input: crate::types::IpAddressType) -> Self {
191        self.inner = self.inner.ip_address_type(input);
192        self
193    }
194    /// <p>The IP address types that can invoke the API.</p>
195    pub fn set_ip_address_type(mut self, input: ::std::option::Option<crate::types::IpAddressType>) -> Self {
196        self.inner = self.inner.set_ip_address_type(input);
197        self
198    }
199    /// <p>The IP address types that can invoke the API.</p>
200    pub fn get_ip_address_type(&self) -> &::std::option::Option<crate::types::IpAddressType> {
201        self.inner.get_ip_address_type()
202    }
203    /// <p>The name of the API.</p>
204    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.name(input.into());
206        self
207    }
208    /// <p>The name of the API.</p>
209    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210        self.inner = self.inner.set_name(input);
211        self
212    }
213    /// <p>The name of the API.</p>
214    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
215        self.inner.get_name()
216    }
217    /// <p>The API protocol.</p>
218    pub fn protocol_type(mut self, input: crate::types::ProtocolType) -> Self {
219        self.inner = self.inner.protocol_type(input);
220        self
221    }
222    /// <p>The API protocol.</p>
223    pub fn set_protocol_type(mut self, input: ::std::option::Option<crate::types::ProtocolType>) -> Self {
224        self.inner = self.inner.set_protocol_type(input);
225        self
226    }
227    /// <p>The API protocol.</p>
228    pub fn get_protocol_type(&self) -> &::std::option::Option<crate::types::ProtocolType> {
229        self.inner.get_protocol_type()
230    }
231    /// <p>This property is part of quick create. If you don't specify a routeKey, a default route of $default is created. The $default route acts as a catch-all for any request made to your API, for a particular stage. The $default route key can't be modified. You can add routes after creating the API, and you can update the route keys of additional routes. Supported only for HTTP APIs.</p>
232    pub fn route_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
233        self.inner = self.inner.route_key(input.into());
234        self
235    }
236    /// <p>This property is part of quick create. If you don't specify a routeKey, a default route of $default is created. The $default route acts as a catch-all for any request made to your API, for a particular stage. The $default route key can't be modified. You can add routes after creating the API, and you can update the route keys of additional routes. Supported only for HTTP APIs.</p>
237    pub fn set_route_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
238        self.inner = self.inner.set_route_key(input);
239        self
240    }
241    /// <p>This property is part of quick create. If you don't specify a routeKey, a default route of $default is created. The $default route acts as a catch-all for any request made to your API, for a particular stage. The $default route key can't be modified. You can add routes after creating the API, and you can update the route keys of additional routes. Supported only for HTTP APIs.</p>
242    pub fn get_route_key(&self) -> &::std::option::Option<::std::string::String> {
243        self.inner.get_route_key()
244    }
245    /// <p>The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.</p>
246    pub fn route_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
247        self.inner = self.inner.route_selection_expression(input.into());
248        self
249    }
250    /// <p>The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.</p>
251    pub fn set_route_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.inner = self.inner.set_route_selection_expression(input);
253        self
254    }
255    /// <p>The route selection expression for the API. For HTTP APIs, the routeSelectionExpression must be ${request.method} ${request.path}. If not provided, this will be the default for HTTP APIs. This property is required for WebSocket APIs.</p>
256    pub fn get_route_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
257        self.inner.get_route_selection_expression()
258    }
259    ///
260    /// Adds a key-value pair to `Tags`.
261    ///
262    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
263    ///
264    /// <p>The collection of tags. Each tag element is associated with a given resource.</p>
265    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
266        self.inner = self.inner.tags(k.into(), v.into());
267        self
268    }
269    /// <p>The collection of tags. Each tag element is associated with a given resource.</p>
270    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
271        self.inner = self.inner.set_tags(input);
272        self
273    }
274    /// <p>The collection of tags. Each tag element is associated with a given resource.</p>
275    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
276        self.inner.get_tags()
277    }
278    /// <p>This property is part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes. For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN. The type of the integration will be HTTP_PROXY or AWS_PROXY, respectively. Supported only for HTTP APIs.</p>
279    pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
280        self.inner = self.inner.target(input.into());
281        self
282    }
283    /// <p>This property is part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes. For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN. The type of the integration will be HTTP_PROXY or AWS_PROXY, respectively. Supported only for HTTP APIs.</p>
284    pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
285        self.inner = self.inner.set_target(input);
286        self
287    }
288    /// <p>This property is part of quick create. Quick create produces an API with an integration, a default catch-all route, and a default stage which is configured to automatically deploy changes. For HTTP integrations, specify a fully qualified URL. For Lambda integrations, specify a function ARN. The type of the integration will be HTTP_PROXY or AWS_PROXY, respectively. Supported only for HTTP APIs.</p>
289    pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
290        self.inner.get_target()
291    }
292    /// <p>A version identifier for the API.</p>
293    pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
294        self.inner = self.inner.version(input.into());
295        self
296    }
297    /// <p>A version identifier for the API.</p>
298    pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
299        self.inner = self.inner.set_version(input);
300        self
301    }
302    /// <p>A version identifier for the API.</p>
303    pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
304        self.inner.get_version()
305    }
306}