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