aws_sdk_apigatewayv2/operation/create_route/
_create_route_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Creates a new Route resource to represent a route.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateRouteInput {
7    /// <p>The API identifier.</p>
8    pub api_id: ::std::option::Option<::std::string::String>,
9    /// <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
10    pub api_key_required: ::std::option::Option<bool>,
11    /// <p>The authorization scopes supported by this route.</p>
12    pub authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
13    /// <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>
14    pub authorization_type: ::std::option::Option<crate::types::AuthorizationType>,
15    /// <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>
16    pub authorizer_id: ::std::option::Option<::std::string::String>,
17    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
18    pub model_selection_expression: ::std::option::Option<::std::string::String>,
19    /// <p>The operation name for the route.</p>
20    pub operation_name: ::std::option::Option<::std::string::String>,
21    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
22    pub request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
23    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
24    pub request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
25    /// <p>The route key for the route.</p>
26    pub route_key: ::std::option::Option<::std::string::String>,
27    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
28    pub route_response_selection_expression: ::std::option::Option<::std::string::String>,
29    /// <p>The target for the route.</p>
30    pub target: ::std::option::Option<::std::string::String>,
31}
32impl CreateRouteInput {
33    /// <p>The API identifier.</p>
34    pub fn api_id(&self) -> ::std::option::Option<&str> {
35        self.api_id.as_deref()
36    }
37    /// <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
38    pub fn api_key_required(&self) -> ::std::option::Option<bool> {
39        self.api_key_required
40    }
41    /// <p>The authorization scopes supported by this route.</p>
42    ///
43    /// 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()`.
44    pub fn authorization_scopes(&self) -> &[::std::string::String] {
45        self.authorization_scopes.as_deref().unwrap_or_default()
46    }
47    /// <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>
48    pub fn authorization_type(&self) -> ::std::option::Option<&crate::types::AuthorizationType> {
49        self.authorization_type.as_ref()
50    }
51    /// <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>
52    pub fn authorizer_id(&self) -> ::std::option::Option<&str> {
53        self.authorizer_id.as_deref()
54    }
55    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
56    pub fn model_selection_expression(&self) -> ::std::option::Option<&str> {
57        self.model_selection_expression.as_deref()
58    }
59    /// <p>The operation name for the route.</p>
60    pub fn operation_name(&self) -> ::std::option::Option<&str> {
61        self.operation_name.as_deref()
62    }
63    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
64    pub fn request_models(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
65        self.request_models.as_ref()
66    }
67    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
68    pub fn request_parameters(
69        &self,
70    ) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>> {
71        self.request_parameters.as_ref()
72    }
73    /// <p>The route key for the route.</p>
74    pub fn route_key(&self) -> ::std::option::Option<&str> {
75        self.route_key.as_deref()
76    }
77    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
78    pub fn route_response_selection_expression(&self) -> ::std::option::Option<&str> {
79        self.route_response_selection_expression.as_deref()
80    }
81    /// <p>The target for the route.</p>
82    pub fn target(&self) -> ::std::option::Option<&str> {
83        self.target.as_deref()
84    }
85}
86impl CreateRouteInput {
87    /// Creates a new builder-style object to manufacture [`CreateRouteInput`](crate::operation::create_route::CreateRouteInput).
88    pub fn builder() -> crate::operation::create_route::builders::CreateRouteInputBuilder {
89        crate::operation::create_route::builders::CreateRouteInputBuilder::default()
90    }
91}
92
93/// A builder for [`CreateRouteInput`](crate::operation::create_route::CreateRouteInput).
94#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
95#[non_exhaustive]
96pub struct CreateRouteInputBuilder {
97    pub(crate) api_id: ::std::option::Option<::std::string::String>,
98    pub(crate) api_key_required: ::std::option::Option<bool>,
99    pub(crate) authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
100    pub(crate) authorization_type: ::std::option::Option<crate::types::AuthorizationType>,
101    pub(crate) authorizer_id: ::std::option::Option<::std::string::String>,
102    pub(crate) model_selection_expression: ::std::option::Option<::std::string::String>,
103    pub(crate) operation_name: ::std::option::Option<::std::string::String>,
104    pub(crate) request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
105    pub(crate) request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
106    pub(crate) route_key: ::std::option::Option<::std::string::String>,
107    pub(crate) route_response_selection_expression: ::std::option::Option<::std::string::String>,
108    pub(crate) target: ::std::option::Option<::std::string::String>,
109}
110impl CreateRouteInputBuilder {
111    /// <p>The API identifier.</p>
112    /// This field is required.
113    pub fn api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.api_id = ::std::option::Option::Some(input.into());
115        self
116    }
117    /// <p>The API identifier.</p>
118    pub fn set_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.api_id = input;
120        self
121    }
122    /// <p>The API identifier.</p>
123    pub fn get_api_id(&self) -> &::std::option::Option<::std::string::String> {
124        &self.api_id
125    }
126    /// <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
127    pub fn api_key_required(mut self, input: bool) -> Self {
128        self.api_key_required = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
132    pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
133        self.api_key_required = input;
134        self
135    }
136    /// <p>Specifies whether an API key is required for the route. Supported only for WebSocket APIs.</p>
137    pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
138        &self.api_key_required
139    }
140    /// Appends an item to `authorization_scopes`.
141    ///
142    /// To override the contents of this collection use [`set_authorization_scopes`](Self::set_authorization_scopes).
143    ///
144    /// <p>The authorization scopes supported by this route.</p>
145    pub fn authorization_scopes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        let mut v = self.authorization_scopes.unwrap_or_default();
147        v.push(input.into());
148        self.authorization_scopes = ::std::option::Option::Some(v);
149        self
150    }
151    /// <p>The authorization scopes supported by this route.</p>
152    pub fn set_authorization_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
153        self.authorization_scopes = input;
154        self
155    }
156    /// <p>The authorization scopes supported by this route.</p>
157    pub fn get_authorization_scopes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
158        &self.authorization_scopes
159    }
160    /// <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>
161    pub fn authorization_type(mut self, input: crate::types::AuthorizationType) -> Self {
162        self.authorization_type = ::std::option::Option::Some(input);
163        self
164    }
165    /// <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>
166    pub fn set_authorization_type(mut self, input: ::std::option::Option<crate::types::AuthorizationType>) -> Self {
167        self.authorization_type = input;
168        self
169    }
170    /// <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>
171    pub fn get_authorization_type(&self) -> &::std::option::Option<crate::types::AuthorizationType> {
172        &self.authorization_type
173    }
174    /// <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>
175    pub fn authorizer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.authorizer_id = ::std::option::Option::Some(input.into());
177        self
178    }
179    /// <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>
180    pub fn set_authorizer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.authorizer_id = input;
182        self
183    }
184    /// <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>
185    pub fn get_authorizer_id(&self) -> &::std::option::Option<::std::string::String> {
186        &self.authorizer_id
187    }
188    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
189    pub fn model_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190        self.model_selection_expression = ::std::option::Option::Some(input.into());
191        self
192    }
193    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
194    pub fn set_model_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195        self.model_selection_expression = input;
196        self
197    }
198    /// <p>The model selection expression for the route. Supported only for WebSocket APIs.</p>
199    pub fn get_model_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
200        &self.model_selection_expression
201    }
202    /// <p>The operation name for the route.</p>
203    pub fn operation_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204        self.operation_name = ::std::option::Option::Some(input.into());
205        self
206    }
207    /// <p>The operation name for the route.</p>
208    pub fn set_operation_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
209        self.operation_name = input;
210        self
211    }
212    /// <p>The operation name for the route.</p>
213    pub fn get_operation_name(&self) -> &::std::option::Option<::std::string::String> {
214        &self.operation_name
215    }
216    /// Adds a key-value pair to `request_models`.
217    ///
218    /// To override the contents of this collection use [`set_request_models`](Self::set_request_models).
219    ///
220    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
221    pub fn request_models(
222        mut self,
223        k: impl ::std::convert::Into<::std::string::String>,
224        v: impl ::std::convert::Into<::std::string::String>,
225    ) -> Self {
226        let mut hash_map = self.request_models.unwrap_or_default();
227        hash_map.insert(k.into(), v.into());
228        self.request_models = ::std::option::Option::Some(hash_map);
229        self
230    }
231    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
232    pub fn set_request_models(
233        mut self,
234        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
235    ) -> Self {
236        self.request_models = input;
237        self
238    }
239    /// <p>The request models for the route. Supported only for WebSocket APIs.</p>
240    pub fn get_request_models(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
241        &self.request_models
242    }
243    /// Adds a key-value pair to `request_parameters`.
244    ///
245    /// To override the contents of this collection use [`set_request_parameters`](Self::set_request_parameters).
246    ///
247    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
248    pub fn request_parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ParameterConstraints) -> Self {
249        let mut hash_map = self.request_parameters.unwrap_or_default();
250        hash_map.insert(k.into(), v);
251        self.request_parameters = ::std::option::Option::Some(hash_map);
252        self
253    }
254    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
255    pub fn set_request_parameters(
256        mut self,
257        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>>,
258    ) -> Self {
259        self.request_parameters = input;
260        self
261    }
262    /// <p>The request parameters for the route. Supported only for WebSocket APIs.</p>
263    pub fn get_request_parameters(
264        &self,
265    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ParameterConstraints>> {
266        &self.request_parameters
267    }
268    /// <p>The route key for the route.</p>
269    /// This field is required.
270    pub fn route_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
271        self.route_key = ::std::option::Option::Some(input.into());
272        self
273    }
274    /// <p>The route key for the route.</p>
275    pub fn set_route_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
276        self.route_key = input;
277        self
278    }
279    /// <p>The route key for the route.</p>
280    pub fn get_route_key(&self) -> &::std::option::Option<::std::string::String> {
281        &self.route_key
282    }
283    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
284    pub fn route_response_selection_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
285        self.route_response_selection_expression = ::std::option::Option::Some(input.into());
286        self
287    }
288    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
289    pub fn set_route_response_selection_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
290        self.route_response_selection_expression = input;
291        self
292    }
293    /// <p>The route response selection expression for the route. Supported only for WebSocket APIs.</p>
294    pub fn get_route_response_selection_expression(&self) -> &::std::option::Option<::std::string::String> {
295        &self.route_response_selection_expression
296    }
297    /// <p>The target for the route.</p>
298    pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
299        self.target = ::std::option::Option::Some(input.into());
300        self
301    }
302    /// <p>The target for the route.</p>
303    pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
304        self.target = input;
305        self
306    }
307    /// <p>The target for the route.</p>
308    pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
309        &self.target
310    }
311    /// Consumes the builder and constructs a [`CreateRouteInput`](crate::operation::create_route::CreateRouteInput).
312    pub fn build(self) -> ::std::result::Result<crate::operation::create_route::CreateRouteInput, ::aws_smithy_types::error::operation::BuildError> {
313        ::std::result::Result::Ok(crate::operation::create_route::CreateRouteInput {
314            api_id: self.api_id,
315            api_key_required: self.api_key_required,
316            authorization_scopes: self.authorization_scopes,
317            authorization_type: self.authorization_type,
318            authorizer_id: self.authorizer_id,
319            model_selection_expression: self.model_selection_expression,
320            operation_name: self.operation_name,
321            request_models: self.request_models,
322            request_parameters: self.request_parameters,
323            route_key: self.route_key,
324            route_response_selection_expression: self.route_response_selection_expression,
325            target: self.target,
326        })
327    }
328}