aws_sdk_bedrockagentruntime/operation/get_session/
_get_session_output.rs1#[allow(missing_docs)] #[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetSessionOutput {
6 pub session_id: ::std::string::String,
8 pub session_arn: ::std::string::String,
10 pub session_status: crate::types::SessionStatus,
12 pub created_at: ::aws_smithy_types::DateTime,
14 pub last_updated_at: ::aws_smithy_types::DateTime,
16 pub session_metadata: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
18 pub encryption_key_arn: ::std::option::Option<::std::string::String>,
20 _request_id: Option<String>,
21}
22impl GetSessionOutput {
23 pub fn session_id(&self) -> &str {
25 use std::ops::Deref;
26 self.session_id.deref()
27 }
28 pub fn session_arn(&self) -> &str {
30 use std::ops::Deref;
31 self.session_arn.deref()
32 }
33 pub fn session_status(&self) -> &crate::types::SessionStatus {
35 &self.session_status
36 }
37 pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
39 &self.created_at
40 }
41 pub fn last_updated_at(&self) -> &::aws_smithy_types::DateTime {
43 &self.last_updated_at
44 }
45 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 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 pub fn builder() -> crate::operation::get_session::builders::GetSessionOutputBuilder {
62 crate::operation::get_session::builders::GetSessionOutputBuilder::default()
63 }
64}
65
66#[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 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 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88 self.session_id = input;
89 self
90 }
91 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
93 &self.session_id
94 }
95 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 pub fn set_session_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103 self.session_arn = input;
104 self
105 }
106 pub fn get_session_arn(&self) -> &::std::option::Option<::std::string::String> {
108 &self.session_arn
109 }
110 pub fn session_status(mut self, input: crate::types::SessionStatus) -> Self {
113 self.session_status = ::std::option::Option::Some(input);
114 self
115 }
116 pub fn set_session_status(mut self, input: ::std::option::Option<crate::types::SessionStatus>) -> Self {
118 self.session_status = input;
119 self
120 }
121 pub fn get_session_status(&self) -> &::std::option::Option<crate::types::SessionStatus> {
123 &self.session_status
124 }
125 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 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 pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
138 &self.created_at
139 }
140 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 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 pub fn get_last_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
153 &self.last_updated_at
154 }
155 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 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 pub fn get_session_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
180 &self.session_metadata
181 }
182 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 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 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 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}