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