1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | pub use crate::operation::output_stream_with_initial_response::_output_stream_with_initial_response_input::OutputStreamWithInitialResponseInputBuilder;
|
3 + |
|
4 + | pub use crate::operation::output_stream_with_initial_response::_output_stream_with_initial_response_output::OutputStreamWithInitialResponseOutputBuilder;
|
5 + |
|
6 + | impl crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseInputBuilder {
|
7 + | /// Sends a request with this input using the given client.
|
8 + | pub async fn send_with(
|
9 + | self,
|
10 + | client: &crate::Client,
|
11 + | ) -> ::std::result::Result<
|
12 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
|
13 + | ::aws_smithy_runtime_api::client::result::SdkError<
|
14 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
15 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
16 + | >,
|
17 + | > {
|
18 + | let mut fluent_builder = client.output_stream_with_initial_response();
|
19 + | fluent_builder.inner = self;
|
20 + | fluent_builder.send().await
|
21 + | }
|
22 + | }
|
23 + | /// Fluent builder constructing a request to `OutputStreamWithInitialResponse`.
|
24 + | ///
|
25 + | #[derive(::std::clone::Clone, ::std::fmt::Debug)]
|
26 + | pub struct OutputStreamWithInitialResponseFluentBuilder {
|
27 + | handle: ::std::sync::Arc<crate::client::Handle>,
|
28 + | inner: crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseInputBuilder,
|
29 + | config_override: ::std::option::Option<crate::config::Builder>,
|
30 + | }
|
31 + | impl
|
32 + | crate::client::customize::internal::CustomizableSend<
|
33 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
|
34 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
35 + | > for OutputStreamWithInitialResponseFluentBuilder
|
36 + | {
|
37 + | fn send(
|
38 + | self,
|
39 + | config_override: crate::config::Builder,
|
40 + | ) -> crate::client::customize::internal::BoxFuture<
|
41 + | crate::client::customize::internal::SendResult<
|
42 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
|
43 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
44 + | >,
|
45 + | > {
|
46 + | ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
|
47 + | }
|
48 + | }
|
49 + | impl OutputStreamWithInitialResponseFluentBuilder {
|
50 + | /// Creates a new `OutputStreamWithInitialResponseFluentBuilder`.
|
51 + | pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
|
52 + | Self {
|
53 + | handle,
|
54 + | inner: ::std::default::Default::default(),
|
55 + | config_override: ::std::option::Option::None,
|
56 + | }
|
57 + | }
|
58 + | /// Access the OutputStreamWithInitialResponse as a reference.
|
59 + | pub fn as_input(&self) -> &crate::operation::output_stream_with_initial_response::builders::OutputStreamWithInitialResponseInputBuilder {
|
60 + | &self.inner
|
61 + | }
|
62 + | /// Sends the request and returns the response.
|
63 + | ///
|
64 + | /// If an error occurs, an `SdkError` will be returned with additional details that
|
65 + | /// can be matched against.
|
66 + | ///
|
67 + | /// By default, any retryable failures will be retried twice. Retry behavior
|
68 + | /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
|
69 + | /// set when configuring the client.
|
70 + | pub async fn send(
|
71 + | self,
|
72 + | ) -> ::std::result::Result<
|
73 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
|
74 + | ::aws_smithy_runtime_api::client::result::SdkError<
|
75 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
76 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
77 + | >,
|
78 + | > {
|
79 + | let input = self
|
80 + | .inner
|
81 + | .build()
|
82 + | .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
|
83 + | let runtime_plugins = crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponse::operation_runtime_plugins(
|
84 + | self.handle.runtime_plugins.clone(),
|
85 + | &self.handle.conf,
|
86 + | self.config_override,
|
87 + | );
|
88 + | let mut output =
|
89 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponse::orchestrate(&runtime_plugins, input).await?;
|
90 + |
|
91 + | // Converts any error encountered beyond this point into an `SdkError` response error
|
92 + | // with an `HttpResponse`. However, since we have already exited the `orchestrate`
|
93 + | // function, the original `HttpResponse` is no longer available and cannot be restored.
|
94 + | // This means that header information from the original response has been lost.
|
95 + | //
|
96 + | // Note that the response body would have been consumed by the deserializer
|
97 + | // regardless, even if the initial message was hypothetically processed during
|
98 + | // the orchestrator's deserialization phase but later resulted in an error.
|
99 + | fn response_error(
|
100 + | err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
|
101 + | ) -> ::aws_smithy_runtime_api::client::result::SdkError<
|
102 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
103 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
104 + | > {
|
105 + | ::aws_smithy_runtime_api::client::result::SdkError::response_error(
|
106 + | err,
|
107 + | ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
|
108 + | ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
|
109 + | ::aws_smithy_types::body::SdkBody::empty(),
|
110 + | ),
|
111 + | )
|
112 + | }
|
113 + |
|
114 + | let message = output.stream.try_recv_initial_response().await.map_err(response_error)?;
|
115 + |
|
116 + | match message {
|
117 + | ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
|
118 + | ::std::option::Option::None => ::std::result::Result::Ok(output),
|
119 + | }
|
120 + | }
|
121 + |
|
122 + | /// Consumes this builder, creating a customizable operation that can be modified before being sent.
|
123 + | pub fn customize(
|
124 + | self,
|
125 + | ) -> crate::client::customize::CustomizableOperation<
|
126 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseOutput,
|
127 + | crate::operation::output_stream_with_initial_response::OutputStreamWithInitialResponseError,
|
128 + | Self,
|
129 + | > {
|
130 + | crate::client::customize::CustomizableOperation::new(self)
|
131 + | }
|
132 + | pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
|
133 + | self.set_config_override(::std::option::Option::Some(config_override.into()));
|
134 + | self
|
135 + | }
|
136 + |
|
137 + | pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
|
138 + | self.config_override = config_override;
|
139 + | self
|
140 + | }
|
141 + | }
|