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