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