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