aws_sdk_bedrockagentruntime/operation/get_session/
_get_session_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetSessionOutput {
6    /// <p>The unique identifier for the session in UUID format.</p>
7    pub session_id: ::std::string::String,
8    /// <p>The Amazon Resource Name (ARN) of the session.</p>
9    pub session_arn: ::std::string::String,
10    /// <p>The current status of the session.</p>
11    pub session_status: crate::types::SessionStatus,
12    /// <p>The timestamp for when the session was created.</p>
13    pub created_at: ::aws_smithy_types::DateTime,
14    /// <p>The timestamp for when the session was last modified.</p>
15    pub last_updated_at: ::aws_smithy_types::DateTime,
16    /// <p>A map of key-value pairs containing attributes persisted across the session.</p>
17    pub session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18    /// <p>The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
19    pub encryption_key_arn: ::std::option::Option<::std::string::String>,
20    _request_id: Option<String>,
21}
22impl GetSessionOutput {
23    /// <p>The unique identifier for the session in UUID format.</p>
24    pub fn session_id(&self) -> &str {
25        use std::ops::Deref;
26        self.session_id.deref()
27    }
28    /// <p>The Amazon Resource Name (ARN) of the session.</p>
29    pub fn session_arn(&self) -> &str {
30        use std::ops::Deref;
31        self.session_arn.deref()
32    }
33    /// <p>The current status of the session.</p>
34    pub fn session_status(&self) -> &crate::types::SessionStatus {
35        &self.session_status
36    }
37    /// <p>The timestamp for when the session was created.</p>
38    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
39        &self.created_at
40    }
41    /// <p>The timestamp for when the session was last modified.</p>
42    pub fn last_updated_at(&self) -> &::aws_smithy_types::DateTime {
43        &self.last_updated_at
44    }
45    /// <p>A map of key-value pairs containing attributes persisted across the session.</p>
46    pub fn session_metadata(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
47        self.session_metadata.as_ref()
48    }
49    /// <p>The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
50    pub fn encryption_key_arn(&self) -> ::std::option::Option<&str> {
51        self.encryption_key_arn.as_deref()
52    }
53}
54impl ::aws_types::request_id::RequestId for GetSessionOutput {
55    fn request_id(&self) -> Option<&str> {
56        self._request_id.as_deref()
57    }
58}
59impl GetSessionOutput {
60    /// Creates a new builder-style object to manufacture [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
61    pub fn builder() -> crate::operation::get_session::builders::GetSessionOutputBuilder {
62        crate::operation::get_session::builders::GetSessionOutputBuilder::default()
63    }
64}
65
66/// A builder for [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct GetSessionOutputBuilder {
70    pub(crate) session_id: ::std::option::Option<::std::string::String>,
71    pub(crate) session_arn: ::std::option::Option<::std::string::String>,
72    pub(crate) session_status: ::std::option::Option<crate::types::SessionStatus>,
73    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
74    pub(crate) last_updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
75    pub(crate) session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
76    pub(crate) encryption_key_arn: ::std::option::Option<::std::string::String>,
77    _request_id: Option<String>,
78}
79impl GetSessionOutputBuilder {
80    /// <p>The unique identifier for the session in UUID format.</p>
81    /// This field is required.
82    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.session_id = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>The unique identifier for the session in UUID format.</p>
87    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.session_id = input;
89        self
90    }
91    /// <p>The unique identifier for the session in UUID format.</p>
92    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
93        &self.session_id
94    }
95    /// <p>The Amazon Resource Name (ARN) of the session.</p>
96    /// This field is required.
97    pub fn session_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.session_arn = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The Amazon Resource Name (ARN) of the session.</p>
102    pub fn set_session_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.session_arn = input;
104        self
105    }
106    /// <p>The Amazon Resource Name (ARN) of the session.</p>
107    pub fn get_session_arn(&self) -> &::std::option::Option<::std::string::String> {
108        &self.session_arn
109    }
110    /// <p>The current status of the session.</p>
111    /// This field is required.
112    pub fn session_status(mut self, input: crate::types::SessionStatus) -> Self {
113        self.session_status = ::std::option::Option::Some(input);
114        self
115    }
116    /// <p>The current status of the session.</p>
117    pub fn set_session_status(mut self, input: ::std::option::Option<crate::types::SessionStatus>) -> Self {
118        self.session_status = input;
119        self
120    }
121    /// <p>The current status of the session.</p>
122    pub fn get_session_status(&self) -> &::std::option::Option<crate::types::SessionStatus> {
123        &self.session_status
124    }
125    /// <p>The timestamp for when the session was created.</p>
126    /// This field is required.
127    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
128        self.created_at = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>The timestamp for when the session was created.</p>
132    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
133        self.created_at = input;
134        self
135    }
136    /// <p>The timestamp for when the session was created.</p>
137    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
138        &self.created_at
139    }
140    /// <p>The timestamp for when the session was last modified.</p>
141    /// This field is required.
142    pub fn last_updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
143        self.last_updated_at = ::std::option::Option::Some(input);
144        self
145    }
146    /// <p>The timestamp for when the session was last modified.</p>
147    pub fn set_last_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
148        self.last_updated_at = input;
149        self
150    }
151    /// <p>The timestamp for when the session was last modified.</p>
152    pub fn get_last_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
153        &self.last_updated_at
154    }
155    /// Adds a key-value pair to `session_metadata`.
156    ///
157    /// To override the contents of this collection use [`set_session_metadata`](Self::set_session_metadata).
158    ///
159    /// <p>A map of key-value pairs containing attributes persisted across the session.</p>
160    pub fn session_metadata(
161        mut self,
162        k: impl ::std::convert::Into<::std::string::String>,
163        v: impl ::std::convert::Into<::std::string::String>,
164    ) -> Self {
165        let mut hash_map = self.session_metadata.unwrap_or_default();
166        hash_map.insert(k.into(), v.into());
167        self.session_metadata = ::std::option::Option::Some(hash_map);
168        self
169    }
170    /// <p>A map of key-value pairs containing attributes persisted across the session.</p>
171    pub fn set_session_metadata(
172        mut self,
173        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
174    ) -> Self {
175        self.session_metadata = input;
176        self
177    }
178    /// <p>A map of key-value pairs containing attributes persisted across the session.</p>
179    pub fn get_session_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
180        &self.session_metadata
181    }
182    /// <p>The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
183    pub fn encryption_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.encryption_key_arn = ::std::option::Option::Some(input.into());
185        self
186    }
187    /// <p>The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
188    pub fn set_encryption_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.encryption_key_arn = input;
190        self
191    }
192    /// <p>The Amazon Resource Name (ARN) of the Key Management Service key used to encrypt the session data. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/session-encryption.html">Amazon Bedrock session encryption</a>.</p>
193    pub fn get_encryption_key_arn(&self) -> &::std::option::Option<::std::string::String> {
194        &self.encryption_key_arn
195    }
196    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
197        self._request_id = Some(request_id.into());
198        self
199    }
200
201    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
202        self._request_id = request_id;
203        self
204    }
205    /// Consumes the builder and constructs a [`GetSessionOutput`](crate::operation::get_session::GetSessionOutput).
206    /// This method will fail if any of the following fields are not set:
207    /// - [`session_id`](crate::operation::get_session::builders::GetSessionOutputBuilder::session_id)
208    /// - [`session_arn`](crate::operation::get_session::builders::GetSessionOutputBuilder::session_arn)
209    /// - [`session_status`](crate::operation::get_session::builders::GetSessionOutputBuilder::session_status)
210    /// - [`created_at`](crate::operation::get_session::builders::GetSessionOutputBuilder::created_at)
211    /// - [`last_updated_at`](crate::operation::get_session::builders::GetSessionOutputBuilder::last_updated_at)
212    pub fn build(self) -> ::std::result::Result<crate::operation::get_session::GetSessionOutput, ::aws_smithy_types::error::operation::BuildError> {
213        ::std::result::Result::Ok(crate::operation::get_session::GetSessionOutput {
214            session_id: self.session_id.ok_or_else(|| {
215                ::aws_smithy_types::error::operation::BuildError::missing_field(
216                    "session_id",
217                    "session_id was not specified but it is required when building GetSessionOutput",
218                )
219            })?,
220            session_arn: self.session_arn.ok_or_else(|| {
221                ::aws_smithy_types::error::operation::BuildError::missing_field(
222                    "session_arn",
223                    "session_arn was not specified but it is required when building GetSessionOutput",
224                )
225            })?,
226            session_status: self.session_status.ok_or_else(|| {
227                ::aws_smithy_types::error::operation::BuildError::missing_field(
228                    "session_status",
229                    "session_status was not specified but it is required when building GetSessionOutput",
230                )
231            })?,
232            created_at: self.created_at.ok_or_else(|| {
233                ::aws_smithy_types::error::operation::BuildError::missing_field(
234                    "created_at",
235                    "created_at was not specified but it is required when building GetSessionOutput",
236                )
237            })?,
238            last_updated_at: self.last_updated_at.ok_or_else(|| {
239                ::aws_smithy_types::error::operation::BuildError::missing_field(
240                    "last_updated_at",
241                    "last_updated_at was not specified but it is required when building GetSessionOutput",
242                )
243            })?,
244            session_metadata: self.session_metadata,
245            encryption_key_arn: self.encryption_key_arn,
246            _request_id: self._request_id,
247        })
248    }
249}