141 145 | crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError,
|
142 146 | >::new());
|
143 147 |
|
144 148 | ::std::borrow::Cow::Owned(rcb)
|
145 149 | }
|
146 150 | }
|
147 151 |
|
148 152 | #[derive(Debug)]
|
149 153 | struct RemoveTagsFromVaultResponseDeserializer;
|
150 154 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for RemoveTagsFromVaultResponseDeserializer {
|
151 - | fn deserialize_nonstreaming(
|
155 + | fn deserialize_nonstreaming_with_config(
|
152 156 | &self,
|
153 157 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
158 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
154 159 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
155 160 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
156 - | let headers = response.headers();
|
157 - | let body = response.body().bytes().expect("body loaded");
|
158 161 | #[allow(unused_mut)]
|
159 162 | let mut force_error = false;
|
160 163 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
161 - | let parse_result = if !success && status != 204 || force_error {
|
162 - | crate::protocol_serde::shape_remove_tags_from_vault::de_remove_tags_from_vault_http_error(status, headers, body)
|
164 + | if !success && status != 204 || force_error {
|
165 + | let headers = response.headers();
|
166 + | let body = response.body().bytes().expect("body loaded");
|
167 + | #[allow(unused_mut)]
|
168 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
169 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
170 + | })?;
|
171 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
172 + | let generic = generic_builder.build();
|
173 + | let error_code = match generic.code() {
|
174 + | ::std::option::Option::Some(code) => code,
|
175 + | ::std::option::Option::None => {
|
176 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
177 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
178 + | crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::unhandled(generic),
|
179 + | ),
|
180 + | ))
|
181 + | }
|
182 + | };
|
183 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
184 + | let protocol = _cfg
|
185 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
186 + | .expect("a SharedClientProtocol is required");
|
187 + | let err = match error_code {
|
188 + | "InvalidParameterValueException" => {
|
189 + | crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::InvalidParameterValueException({
|
190 + | let mut tmp = match protocol
|
191 + | .deserialize_response(response, crate::types::error::InvalidParameterValueException::SCHEMA, _cfg)
|
192 + | .and_then(|mut deser| {
|
193 + | crate::types::error::InvalidParameterValueException::deserialize_with_response(
|
194 + | &mut *deser,
|
195 + | response.headers(),
|
196 + | response.status().into(),
|
197 + | body,
|
198 + | )
|
199 + | }) {
|
200 + | ::std::result::Result::Ok(val) => val,
|
201 + | ::std::result::Result::Err(e) => {
|
202 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
203 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
204 + | ))
|
205 + | }
|
206 + | };
|
207 + | tmp.meta = generic;
|
208 + | if tmp.message.is_none() {
|
209 + | tmp.message = _error_message;
|
210 + | }
|
211 + | tmp
|
212 + | })
|
213 + | }
|
214 + | "MissingParameterValueException" => {
|
215 + | crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::MissingParameterValueException({
|
216 + | let mut tmp = match protocol
|
217 + | .deserialize_response(response, crate::types::error::MissingParameterValueException::SCHEMA, _cfg)
|
218 + | .and_then(|mut deser| {
|
219 + | crate::types::error::MissingParameterValueException::deserialize_with_response(
|
220 + | &mut *deser,
|
221 + | response.headers(),
|
222 + | response.status().into(),
|
223 + | body,
|
224 + | )
|
225 + | }) {
|
226 + | ::std::result::Result::Ok(val) => val,
|
227 + | ::std::result::Result::Err(e) => {
|
228 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
229 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
230 + | ))
|
231 + | }
|
232 + | };
|
233 + | tmp.meta = generic;
|
234 + | if tmp.message.is_none() {
|
235 + | tmp.message = _error_message;
|
236 + | }
|
237 + | tmp
|
238 + | })
|
239 + | }
|
240 + | "ResourceNotFoundException" => crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::ResourceNotFoundException({
|
241 + | let mut tmp = match protocol
|
242 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
243 + | .and_then(|mut deser| {
|
244 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
245 + | &mut *deser,
|
246 + | response.headers(),
|
247 + | response.status().into(),
|
248 + | body,
|
249 + | )
|
250 + | }) {
|
251 + | ::std::result::Result::Ok(val) => val,
|
252 + | ::std::result::Result::Err(e) => {
|
253 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
254 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
255 + | ))
|
256 + | }
|
257 + | };
|
258 + | tmp.meta = generic;
|
259 + | if tmp.message.is_none() {
|
260 + | tmp.message = _error_message;
|
261 + | }
|
262 + | tmp
|
263 + | }),
|
264 + | "ServiceUnavailableException" => crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::ServiceUnavailableException({
|
265 + | let mut tmp = match protocol
|
266 + | .deserialize_response(response, crate::types::error::ServiceUnavailableException::SCHEMA, _cfg)
|
267 + | .and_then(|mut deser| {
|
268 + | crate::types::error::ServiceUnavailableException::deserialize_with_response(
|
269 + | &mut *deser,
|
270 + | response.headers(),
|
271 + | response.status().into(),
|
272 + | body,
|
273 + | )
|
274 + | }) {
|
275 + | ::std::result::Result::Ok(val) => val,
|
276 + | ::std::result::Result::Err(e) => {
|
277 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
278 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
279 + | ))
|
280 + | }
|
281 + | };
|
282 + | tmp.meta = generic;
|
283 + | if tmp.message.is_none() {
|
284 + | tmp.message = _error_message;
|
285 + | }
|
286 + | tmp
|
287 + | }),
|
288 + | _ => crate::operation::remove_tags_from_vault::RemoveTagsFromVaultError::generic(generic),
|
289 + | };
|
290 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
291 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
292 + | ))
|
163 293 | } else {
|
164 - | crate::protocol_serde::shape_remove_tags_from_vault::de_remove_tags_from_vault_http_response(status, headers, body)
|
165 - | };
|
166 - | crate::protocol_serde::type_erase_result(parse_result)
|
294 + | let protocol = _cfg
|
295 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
296 + | .expect("a SharedClientProtocol is required");
|
297 + | let mut deser = protocol
|
298 + | .deserialize_response(response, RemoveTagsFromVault::OUTPUT_SCHEMA, _cfg)
|
299 + | .map_err(|e| {
|
300 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
301 + | })?;
|
302 + | let body = response.body().bytes().expect("body loaded");
|
303 + | let output = crate::operation::remove_tags_from_vault::RemoveTagsFromVaultOutput::deserialize_with_response(
|
304 + | &mut *deser,
|
305 + | response.headers(),
|
306 + | response.status().into(),
|
307 + | body,
|
308 + | )
|
309 + | .map_err(|e| {
|
310 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
311 + | })?;
|
312 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
313 + | }
|
167 314 | }
|
168 315 | }
|
169 316 | #[derive(Debug)]
|
170 317 | struct RemoveTagsFromVaultRequestSerializer;
|
171 318 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for RemoveTagsFromVaultRequestSerializer {
|
172 319 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
173 320 | fn serialize_input(
|
174 321 | &self,
|
175 322 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
176 323 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
177 324 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
178 325 | let input = input
|
179 326 | .downcast::<crate::operation::remove_tags_from_vault::RemoveTagsFromVaultInput>()
|
180 327 | .expect("correct type");
|
181 - | let _header_serialization_settings = _cfg
|
182 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
183 - | .cloned()
|
184 - | .unwrap_or_default();
|
185 - | let mut request_builder = {
|
186 - | #[allow(clippy::uninlined_format_args)]
|
187 - | fn uri_base(
|
188 - | _input: &crate::operation::remove_tags_from_vault::RemoveTagsFromVaultInput,
|
189 - | output: &mut ::std::string::String,
|
190 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
191 - | use ::std::fmt::Write as _;
|
192 - | let input_1 = &_input.account_id;
|
193 - | let input_1 = input_1
|
194 - | .as_ref()
|
195 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("account_id", "cannot be empty or unset"))?;
|
196 - | let account_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
197 - | if account_id.is_empty() {
|
198 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
199 - | "account_id",
|
200 - | "cannot be empty or unset",
|
201 - | ));
|
328 + | let protocol = _cfg
|
329 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
330 + | .expect("a SharedClientProtocol is required");
|
331 + | if protocol.supports_http_bindings() {
|
332 + | let mut request = protocol
|
333 + | .serialize_body(&input, RemoveTagsFromVault::INPUT_SCHEMA, "", _cfg)
|
334 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
335 + | {
|
336 + | let mut uri = "/{accountId}/vaults/{vaultName}/tags?operation=remove".to_string();
|
337 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
338 + | if let Some(ref val) = input.account_id {
|
339 + | uri = uri.replace("{accountId}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
202 340 | }
|
203 - | let input_2 = &_input.vault_name;
|
204 - | let input_2 = input_2
|
205 - | .as_ref()
|
206 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("vault_name", "cannot be empty or unset"))?;
|
207 - | let vault_name = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
|
208 - | if vault_name.is_empty() {
|
209 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
210 - | "vault_name",
|
211 - | "cannot be empty or unset",
|
212 - | ));
|
341 + | if let Some(ref val) = input.vault_name {
|
342 + | uri = uri.replace("{vaultName}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
213 343 | }
|
214 - | ::std::write!(
|
215 - | output,
|
216 - | "/{accountId}/vaults/{vaultName}/tags",
|
217 - | accountId = account_id,
|
218 - | vaultName = vault_name
|
219 - | )
|
220 - | .expect("formatting should succeed");
|
221 - | ::std::result::Result::Ok(())
|
222 - | }
|
223 - | fn uri_query(
|
224 - | _input: &crate::operation::remove_tags_from_vault::RemoveTagsFromVaultInput,
|
225 - | mut output: &mut ::std::string::String,
|
226 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
227 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
228 - | query.push_kv("operation", "remove");
|
229 - | ::std::result::Result::Ok(())
|
230 - | }
|
231 - | #[allow(clippy::unnecessary_wraps)]
|
232 - | fn update_http_builder(
|
233 - | input: &crate::operation::remove_tags_from_vault::RemoveTagsFromVaultInput,
|
234 - | builder: ::http_1x::request::Builder,
|
235 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
236 - | let mut uri = ::std::string::String::new();
|
237 - | uri_base(input, &mut uri)?;
|
238 - | uri_query(input, &mut uri)?;
|
239 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
344 + | if !query_params.is_empty() {
|
345 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
346 + | let pairs: Vec<String> = query_params
|
347 + | .iter()
|
348 + | .map(|(k, v)| {
|
349 + | format!(
|
350 + | "{}={}",
|
351 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
352 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
353 + | )
|
354 + | })
|
355 + | .collect();
|
356 + | uri.push_str(&pairs.join("&"));
|
357 + | }
|
358 + | request.set_uri(uri.as_str()).expect("valid URI");
|
240 359 | }
|
241 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
242 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
243 - | builder
|
244 - | };
|
245 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_remove_tags_from_vault::ser_remove_tags_from_vault_input(
|
246 - | &input,
|
247 - | )?);
|
248 - | if let Some(content_length) = body.content_length() {
|
249 - | let content_length = content_length.to_string();
|
250 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
360 + |
|
361 + | return ::std::result::Result::Ok(request);
|
362 + | } else {
|
363 + | let mut request = protocol
|
364 + | .serialize_request(&input, RemoveTagsFromVault::INPUT_SCHEMA, "", _cfg)
|
365 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
366 + |
|
367 + | return ::std::result::Result::Ok(request);
|
251 368 | }
|
252 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
253 369 | }
|
254 370 | }
|
255 371 | #[derive(Debug)]
|
256 372 | struct RemoveTagsFromVaultEndpointParamsInterceptor;
|
257 373 |
|
258 374 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for RemoveTagsFromVaultEndpointParamsInterceptor {
|
259 375 | fn name(&self) -> &'static str {
|
260 376 | "RemoveTagsFromVaultEndpointParamsInterceptor"
|
261 377 | }
|
262 378 |
|