aws_sdk_apigateway/operation/put_method/_put_method_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Request to add a method to an existing Resource resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct PutMethodInput {
7 /// <p>The string identifier of the associated RestApi.</p>
8 pub rest_api_id: ::std::option::Option<::std::string::String>,
9 /// <p>The Resource identifier for the new Method resource.</p>
10 pub resource_id: ::std::option::Option<::std::string::String>,
11 /// <p>Specifies the method request's HTTP method type.</p>
12 pub http_method: ::std::option::Option<::std::string::String>,
13 /// <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>
14 pub authorization_type: ::std::option::Option<::std::string::String>,
15 /// <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>
16 pub authorizer_id: ::std::option::Option<::std::string::String>,
17 /// <p>Specifies whether the method required a valid ApiKey.</p>
18 pub api_key_required: ::std::option::Option<bool>,
19 /// <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>
20 pub operation_name: ::std::option::Option<::std::string::String>,
21 /// <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>
22 pub request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>,
23 /// <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>
24 pub request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
25 /// <p>The identifier of a RequestValidator for validating the method request.</p>
26 pub request_validator_id: ::std::option::Option<::std::string::String>,
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}
30impl PutMethodInput {
31 /// <p>The string identifier of the associated RestApi.</p>
32 pub fn rest_api_id(&self) -> ::std::option::Option<&str> {
33 self.rest_api_id.as_deref()
34 }
35 /// <p>The Resource identifier for the new Method resource.</p>
36 pub fn resource_id(&self) -> ::std::option::Option<&str> {
37 self.resource_id.as_deref()
38 }
39 /// <p>Specifies the method request's HTTP method type.</p>
40 pub fn http_method(&self) -> ::std::option::Option<&str> {
41 self.http_method.as_deref()
42 }
43 /// <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>
44 pub fn authorization_type(&self) -> ::std::option::Option<&str> {
45 self.authorization_type.as_deref()
46 }
47 /// <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>
48 pub fn authorizer_id(&self) -> ::std::option::Option<&str> {
49 self.authorizer_id.as_deref()
50 }
51 /// <p>Specifies whether the method required a valid ApiKey.</p>
52 pub fn api_key_required(&self) -> ::std::option::Option<bool> {
53 self.api_key_required
54 }
55 /// <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>
56 pub fn operation_name(&self) -> ::std::option::Option<&str> {
57 self.operation_name.as_deref()
58 }
59 /// <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>
60 pub fn request_parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, bool>> {
61 self.request_parameters.as_ref()
62 }
63 /// <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>
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 identifier of a RequestValidator for validating the method request.</p>
68 pub fn request_validator_id(&self) -> ::std::option::Option<&str> {
69 self.request_validator_id.as_deref()
70 }
71 /// <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>
72 ///
73 /// 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()`.
74 pub fn authorization_scopes(&self) -> &[::std::string::String] {
75 self.authorization_scopes.as_deref().unwrap_or_default()
76 }
77}
78impl PutMethodInput {
79 /// Creates a new builder-style object to manufacture [`PutMethodInput`](crate::operation::put_method::PutMethodInput).
80 pub fn builder() -> crate::operation::put_method::builders::PutMethodInputBuilder {
81 crate::operation::put_method::builders::PutMethodInputBuilder::default()
82 }
83}
84
85/// A builder for [`PutMethodInput`](crate::operation::put_method::PutMethodInput).
86#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
87#[non_exhaustive]
88pub struct PutMethodInputBuilder {
89 pub(crate) rest_api_id: ::std::option::Option<::std::string::String>,
90 pub(crate) resource_id: ::std::option::Option<::std::string::String>,
91 pub(crate) http_method: ::std::option::Option<::std::string::String>,
92 pub(crate) authorization_type: ::std::option::Option<::std::string::String>,
93 pub(crate) authorizer_id: ::std::option::Option<::std::string::String>,
94 pub(crate) api_key_required: ::std::option::Option<bool>,
95 pub(crate) operation_name: ::std::option::Option<::std::string::String>,
96 pub(crate) request_parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>,
97 pub(crate) request_models: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
98 pub(crate) request_validator_id: ::std::option::Option<::std::string::String>,
99 pub(crate) authorization_scopes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
100}
101impl PutMethodInputBuilder {
102 /// <p>The string identifier of the associated RestApi.</p>
103 /// This field is required.
104 pub fn rest_api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105 self.rest_api_id = ::std::option::Option::Some(input.into());
106 self
107 }
108 /// <p>The string identifier of the associated RestApi.</p>
109 pub fn set_rest_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110 self.rest_api_id = input;
111 self
112 }
113 /// <p>The string identifier of the associated RestApi.</p>
114 pub fn get_rest_api_id(&self) -> &::std::option::Option<::std::string::String> {
115 &self.rest_api_id
116 }
117 /// <p>The Resource identifier for the new Method resource.</p>
118 /// This field is required.
119 pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.resource_id = ::std::option::Option::Some(input.into());
121 self
122 }
123 /// <p>The Resource identifier for the new Method resource.</p>
124 pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125 self.resource_id = input;
126 self
127 }
128 /// <p>The Resource identifier for the new Method resource.</p>
129 pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
130 &self.resource_id
131 }
132 /// <p>Specifies the method request's HTTP method type.</p>
133 /// This field is required.
134 pub fn http_method(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135 self.http_method = ::std::option::Option::Some(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.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.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 /// This field is required.
149 pub fn authorization_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150 self.authorization_type = ::std::option::Option::Some(input.into());
151 self
152 }
153 /// <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>
154 pub fn set_authorization_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155 self.authorization_type = input;
156 self
157 }
158 /// <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>
159 pub fn get_authorization_type(&self) -> &::std::option::Option<::std::string::String> {
160 &self.authorization_type
161 }
162 /// <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>
163 pub fn authorizer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164 self.authorizer_id = ::std::option::Option::Some(input.into());
165 self
166 }
167 /// <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>
168 pub fn set_authorizer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169 self.authorizer_id = input;
170 self
171 }
172 /// <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>
173 pub fn get_authorizer_id(&self) -> &::std::option::Option<::std::string::String> {
174 &self.authorizer_id
175 }
176 /// <p>Specifies whether the method required a valid ApiKey.</p>
177 pub fn api_key_required(mut self, input: bool) -> Self {
178 self.api_key_required = ::std::option::Option::Some(input);
179 self
180 }
181 /// <p>Specifies whether the method required a valid ApiKey.</p>
182 pub fn set_api_key_required(mut self, input: ::std::option::Option<bool>) -> Self {
183 self.api_key_required = input;
184 self
185 }
186 /// <p>Specifies whether the method required a valid ApiKey.</p>
187 pub fn get_api_key_required(&self) -> &::std::option::Option<bool> {
188 &self.api_key_required
189 }
190 /// <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>
191 pub fn operation_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
192 self.operation_name = ::std::option::Option::Some(input.into());
193 self
194 }
195 /// <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>
196 pub fn set_operation_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197 self.operation_name = input;
198 self
199 }
200 /// <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>
201 pub fn get_operation_name(&self) -> &::std::option::Option<::std::string::String> {
202 &self.operation_name
203 }
204 /// Adds a key-value pair to `request_parameters`.
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 let mut hash_map = self.request_parameters.unwrap_or_default();
211 hash_map.insert(k.into(), v);
212 self.request_parameters = ::std::option::Option::Some(hash_map);
213 self
214 }
215 /// <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>
216 pub fn set_request_parameters(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, bool>>) -> Self {
217 self.request_parameters = input;
218 self
219 }
220 /// <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>
221 pub fn get_request_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, bool>> {
222 &self.request_parameters
223 }
224 /// Adds a key-value pair to `request_models`.
225 ///
226 /// To override the contents of this collection use [`set_request_models`](Self::set_request_models).
227 ///
228 /// <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>
229 pub fn request_models(
230 mut self,
231 k: impl ::std::convert::Into<::std::string::String>,
232 v: impl ::std::convert::Into<::std::string::String>,
233 ) -> Self {
234 let mut hash_map = self.request_models.unwrap_or_default();
235 hash_map.insert(k.into(), v.into());
236 self.request_models = ::std::option::Option::Some(hash_map);
237 self
238 }
239 /// <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>
240 pub fn set_request_models(
241 mut self,
242 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
243 ) -> Self {
244 self.request_models = input;
245 self
246 }
247 /// <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>
248 pub fn get_request_models(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
249 &self.request_models
250 }
251 /// <p>The identifier of a RequestValidator for validating the method request.</p>
252 pub fn request_validator_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
253 self.request_validator_id = ::std::option::Option::Some(input.into());
254 self
255 }
256 /// <p>The identifier of a RequestValidator for validating the method request.</p>
257 pub fn set_request_validator_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
258 self.request_validator_id = input;
259 self
260 }
261 /// <p>The identifier of a RequestValidator for validating the method request.</p>
262 pub fn get_request_validator_id(&self) -> &::std::option::Option<::std::string::String> {
263 &self.request_validator_id
264 }
265 /// Appends an item to `authorization_scopes`.
266 ///
267 /// To override the contents of this collection use [`set_authorization_scopes`](Self::set_authorization_scopes).
268 ///
269 /// <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>
270 pub fn authorization_scopes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
271 let mut v = self.authorization_scopes.unwrap_or_default();
272 v.push(input.into());
273 self.authorization_scopes = ::std::option::Option::Some(v);
274 self
275 }
276 /// <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>
277 pub fn set_authorization_scopes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
278 self.authorization_scopes = input;
279 self
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 get_authorization_scopes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
283 &self.authorization_scopes
284 }
285 /// Consumes the builder and constructs a [`PutMethodInput`](crate::operation::put_method::PutMethodInput).
286 pub fn build(self) -> ::std::result::Result<crate::operation::put_method::PutMethodInput, ::aws_smithy_types::error::operation::BuildError> {
287 ::std::result::Result::Ok(crate::operation::put_method::PutMethodInput {
288 rest_api_id: self.rest_api_id,
289 resource_id: self.resource_id,
290 http_method: self.http_method,
291 authorization_type: self.authorization_type,
292 authorizer_id: self.authorizer_id,
293 api_key_required: self.api_key_required,
294 operation_name: self.operation_name,
295 request_parameters: self.request_parameters,
296 request_models: self.request_models,
297 request_validator_id: self.request_validator_id,
298 authorization_scopes: self.authorization_scopes,
299 })
300 }
301}