aws_sdk_gameliftstreams/operation/create_stream_session_connection/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_stream_session_connection::_create_stream_session_connection_output::CreateStreamSessionConnectionOutputBuilder;
3
4pub use crate::operation::create_stream_session_connection::_create_stream_session_connection_input::CreateStreamSessionConnectionInputBuilder;
5
6impl crate::operation::create_stream_session_connection::builders::CreateStreamSessionConnectionInputBuilder {
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::create_stream_session_connection::CreateStreamSessionConnectionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_stream_session_connection::CreateStreamSessionConnectionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_stream_session_connection();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateStreamSessionConnection`.
24///
25/// <p>Enables clients to reconnect to a stream session while preserving all session state and data in the disconnected session. This reconnection process can be initiated when a stream session is in either <code>PENDING_CLIENT_RECONNECTION</code> or <code>ACTIVE</code> status. The process works as follows:</p>
26/// <ol>
27/// <li>
28/// <p>Initial disconnect:</p>
29/// <ul>
30/// <li>
31/// <p>When a client disconnects or loses connection, the stream session transitions from <code>CONNECTED</code> to <code>PENDING_CLIENT_RECONNECTION</code></p></li>
32/// </ul></li>
33/// <li>
34/// <p>Reconnection time window:</p>
35/// <ul>
36/// <li>
37/// <p>Clients have <code>ConnectionTimeoutSeconds</code> (defined in <a href="https://docs.aws.amazon.com/gameliftstreams/latest/apireference/API_StartStreamSession.html">StartStreamSession</a>) to reconnect before session termination</p></li>
38/// <li>
39/// <p>Your backend server must call <b>CreateStreamSessionConnection</b> to initiate reconnection</p></li>
40/// <li>
41/// <p>Session transitions to <code>RECONNECTING</code> status</p></li>
42/// </ul></li>
43/// <li>
44/// <p>Reconnection completion:</p>
45/// <ul>
46/// <li>
47/// <p>On successful <b>CreateStreamSessionConnection</b>, session status changes to <code>ACTIVE</code></p></li>
48/// <li>
49/// <p>Provide the new connection information to the requesting client</p></li>
50/// <li>
51/// <p>Client must establish connection within <code>ConnectionTimeoutSeconds</code></p></li>
52/// <li>
53/// <p>Session terminates automatically if client fails to connect in time</p></li>
54/// </ul></li>
55/// </ol>
56/// <p>For more information about the stream session lifecycle, see <a href="https://docs.aws.amazon.com/gameliftstreams/latest/developerguide/stream-sessions.html">Stream sessions</a> in the <i>Amazon GameLift Streams Developer Guide</i>.</p>
57/// <p>To begin re-connecting to an existing stream session, specify the stream group ID and stream session ID that you want to reconnect to, and the signal request to use with the stream.</p>
58#[derive(::std::clone::Clone, ::std::fmt::Debug)]
59pub struct CreateStreamSessionConnectionFluentBuilder {
60    handle: ::std::sync::Arc<crate::client::Handle>,
61    inner: crate::operation::create_stream_session_connection::builders::CreateStreamSessionConnectionInputBuilder,
62    config_override: ::std::option::Option<crate::config::Builder>,
63}
64impl
65    crate::client::customize::internal::CustomizableSend<
66        crate::operation::create_stream_session_connection::CreateStreamSessionConnectionOutput,
67        crate::operation::create_stream_session_connection::CreateStreamSessionConnectionError,
68    > for CreateStreamSessionConnectionFluentBuilder
69{
70    fn send(
71        self,
72        config_override: crate::config::Builder,
73    ) -> crate::client::customize::internal::BoxFuture<
74        crate::client::customize::internal::SendResult<
75            crate::operation::create_stream_session_connection::CreateStreamSessionConnectionOutput,
76            crate::operation::create_stream_session_connection::CreateStreamSessionConnectionError,
77        >,
78    > {
79        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
80    }
81}
82impl CreateStreamSessionConnectionFluentBuilder {
83    /// Creates a new `CreateStreamSessionConnectionFluentBuilder`.
84    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
85        Self {
86            handle,
87            inner: ::std::default::Default::default(),
88            config_override: ::std::option::Option::None,
89        }
90    }
91    /// Access the CreateStreamSessionConnection as a reference.
92    pub fn as_input(&self) -> &crate::operation::create_stream_session_connection::builders::CreateStreamSessionConnectionInputBuilder {
93        &self.inner
94    }
95    /// Sends the request and returns the response.
96    ///
97    /// If an error occurs, an `SdkError` will be returned with additional details that
98    /// can be matched against.
99    ///
100    /// By default, any retryable failures will be retried twice. Retry behavior
101    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
102    /// set when configuring the client.
103    pub async fn send(
104        self,
105    ) -> ::std::result::Result<
106        crate::operation::create_stream_session_connection::CreateStreamSessionConnectionOutput,
107        ::aws_smithy_runtime_api::client::result::SdkError<
108            crate::operation::create_stream_session_connection::CreateStreamSessionConnectionError,
109            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
110        >,
111    > {
112        let input = self
113            .inner
114            .build()
115            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
116        let runtime_plugins = crate::operation::create_stream_session_connection::CreateStreamSessionConnection::operation_runtime_plugins(
117            self.handle.runtime_plugins.clone(),
118            &self.handle.conf,
119            self.config_override,
120        );
121        crate::operation::create_stream_session_connection::CreateStreamSessionConnection::orchestrate(&runtime_plugins, input).await
122    }
123
124    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
125    pub fn customize(
126        self,
127    ) -> crate::client::customize::CustomizableOperation<
128        crate::operation::create_stream_session_connection::CreateStreamSessionConnectionOutput,
129        crate::operation::create_stream_session_connection::CreateStreamSessionConnectionError,
130        Self,
131    > {
132        crate::client::customize::CustomizableOperation::new(self)
133    }
134    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
135        self.set_config_override(::std::option::Option::Some(config_override.into()));
136        self
137    }
138
139    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
140        self.config_override = config_override;
141        self
142    }
143    /// <p>A unique identifier that represents a client request. The request is idempotent, which ensures that an API request completes only once. When users send a request, Amazon GameLift Streams automatically populates this field.</p>
144    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.client_token(input.into());
146        self
147    }
148    /// <p>A unique identifier that represents a client request. The request is idempotent, which ensures that an API request completes only once. When users send a request, Amazon GameLift Streams automatically populates this field.</p>
149    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_client_token(input);
151        self
152    }
153    /// <p>A unique identifier that represents a client request. The request is idempotent, which ensures that an API request completes only once. When users send a request, Amazon GameLift Streams automatically populates this field.</p>
154    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_client_token()
156    }
157    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
158    /// <p>The stream group that you want to run this stream session with. The stream group must be in <code>ACTIVE</code> status.</p>
159    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.identifier(input.into());
161        self
162    }
163    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
164    /// <p>The stream group that you want to run this stream session with. The stream group must be in <code>ACTIVE</code> status.</p>
165    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_identifier(input);
167        self
168    }
169    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>.</p>
170    /// <p>The stream group that you want to run this stream session with. The stream group must be in <code>ACTIVE</code> status.</p>
171    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_identifier()
173    }
174    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream session resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamsession/sg-1AB2C3De4/ABC123def4567</code>. Example ID: <code>ABC123def4567</code>.</p>
175    /// <p>The stream session must be in <code>PENDING_CLIENT_RECONNECTION</code> or <code>ACTIVE</code> status.</p>
176    pub fn stream_session_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177        self.inner = self.inner.stream_session_identifier(input.into());
178        self
179    }
180    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream session resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamsession/sg-1AB2C3De4/ABC123def4567</code>. Example ID: <code>ABC123def4567</code>.</p>
181    /// <p>The stream session must be in <code>PENDING_CLIENT_RECONNECTION</code> or <code>ACTIVE</code> status.</p>
182    pub fn set_stream_session_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_stream_session_identifier(input);
184        self
185    }
186    /// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream session resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamsession/sg-1AB2C3De4/ABC123def4567</code>. Example ID: <code>ABC123def4567</code>.</p>
187    /// <p>The stream session must be in <code>PENDING_CLIENT_RECONNECTION</code> or <code>ACTIVE</code> status.</p>
188    pub fn get_stream_session_identifier(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_stream_session_identifier()
190    }
191    /// <p>A WebRTC ICE offer string to use when initializing a WebRTC connection. The offer is a very long JSON string. Provide the string as a text value in quotes. The offer must be newly generated, not the same offer provided to <code>StartStreamSession</code>.</p>
192    pub fn signal_request(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.inner = self.inner.signal_request(input.into());
194        self
195    }
196    /// <p>A WebRTC ICE offer string to use when initializing a WebRTC connection. The offer is a very long JSON string. Provide the string as a text value in quotes. The offer must be newly generated, not the same offer provided to <code>StartStreamSession</code>.</p>
197    pub fn set_signal_request(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198        self.inner = self.inner.set_signal_request(input);
199        self
200    }
201    /// <p>A WebRTC ICE offer string to use when initializing a WebRTC connection. The offer is a very long JSON string. Provide the string as a text value in quotes. The offer must be newly generated, not the same offer provided to <code>StartStreamSession</code>.</p>
202    pub fn get_signal_request(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_signal_request()
204    }
205}