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