aws_sdk_bedrockagentruntime/operation/create_session/
_create_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 CreateSessionOutput {
6    /// <p>The unique identifier for the session.</p>
7    pub session_id: ::std::string::String,
8    /// <p>The Amazon Resource Name (ARN) of the created 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    _request_id: Option<String>,
15}
16impl CreateSessionOutput {
17    /// <p>The unique identifier for the session.</p>
18    pub fn session_id(&self) -> &str {
19        use std::ops::Deref;
20        self.session_id.deref()
21    }
22    /// <p>The Amazon Resource Name (ARN) of the created session.</p>
23    pub fn session_arn(&self) -> &str {
24        use std::ops::Deref;
25        self.session_arn.deref()
26    }
27    /// <p>The current status of the session.</p>
28    pub fn session_status(&self) -> &crate::types::SessionStatus {
29        &self.session_status
30    }
31    /// <p>The timestamp for when the session was created.</p>
32    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
33        &self.created_at
34    }
35}
36impl ::aws_types::request_id::RequestId for CreateSessionOutput {
37    fn request_id(&self) -> Option<&str> {
38        self._request_id.as_deref()
39    }
40}
41impl CreateSessionOutput {
42    /// Creates a new builder-style object to manufacture [`CreateSessionOutput`](crate::operation::create_session::CreateSessionOutput).
43    pub fn builder() -> crate::operation::create_session::builders::CreateSessionOutputBuilder {
44        crate::operation::create_session::builders::CreateSessionOutputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateSessionOutput`](crate::operation::create_session::CreateSessionOutput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateSessionOutputBuilder {
52    pub(crate) session_id: ::std::option::Option<::std::string::String>,
53    pub(crate) session_arn: ::std::option::Option<::std::string::String>,
54    pub(crate) session_status: ::std::option::Option<crate::types::SessionStatus>,
55    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
56    _request_id: Option<String>,
57}
58impl CreateSessionOutputBuilder {
59    /// <p>The unique identifier for the session.</p>
60    /// This field is required.
61    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.session_id = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The unique identifier for the session.</p>
66    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.session_id = input;
68        self
69    }
70    /// <p>The unique identifier for the session.</p>
71    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
72        &self.session_id
73    }
74    /// <p>The Amazon Resource Name (ARN) of the created session.</p>
75    /// This field is required.
76    pub fn session_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.session_arn = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>The Amazon Resource Name (ARN) of the created session.</p>
81    pub fn set_session_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.session_arn = input;
83        self
84    }
85    /// <p>The Amazon Resource Name (ARN) of the created session.</p>
86    pub fn get_session_arn(&self) -> &::std::option::Option<::std::string::String> {
87        &self.session_arn
88    }
89    /// <p>The current status of the session.</p>
90    /// This field is required.
91    pub fn session_status(mut self, input: crate::types::SessionStatus) -> Self {
92        self.session_status = ::std::option::Option::Some(input);
93        self
94    }
95    /// <p>The current status of the session.</p>
96    pub fn set_session_status(mut self, input: ::std::option::Option<crate::types::SessionStatus>) -> Self {
97        self.session_status = input;
98        self
99    }
100    /// <p>The current status of the session.</p>
101    pub fn get_session_status(&self) -> &::std::option::Option<crate::types::SessionStatus> {
102        &self.session_status
103    }
104    /// <p>The timestamp for when the session was created.</p>
105    /// This field is required.
106    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
107        self.created_at = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The timestamp for when the session was created.</p>
111    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
112        self.created_at = input;
113        self
114    }
115    /// <p>The timestamp for when the session was created.</p>
116    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
117        &self.created_at
118    }
119    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
120        self._request_id = Some(request_id.into());
121        self
122    }
123
124    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
125        self._request_id = request_id;
126        self
127    }
128    /// Consumes the builder and constructs a [`CreateSessionOutput`](crate::operation::create_session::CreateSessionOutput).
129    /// This method will fail if any of the following fields are not set:
130    /// - [`session_id`](crate::operation::create_session::builders::CreateSessionOutputBuilder::session_id)
131    /// - [`session_arn`](crate::operation::create_session::builders::CreateSessionOutputBuilder::session_arn)
132    /// - [`session_status`](crate::operation::create_session::builders::CreateSessionOutputBuilder::session_status)
133    /// - [`created_at`](crate::operation::create_session::builders::CreateSessionOutputBuilder::created_at)
134    pub fn build(
135        self,
136    ) -> ::std::result::Result<crate::operation::create_session::CreateSessionOutput, ::aws_smithy_types::error::operation::BuildError> {
137        ::std::result::Result::Ok(crate::operation::create_session::CreateSessionOutput {
138            session_id: self.session_id.ok_or_else(|| {
139                ::aws_smithy_types::error::operation::BuildError::missing_field(
140                    "session_id",
141                    "session_id was not specified but it is required when building CreateSessionOutput",
142                )
143            })?,
144            session_arn: self.session_arn.ok_or_else(|| {
145                ::aws_smithy_types::error::operation::BuildError::missing_field(
146                    "session_arn",
147                    "session_arn was not specified but it is required when building CreateSessionOutput",
148                )
149            })?,
150            session_status: self.session_status.ok_or_else(|| {
151                ::aws_smithy_types::error::operation::BuildError::missing_field(
152                    "session_status",
153                    "session_status was not specified but it is required when building CreateSessionOutput",
154                )
155            })?,
156            created_at: self.created_at.ok_or_else(|| {
157                ::aws_smithy_types::error::operation::BuildError::missing_field(
158                    "created_at",
159                    "created_at was not specified but it is required when building CreateSessionOutput",
160                )
161            })?,
162            _request_id: self._request_id,
163        })
164    }
165}