aws_sdk_apigatewayv2/operation/create_route/
_create_route_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateRouteOutput {
6    /// <p>Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.</p>
7    pub api_gateway_managed: ::std::option::Option<bool>,
8    /// <p>Specifies whether an API key is required for this route. Supported only for WebSocket APIs.</p>
9    pub api_key_required: ::std::option::Option<bool>,
10    /// <p>A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
11    pub authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <p>The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.</p>
13    pub authorization_type: ::std::option::Option<crate::types::AuthorizationType>,
14    /// <p>The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
15    pub authorizer_id: ::std::option::Option<::std::string::String>,
16    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
17    pub model_selection_expression: ::std::option::Option<::std::string::String>,
18    /// <p>The operation name for the route.</p>
19    pub operation_name: ::std::option::Option<::std::string::String>,
20    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
21    pub request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
22    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
23    pub request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
24    /// <p>The route ID.</p>
25    pub route_id: ::std::option::Option<::std::string::String>,
26    /// <p>The route key for the route.</p>
27    pub route_key: ::std::option::Option<::std::string::String>,
28    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
29    pub route_response_selection_expression: ::std::option::Option<::std::string::String>,
30    /// <p>The target for the route.</p>
31    pub target: ::std::option::Option<::std::string::String>,
32    _request_id: Option<String>,
33}
34impl CreateRouteOutput {
35    /// <p>Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.</p>
36    pub fn api_gateway_managed(&self) -> ::std::option::Option<bool> {
37        self.api_gateway_managed
38    }
39    /// <p>Specifies whether an API key is required for this route. Supported only for WebSocket APIs.</p>
40    pub fn api_key_required(&self) -> ::std::option::Option<bool> {
41        self.api_key_required
42    }
43    /// <p>A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
44    ///
45    /// 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()`.
46    pub fn authorization_scopes(&self) -> &[::std::string::String] {
47        self.authorization_scopes.as_deref().unwrap_or_default()
48    }
49    /// <p>The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.</p>
50    pub fn authorization_type(&self) -> ::std::option::Option<&crate::types::AuthorizationType> {
51        self.authorization_type.as_ref()
52    }
53    /// <p>The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
54    pub fn authorizer_id(&self) -> ::std::option::Option<&str> {
55        self.authorizer_id.as_deref()
56    }
57    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
58    pub fn model_selection_expression(&self) -> ::std::option::Option<&str> {
59        self.model_selection_expression.as_deref()
60    }
61    /// <p>The operation name for the route.</p>
62    pub fn operation_name(&self) -> ::std::option::Option<&str> {
63        self.operation_name.as_deref()
64    }
65    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
66    pub fn request_models(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
67        self.request_models.as_ref()
68    }
69    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
70    pub fn request_parameters(
71        &self,
72    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>> {
73        self.request_parameters.as_ref()
74    }
75    /// <p>The route ID.</p>
76    pub fn route_id(&self) -> ::std::option::Option<&str> {
77        self.route_id.as_deref()
78    }
79    /// <p>The route key for the route.</p>
80    pub fn route_key(&self) -> ::std::option::Option<&str> {
81        self.route_key.as_deref()
82    }
83    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
84    pub fn route_response_selection_expression(&self) -> ::std::option::Option<&str> {
85        self.route_response_selection_expression.as_deref()
86    }
87    /// <p>The target for the route.</p>
88    pub fn target(&self) -> ::std::option::Option<&str> {
89        self.target.as_deref()
90    }
91}
92impl ::aws_types::request_id::RequestId for CreateRouteOutput {
93    fn request_id(&self) -> Option<&str> {
94        self._request_id.as_deref()
95    }
96}
97impl CreateRouteOutput {
98    /// Creates a new builder-style object to manufacture [`CreateRouteOutput`](crate::operation::create_route::CreateRouteOutput).
99    pub fn builder() -> crate::operation::create_route::builders::CreateRouteOutputBuilder {
100        crate::operation::create_route::builders::CreateRouteOutputBuilder::default()
101    }
102}
103
104/// A builder for [`CreateRouteOutput`](crate::operation::create_route::CreateRouteOutput).
105#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
106#[non_exhaustive]
107pub struct CreateRouteOutputBuilder {
108    pub(crate) api_gateway_managed: ::std::option::Option<bool>,
109    pub(crate) api_key_required: ::std::option::Option<bool>,
110    pub(crate) authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
111    pub(crate) authorization_type: ::std::option::Option<crate::types::AuthorizationType>,
112    pub(crate) authorizer_id: ::std::option::Option<::std::string::String>,
113    pub(crate) model_selection_expression: ::std::option::Option<::std::string::String>,
114    pub(crate) operation_name: ::std::option::Option<::std::string::String>,
115    pub(crate) request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
116    pub(crate) request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
117    pub(crate) route_id: ::std::option::Option<::std::string::String>,
118    pub(crate) route_key: ::std::option::Option<::std::string::String>,
119    pub(crate) route_response_selection_expression: ::std::option::Option<::std::string::String>,
120    pub(crate) target: ::std::option::Option<::std::string::String>,
121    _request_id: Option<String>,
122}
123impl CreateRouteOutputBuilder {
124    /// <p>Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.</p>
125    pub fn api_gateway_managed(mut self, input: bool) -> Self {
126        self.api_gateway_managed = ::std::option::Option::Some(input);
127        self
128    }
129    /// <p>Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.</p>
130    pub fn set_api_gateway_managed(mut self, input: ::std::option::Option<bool>) -> Self {
131        self.api_gateway_managed = input;
132        self
133    }
134    /// <p>Specifies whether a route is managed by API Gateway. If you created an API using quick create, the $default route is managed by API Gateway. You can't modify the $default route key.</p>
135    pub fn get_api_gateway_managed(&self) -> &::std::option::Option<bool> {
136        &self.api_gateway_managed
137    }
138    /// <p>Specifies whether an API key is required for this route. Supported only for WebSocket APIs.</p>
139    pub fn api_key_required(mut self, input: bool) -> Self {
140        self.api_key_required = ::std::option::Option::Some(input);
141        self
142    }
143    /// <p>Specifies whether an API key is required for this route. Supported only for WebSocket APIs.</p>
144    pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
145        self.api_key_required = input;
146        self
147    }
148    /// <p>Specifies whether an API key is required for this route. Supported only for WebSocket APIs.</p>
149    pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
150        &self.api_key_required
151    }
152    /// Appends an item to `authorization_scopes`.
153    ///
154    /// To override the contents of this collection use [`set_authorization_scopes`](Self::set_authorization_scopes).
155    ///
156    /// <p>A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
157    pub fn authorization_scopes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        let mut v = self.authorization_scopes.unwrap_or_default();
159        v.push(input.into());
160        self.authorization_scopes = ::std::option::Option::Some(v);
161        self
162    }
163    /// <p>A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
164    pub fn set_authorization_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
165        self.authorization_scopes = input;
166        self
167    }
168    /// <p>A list of authorization scopes configured on a route. The scopes are used with a JWT authorizer to authorize the method invocation. The authorization works by matching the route scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any route scope matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the route scope is configured, the client must provide an access token instead of an identity token for authorization purposes.</p>
169    pub fn get_authorization_scopes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
170        &self.authorization_scopes
171    }
172    /// <p>The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.</p>
173    pub fn authorization_type(mut self, input: crate::types::AuthorizationType) -> Self {
174        self.authorization_type = ::std::option::Option::Some(input);
175        self
176    }
177    /// <p>The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.</p>
178    pub fn set_authorization_type(mut self, input: ::std::option::Option<crate::types::AuthorizationType>) -> Self {
179        self.authorization_type = input;
180        self
181    }
182    /// <p>The authorization type for the route. For WebSocket APIs, valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer For HTTP APIs, valid values are NONE for open access, JWT for using JSON Web Tokens, AWS_IAM for using AWS IAM permissions, and CUSTOM for using a Lambda authorizer.</p>
183    pub fn get_authorization_type(&self) -> &::std::option::Option<crate::types::AuthorizationType> {
184        &self.authorization_type
185    }
186    /// <p>The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
187    pub fn authorizer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
188        self.authorizer_id = ::std::option::Option::Some(input.into());
189        self
190    }
191    /// <p>The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
192    pub fn set_authorizer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193        self.authorizer_id = input;
194        self
195    }
196    /// <p>The identifier of the Authorizer resource to be associated with this route. The authorizer identifier is generated by API Gateway when you created the authorizer.</p>
197    pub fn get_authorizer_id(&self) -> &::std::option::Option<::std::string::String> {
198        &self.authorizer_id
199    }
200    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
201    pub fn model_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.model_selection_expression = ::std::option::Option::Some(input.into());
203        self
204    }
205    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
206    pub fn set_model_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.model_selection_expression = input;
208        self
209    }
210    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
211    pub fn get_model_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
212        &self.model_selection_expression
213    }
214    /// <p>The operation name for the route.</p>
215    pub fn operation_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
216        self.operation_name = ::std::option::Option::Some(input.into());
217        self
218    }
219    /// <p>The operation name for the route.</p>
220    pub fn set_operation_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
221        self.operation_name = input;
222        self
223    }
224    /// <p>The operation name for the route.</p>
225    pub fn get_operation_name(&self) -> &::std::option::Option<::std::string::String> {
226        &self.operation_name
227    }
228    /// Adds a key-value pair to `request_models`.
229    ///
230    /// To override the contents of this collection use [`set_request_models`](Self::set_request_models).
231    ///
232    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
233    pub fn request_models(
234        mut self,
235        k: impl ::std::convert::Into<::std::string::String>,
236        v: impl ::std::convert::Into<::std::string::String>,
237    ) -> Self {
238        let mut hash_map = self.request_models.unwrap_or_default();
239        hash_map.insert(k.into(), v.into());
240        self.request_models = ::std::option::Option::Some(hash_map);
241        self
242    }
243    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
244    pub fn set_request_models(
245        mut self,
246        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
247    ) -> Self {
248        self.request_models = input;
249        self
250    }
251    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
252    pub fn get_request_models(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
253        &self.request_models
254    }
255    /// Adds a key-value pair to `request_parameters`.
256    ///
257    /// To override the contents of this collection use [`set_request_parameters`](Self::set_request_parameters).
258    ///
259    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
260    pub fn request_parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ParameterConstraints) -> Self {
261        let mut hash_map = self.request_parameters.unwrap_or_default();
262        hash_map.insert(k.into(), v);
263        self.request_parameters = ::std::option::Option::Some(hash_map);
264        self
265    }
266    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
267    pub fn set_request_parameters(
268        mut self,
269        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
270    ) -> Self {
271        self.request_parameters = input;
272        self
273    }
274    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
275    pub fn get_request_parameters(
276        &self,
277    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>> {
278        &self.request_parameters
279    }
280    /// <p>The route ID.</p>
281    pub fn route_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
282        self.route_id = ::std::option::Option::Some(input.into());
283        self
284    }
285    /// <p>The route ID.</p>
286    pub fn set_route_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
287        self.route_id = input;
288        self
289    }
290    /// <p>The route ID.</p>
291    pub fn get_route_id(&self) -> &::std::option::Option<::std::string::String> {
292        &self.route_id
293    }
294    /// <p>The route key for the route.</p>
295    pub fn route_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
296        self.route_key = ::std::option::Option::Some(input.into());
297        self
298    }
299    /// <p>The route key for the route.</p>
300    pub fn set_route_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
301        self.route_key = input;
302        self
303    }
304    /// <p>The route key for the route.</p>
305    pub fn get_route_key(&self) -> &::std::option::Option<::std::string::String> {
306        &self.route_key
307    }
308    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
309    pub fn route_response_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
310        self.route_response_selection_expression = ::std::option::Option::Some(input.into());
311        self
312    }
313    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
314    pub fn set_route_response_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
315        self.route_response_selection_expression = input;
316        self
317    }
318    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
319    pub fn get_route_response_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
320        &self.route_response_selection_expression
321    }
322    /// <p>The target for the route.</p>
323    pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
324        self.target = ::std::option::Option::Some(input.into());
325        self
326    }
327    /// <p>The target for the route.</p>
328    pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
329        self.target = input;
330        self
331    }
332    /// <p>The target for the route.</p>
333    pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
334        &self.target
335    }
336    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
337        self._request_id = Some(request_id.into());
338        self
339    }
340
341    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
342        self._request_id = request_id;
343        self
344    }
345    /// Consumes the builder and constructs a [`CreateRouteOutput`](crate::operation::create_route::CreateRouteOutput).
346    pub fn build(self) -> crate::operation::create_route::CreateRouteOutput {
347        crate::operation::create_route::CreateRouteOutput {
348            api_gateway_managed: self.api_gateway_managed,
349            api_key_required: self.api_key_required,
350            authorization_scopes: self.authorization_scopes,
351            authorization_type: self.authorization_type,
352            authorizer_id: self.authorizer_id,
353            model_selection_expression: self.model_selection_expression,
354            operation_name: self.operation_name,
355            request_models: self.request_models,
356            request_parameters: self.request_parameters,
357            route_id: self.route_id,
358            route_key: self.route_key,
359            route_response_selection_expression: self.route_response_selection_expression,
360            target: self.target,
361            _request_id: self._request_id,
362        }
363    }
364}