aws_sdk_apigateway/operation/put_method/
_put_method_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents a client-facing interface by which the client calls the API to access back-end resources. A Method resource is integrated with an Integration resource. Both consist of a request and one or more responses. The method request takes the client input that is passed to the back end through the integration request. A method response returns the output from the back end to the client through an integration response. A method request is embodied in a Method resource, whereas an integration request is embodied in an Integration resource. On the other hand, a method response is represented by a MethodResponse resource, whereas an integration response is represented by an IntegrationResponse resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct PutMethodOutput {
7    /// <p>The method's HTTP verb.</p>
8    pub http_method: ::std::option::Option<::std::string::String>,
9    /// <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>
10    pub authorization_type: ::std::option::Option<::std::string::String>,
11    /// <p>The identifier of an Authorizer to use on this method. The <code>authorizationType</code> must be <code>CUSTOM</code>.</p>
12    pub authorizer_id: ::std::option::Option<::std::string::String>,
13    /// <p>A boolean flag specifying whether a valid ApiKey is required to invoke this method.</p>
14    pub api_key_required: ::std::option::Option<bool>,
15    /// <p>The identifier of a RequestValidator for request validation.</p>
16    pub request_validator_id: ::std::option::Option<::std::string::String>,
17    /// <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>
18    pub operation_name: ::std::option::Option<::std::string::String>,
19    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is 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 templates.</p>
20    pub request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>,
21    /// <p>A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).</p>
22    pub request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
23    /// <p>Gets a method response associated with a given HTTP status code.</p>
24    pub method_responses: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MethodResponse>>,
25    /// <p>Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.</p>
26    pub method_integration: ::std::option::Option<crate::types::Integration>,
27    /// <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>
28    pub authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
29    _request_id: Option<String>,
30}
31impl PutMethodOutput {
32    /// <p>The method's HTTP verb.</p>
33    pub fn http_method(&self) -> ::std::option::Option<&str> {
34        self.http_method.as_deref()
35    }
36    /// <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>
37    pub fn authorization_type(&self) -> ::std::option::Option<&str> {
38        self.authorization_type.as_deref()
39    }
40    /// <p>The identifier of an Authorizer to use on this method. The <code>authorizationType</code> must be <code>CUSTOM</code>.</p>
41    pub fn authorizer_id(&self) -> ::std::option::Option<&str> {
42        self.authorizer_id.as_deref()
43    }
44    /// <p>A boolean flag specifying whether a valid ApiKey is required to invoke this method.</p>
45    pub fn api_key_required(&self) -> ::std::option::Option<bool> {
46        self.api_key_required
47    }
48    /// <p>The identifier of a RequestValidator for request validation.</p>
49    pub fn request_validator_id(&self) -> ::std::option::Option<&str> {
50        self.request_validator_id.as_deref()
51    }
52    /// <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>
53    pub fn operation_name(&self) -> ::std::option::Option<&str> {
54        self.operation_name.as_deref()
55    }
56    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is 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 templates.</p>
57    pub fn request_parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, bool>> {
58        self.request_parameters.as_ref()
59    }
60    /// <p>A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).</p>
61    pub fn request_models(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
62        self.request_models.as_ref()
63    }
64    /// <p>Gets a method response associated with a given HTTP status code.</p>
65    pub fn method_responses(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::MethodResponse>> {
66        self.method_responses.as_ref()
67    }
68    /// <p>Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.</p>
69    pub fn method_integration(&self) -> ::std::option::Option<&crate::types::Integration> {
70        self.method_integration.as_ref()
71    }
72    /// <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>
73    ///
74    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.authorization_scopes.is_none()`.
75    pub fn authorization_scopes(&self) -> &[::std::string::String] {
76        self.authorization_scopes.as_deref().unwrap_or_default()
77    }
78}
79impl ::aws_types::request_id::RequestId for PutMethodOutput {
80    fn request_id(&self) -> Option<&str> {
81        self._request_id.as_deref()
82    }
83}
84impl PutMethodOutput {
85    /// Creates a new builder-style object to manufacture [`PutMethodOutput`](crate::operation::put_method::PutMethodOutput).
86    pub fn builder() -> crate::operation::put_method::builders::PutMethodOutputBuilder {
87        crate::operation::put_method::builders::PutMethodOutputBuilder::default()
88    }
89}
90
91/// A builder for [`PutMethodOutput`](crate::operation::put_method::PutMethodOutput).
92#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
93#[non_exhaustive]
94pub struct PutMethodOutputBuilder {
95    pub(crate) http_method: ::std::option::Option<::std::string::String>,
96    pub(crate) authorization_type: ::std::option::Option<::std::string::String>,
97    pub(crate) authorizer_id: ::std::option::Option<::std::string::String>,
98    pub(crate) api_key_required: ::std::option::Option<bool>,
99    pub(crate) request_validator_id: ::std::option::Option<::std::string::String>,
100    pub(crate) operation_name: ::std::option::Option<::std::string::String>,
101    pub(crate) request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>,
102    pub(crate) request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
103    pub(crate) method_responses: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MethodResponse>>,
104    pub(crate) method_integration: ::std::option::Option<crate::types::Integration>,
105    pub(crate) authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
106    _request_id: Option<String>,
107}
108impl PutMethodOutputBuilder {
109    /// <p>The method's HTTP verb.</p>
110    pub fn http_method(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.http_method = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>The method's HTTP verb.</p>
115    pub fn set_http_method(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.http_method = input;
117        self
118    }
119    /// <p>The method's HTTP verb.</p>
120    pub fn get_http_method(&self) -> &::std::option::Option<::std::string::String> {
121        &self.http_method
122    }
123    /// <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>
124    pub fn authorization_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.authorization_type = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <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>
129    pub fn set_authorization_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.authorization_type = input;
131        self
132    }
133    /// <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>
134    pub fn get_authorization_type(&self) -> &::std::option::Option<::std::string::String> {
135        &self.authorization_type
136    }
137    /// <p>The identifier of an Authorizer to use on this method. The <code>authorizationType</code> must be <code>CUSTOM</code>.</p>
138    pub fn authorizer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
139        self.authorizer_id = ::std::option::Option::Some(input.into());
140        self
141    }
142    /// <p>The identifier of an Authorizer to use on this method. The <code>authorizationType</code> must be <code>CUSTOM</code>.</p>
143    pub fn set_authorizer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144        self.authorizer_id = input;
145        self
146    }
147    /// <p>The identifier of an Authorizer to use on this method. The <code>authorizationType</code> must be <code>CUSTOM</code>.</p>
148    pub fn get_authorizer_id(&self) -> &::std::option::Option<::std::string::String> {
149        &self.authorizer_id
150    }
151    /// <p>A boolean flag specifying whether a valid ApiKey is required to invoke this method.</p>
152    pub fn api_key_required(mut self, input: bool) -> Self {
153        self.api_key_required = ::std::option::Option::Some(input);
154        self
155    }
156    /// <p>A boolean flag specifying whether a valid ApiKey is required to invoke this method.</p>
157    pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
158        self.api_key_required = input;
159        self
160    }
161    /// <p>A boolean flag specifying whether a valid ApiKey is required to invoke this method.</p>
162    pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
163        &self.api_key_required
164    }
165    /// <p>The identifier of a RequestValidator for request validation.</p>
166    pub fn request_validator_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.request_validator_id = ::std::option::Option::Some(input.into());
168        self
169    }
170    /// <p>The identifier of a RequestValidator for request validation.</p>
171    pub fn set_request_validator_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
172        self.request_validator_id = input;
173        self
174    }
175    /// <p>The identifier of a RequestValidator for request validation.</p>
176    pub fn get_request_validator_id(&self) -> &::std::option::Option<::std::string::String> {
177        &self.request_validator_id
178    }
179    /// <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>
180    pub fn operation_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181        self.operation_name = ::std::option::Option::Some(input.into());
182        self
183    }
184    /// <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>
185    pub fn set_operation_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186        self.operation_name = input;
187        self
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 get_operation_name(&self) -> &::std::option::Option<::std::string::String> {
191        &self.operation_name
192    }
193    /// Adds a key-value pair to `request_parameters`.
194    ///
195    /// To override the contents of this collection use [`set_request_parameters`](Self::set_request_parameters).
196    ///
197    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is 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 templates.</p>
198    pub fn request_parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: bool) -> Self {
199        let mut hash_map = self.request_parameters.unwrap_or_default();
200        hash_map.insert(k.into(), v);
201        self.request_parameters = ::std::option::Option::Some(hash_map);
202        self
203    }
204    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is 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 templates.</p>
205    pub fn set_request_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>) -> Self {
206        self.request_parameters = input;
207        self
208    }
209    /// <p>A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is 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 templates.</p>
210    pub fn get_request_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, bool>> {
211        &self.request_parameters
212    }
213    /// Adds a key-value pair to `request_models`.
214    ///
215    /// To override the contents of this collection use [`set_request_models`](Self::set_request_models).
216    ///
217    /// <p>A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).</p>
218    pub fn request_models(
219        mut self,
220        k: impl ::std::convert::Into<::std::string::String>,
221        v: impl ::std::convert::Into<::std::string::String>,
222    ) -> Self {
223        let mut hash_map = self.request_models.unwrap_or_default();
224        hash_map.insert(k.into(), v.into());
225        self.request_models = ::std::option::Option::Some(hash_map);
226        self
227    }
228    /// <p>A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).</p>
229    pub fn set_request_models(
230        mut self,
231        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
232    ) -> Self {
233        self.request_models = input;
234        self
235    }
236    /// <p>A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).</p>
237    pub fn get_request_models(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
238        &self.request_models
239    }
240    /// Adds a key-value pair to `method_responses`.
241    ///
242    /// To override the contents of this collection use [`set_method_responses`](Self::set_method_responses).
243    ///
244    /// <p>Gets a method response associated with a given HTTP status code.</p>
245    pub fn method_responses(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::MethodResponse) -> Self {
246        let mut hash_map = self.method_responses.unwrap_or_default();
247        hash_map.insert(k.into(), v);
248        self.method_responses = ::std::option::Option::Some(hash_map);
249        self
250    }
251    /// <p>Gets a method response associated with a given HTTP status code.</p>
252    pub fn set_method_responses(
253        mut self,
254        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MethodResponse>>,
255    ) -> Self {
256        self.method_responses = input;
257        self
258    }
259    /// <p>Gets a method response associated with a given HTTP status code.</p>
260    pub fn get_method_responses(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::MethodResponse>> {
261        &self.method_responses
262    }
263    /// <p>Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.</p>
264    pub fn method_integration(mut self, input: crate::types::Integration) -> Self {
265        self.method_integration = ::std::option::Option::Some(input);
266        self
267    }
268    /// <p>Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.</p>
269    pub fn set_method_integration(mut self, input: ::std::option::Option<crate::types::Integration>) -> Self {
270        self.method_integration = input;
271        self
272    }
273    /// <p>Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.</p>
274    pub fn get_method_integration(&self) -> &::std::option::Option<crate::types::Integration> {
275        &self.method_integration
276    }
277    /// Appends an item to `authorization_scopes`.
278    ///
279    /// To override the contents of this collection use [`set_authorization_scopes`](Self::set_authorization_scopes).
280    ///
281    /// <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>
282    pub fn authorization_scopes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
283        let mut v = self.authorization_scopes.unwrap_or_default();
284        v.push(input.into());
285        self.authorization_scopes = ::std::option::Option::Some(v);
286        self
287    }
288    /// <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>
289    pub fn set_authorization_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
290        self.authorization_scopes = input;
291        self
292    }
293    /// <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>
294    pub fn get_authorization_scopes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
295        &self.authorization_scopes
296    }
297    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
298        self._request_id = Some(request_id.into());
299        self
300    }
301
302    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
303        self._request_id = request_id;
304        self
305    }
306    /// Consumes the builder and constructs a [`PutMethodOutput`](crate::operation::put_method::PutMethodOutput).
307    pub fn build(self) -> crate::operation::put_method::PutMethodOutput {
308        crate::operation::put_method::PutMethodOutput {
309            http_method: self.http_method,
310            authorization_type: self.authorization_type,
311            authorizer_id: self.authorizer_id,
312            api_key_required: self.api_key_required,
313            request_validator_id: self.request_validator_id,
314            operation_name: self.operation_name,
315            request_parameters: self.request_parameters,
316            request_models: self.request_models,
317            method_responses: self.method_responses,
318            method_integration: self.method_integration,
319            authorization_scopes: self.authorization_scopes,
320            _request_id: self._request_id,
321        }
322    }
323}