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