Skip to main content

aws_sdk_emrserverless/operation/start_session/
_start_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 StartSessionOutput {
6    /// <p>The output contains the application ID on which the session was started.</p>
7    pub application_id: ::std::string::String,
8    /// <p>The output contains the ID of the session.</p>
9    pub session_id: ::std::string::String,
10    /// <p>The output contains the ARN of the session.</p>
11    pub arn: ::std::string::String,
12    _request_id: Option<String>,
13}
14impl StartSessionOutput {
15    /// <p>The output contains the application ID on which the session was started.</p>
16    pub fn application_id(&self) -> &str {
17        use std::ops::Deref;
18        self.application_id.deref()
19    }
20    /// <p>The output contains the ID of the session.</p>
21    pub fn session_id(&self) -> &str {
22        use std::ops::Deref;
23        self.session_id.deref()
24    }
25    /// <p>The output contains the ARN of the session.</p>
26    pub fn arn(&self) -> &str {
27        use std::ops::Deref;
28        self.arn.deref()
29    }
30}
31impl ::aws_types::request_id::RequestId for StartSessionOutput {
32    fn request_id(&self) -> Option<&str> {
33        self._request_id.as_deref()
34    }
35}
36impl StartSessionOutput {
37    /// Creates a new builder-style object to manufacture [`StartSessionOutput`](crate::operation::start_session::StartSessionOutput).
38    pub fn builder() -> crate::operation::start_session::builders::StartSessionOutputBuilder {
39        crate::operation::start_session::builders::StartSessionOutputBuilder::default()
40    }
41}
42
43/// A builder for [`StartSessionOutput`](crate::operation::start_session::StartSessionOutput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct StartSessionOutputBuilder {
47    pub(crate) application_id: ::std::option::Option<::std::string::String>,
48    pub(crate) session_id: ::std::option::Option<::std::string::String>,
49    pub(crate) arn: ::std::option::Option<::std::string::String>,
50    _request_id: Option<String>,
51}
52impl StartSessionOutputBuilder {
53    /// <p>The output contains the application ID on which the session was started.</p>
54    /// This field is required.
55    pub fn application_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.application_id = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The output contains the application ID on which the session was started.</p>
60    pub fn set_application_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.application_id = input;
62        self
63    }
64    /// <p>The output contains the application ID on which the session was started.</p>
65    pub fn get_application_id(&self) -> &::std::option::Option<::std::string::String> {
66        &self.application_id
67    }
68    /// <p>The output contains the ID of the session.</p>
69    /// This field is required.
70    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.session_id = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The output contains the ID of the session.</p>
75    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.session_id = input;
77        self
78    }
79    /// <p>The output contains the ID of the session.</p>
80    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
81        &self.session_id
82    }
83    /// <p>The output contains the ARN of the session.</p>
84    /// This field is required.
85    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.arn = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>The output contains the ARN of the session.</p>
90    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.arn = input;
92        self
93    }
94    /// <p>The output contains the ARN of the session.</p>
95    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
96        &self.arn
97    }
98    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
99        self._request_id = Some(request_id.into());
100        self
101    }
102
103    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
104        self._request_id = request_id;
105        self
106    }
107    /// Consumes the builder and constructs a [`StartSessionOutput`](crate::operation::start_session::StartSessionOutput).
108    /// This method will fail if any of the following fields are not set:
109    /// - [`application_id`](crate::operation::start_session::builders::StartSessionOutputBuilder::application_id)
110    /// - [`session_id`](crate::operation::start_session::builders::StartSessionOutputBuilder::session_id)
111    /// - [`arn`](crate::operation::start_session::builders::StartSessionOutputBuilder::arn)
112    pub fn build(
113        self,
114    ) -> ::std::result::Result<crate::operation::start_session::StartSessionOutput, ::aws_smithy_types::error::operation::BuildError> {
115        ::std::result::Result::Ok(crate::operation::start_session::StartSessionOutput {
116            application_id: self.application_id.ok_or_else(|| {
117                ::aws_smithy_types::error::operation::BuildError::missing_field(
118                    "application_id",
119                    "application_id was not specified but it is required when building StartSessionOutput",
120                )
121            })?,
122            session_id: self.session_id.ok_or_else(|| {
123                ::aws_smithy_types::error::operation::BuildError::missing_field(
124                    "session_id",
125                    "session_id was not specified but it is required when building StartSessionOutput",
126                )
127            })?,
128            arn: self.arn.ok_or_else(|| {
129                ::aws_smithy_types::error::operation::BuildError::missing_field(
130                    "arn",
131                    "arn was not specified but it is required when building StartSessionOutput",
132                )
133            })?,
134            _request_id: self._request_id,
135        })
136    }
137}