aws_sdk_apigateway/operation/put_method/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_method::_put_method_output::PutMethodOutputBuilder;
3
4pub use crate::operation::put_method::_put_method_input::PutMethodInputBuilder;
5
6impl crate::operation::put_method::builders::PutMethodInputBuilder {
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::put_method::PutMethodOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_method::PutMethodError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_method();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutMethod`.
24///
25/// <p>Add a method to an existing Resource resource.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct PutMethodFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::put_method::builders::PutMethodInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::put_method::PutMethodOutput, crate::operation::put_method::PutMethodError>
33    for PutMethodFluentBuilder
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::put_method::PutMethodOutput, crate::operation::put_method::PutMethodError>,
40    > {
41        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42    }
43}
44impl PutMethodFluentBuilder {
45    /// Creates a new `PutMethodFluentBuilder`.
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 PutMethod as a reference.
54    pub fn as_input(&self) -> &crate::operation::put_method::builders::PutMethodInputBuilder {
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::put_method::PutMethodOutput,
69        ::aws_smithy_runtime_api::client::result::SdkError<
70            crate::operation::put_method::PutMethodError,
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::put_method::PutMethod::operation_runtime_plugins(
79            self.handle.runtime_plugins.clone(),
80            &self.handle.conf,
81            self.config_override,
82        );
83        crate::operation::put_method::PutMethod::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::put_method::PutMethodOutput,
91        crate::operation::put_method::PutMethodError,
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>The string identifier of the associated RestApi.</p>
106    pub fn rest_api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.inner = self.inner.rest_api_id(input.into());
108        self
109    }
110    /// <p>The string identifier of the associated RestApi.</p>
111    pub fn set_rest_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.inner = self.inner.set_rest_api_id(input);
113        self
114    }
115    /// <p>The string identifier of the associated RestApi.</p>
116    pub fn get_rest_api_id(&self) -> &::std::option::Option<::std::string::String> {
117        self.inner.get_rest_api_id()
118    }
119    /// <p>The Resource identifier for the new Method resource.</p>
120    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.inner = self.inner.resource_id(input.into());
122        self
123    }
124    /// <p>The Resource identifier for the new Method resource.</p>
125    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.inner = self.inner.set_resource_id(input);
127        self
128    }
129    /// <p>The Resource identifier for the new Method resource.</p>
130    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
131        self.inner.get_resource_id()
132    }
133    /// <p>Specifies the method request's HTTP method type.</p>
134    pub fn http_method(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.inner = self.inner.http_method(input.into());
136        self
137    }
138    /// <p>Specifies the method request's HTTP method type.</p>
139    pub fn set_http_method(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_http_method(input);
141        self
142    }
143    /// <p>Specifies the method request's HTTP method type.</p>
144    pub fn get_http_method(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_http_method()
146    }
147    /// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
148    pub fn authorization_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.inner = self.inner.authorization_type(input.into());
150        self
151    }
152    /// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
153    pub fn set_authorization_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.inner = self.inner.set_authorization_type(input);
155        self
156    }
157    /// <p>The method's authorization type. Valid values are <code>NONE</code> for open access, <code>AWS_IAM</code> for using AWS IAM permissions, <code>CUSTOM</code> for using a custom authorizer, or <code>COGNITO_USER_POOLS</code> for using a Cognito user pool.</p>
158    pub fn get_authorization_type(&self) -> &::std::option::Option<::std::string::String> {
159        self.inner.get_authorization_type()
160    }
161    /// <p>Specifies the identifier of an Authorizer to use on this Method, if the type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
162    pub fn authorizer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163        self.inner = self.inner.authorizer_id(input.into());
164        self
165    }
166    /// <p>Specifies the identifier of an Authorizer to use on this Method, if the type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
167    pub fn set_authorizer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168        self.inner = self.inner.set_authorizer_id(input);
169        self
170    }
171    /// <p>Specifies the identifier of an Authorizer to use on this Method, if the type is CUSTOM or COGNITO_USER_POOLS. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
172    pub fn get_authorizer_id(&self) -> &::std::option::Option<::std::string::String> {
173        self.inner.get_authorizer_id()
174    }
175    /// <p>Specifies whether the method required a valid ApiKey.</p>
176    pub fn api_key_required(mut self, input: bool) -> Self {
177        self.inner = self.inner.api_key_required(input);
178        self
179    }
180    /// <p>Specifies whether the method required a valid ApiKey.</p>
181    pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
182        self.inner = self.inner.set_api_key_required(input);
183        self
184    }
185    /// <p>Specifies whether the method required a valid ApiKey.</p>
186    pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
187        self.inner.get_api_key_required()
188    }
189    /// <p>A human-friendly operation identifier for the method. For example, you can assign the <code>operationName</code> of <code>ListPets</code> for the <code>GET /pets</code> method in the <code>PetStore</code> example.</p>
190    pub fn operation_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.operation_name(input.into());
192        self
193    }
194    /// <p>A human-friendly operation identifier for the method. For example, you can assign the <code>operationName</code> of <code>ListPets</code> for the <code>GET /pets</code> method in the <code>PetStore</code> example.</p>
195    pub fn set_operation_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196        self.inner = self.inner.set_operation_name(input);
197        self
198    }
199    /// <p>A human-friendly operation identifier for the method. For example, you can assign the <code>operationName</code> of <code>ListPets</code> for the <code>GET /pets</code> method in the <code>PetStore</code> example.</p>
200    pub fn get_operation_name(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_operation_name()
202    }
203    ///
204    /// Adds a key-value pair to `requestParameters`.
205    ///
206    /// To override the contents of this collection use [`set_request_parameters`](Self::set_request_parameters).
207    ///
208    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key defines a method request parameter name matching the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (<code>true</code>) or optional (<code>false</code>). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or body-mapping templates.</p>
209    pub fn request_parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: bool) -> Self {
210        self.inner = self.inner.request_parameters(k.into(), v);
211        self
212    }
213    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key defines a method request parameter name matching the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (<code>true</code>) or optional (<code>false</code>). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or body-mapping templates.</p>
214    pub fn set_request_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>) -> Self {
215        self.inner = self.inner.set_request_parameters(input);
216        self
217    }
218    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key defines a method request parameter name matching the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (<code>true</code>) or optional (<code>false</code>). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or body-mapping templates.</p>
219    pub fn get_request_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, bool>> {
220        self.inner.get_request_parameters()
221    }
222    ///
223    /// Adds a key-value pair to `requestModels`.
224    ///
225    /// To override the contents of this collection use [`set_request_models`](Self::set_request_models).
226    ///
227    /// <p>Specifies the Model resources used for the request's content type. Request models are represented as a key/value map, with a content type as the key and a Model name as the value.</p>
228    pub fn request_models(
229        mut self,
230        k: impl ::std::convert::Into<::std::string::String>,
231        v: impl ::std::convert::Into<::std::string::String>,
232    ) -> Self {
233        self.inner = self.inner.request_models(k.into(), v.into());
234        self
235    }
236    /// <p>Specifies the Model resources used for the request's content type. Request models are represented as a key/value map, with a content type as the key and a Model name as the value.</p>
237    pub fn set_request_models(
238        mut self,
239        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
240    ) -> Self {
241        self.inner = self.inner.set_request_models(input);
242        self
243    }
244    /// <p>Specifies the Model resources used for the request's content type. Request models are represented as a key/value map, with a content type as the key and a Model name as the value.</p>
245    pub fn get_request_models(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
246        self.inner.get_request_models()
247    }
248    /// <p>The identifier of a RequestValidator for validating the method request.</p>
249    pub fn request_validator_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
250        self.inner = self.inner.request_validator_id(input.into());
251        self
252    }
253    /// <p>The identifier of a RequestValidator for validating the method request.</p>
254    pub fn set_request_validator_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
255        self.inner = self.inner.set_request_validator_id(input);
256        self
257    }
258    /// <p>The identifier of a RequestValidator for validating the method request.</p>
259    pub fn get_request_validator_id(&self) -> &::std::option::Option<::std::string::String> {
260        self.inner.get_request_validator_id()
261    }
262    ///
263    /// Appends an item to `authorizationScopes`.
264    ///
265    /// To override the contents of this collection use [`set_authorization_scopes`](Self::set_authorization_scopes).
266    ///
267    /// <p>A list of authorization scopes configured on the method. The scopes are used with a <code>COGNITO_USER_POOLS</code> authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
268    pub fn authorization_scopes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
269        self.inner = self.inner.authorization_scopes(input.into());
270        self
271    }
272    /// <p>A list of authorization scopes configured on the method. The scopes are used with a <code>COGNITO_USER_POOLS</code> authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
273    pub fn set_authorization_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
274        self.inner = self.inner.set_authorization_scopes(input);
275        self
276    }
277    /// <p>A list of authorization scopes configured on the method. The scopes are used with a <code>COGNITO_USER_POOLS</code> authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
278    pub fn get_authorization_scopes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
279        self.inner.get_authorization_scopes()
280    }
281}