aws_sdk_ssm/operation/start_session/_start_session_input.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 StartSessionInput {
6 /// <p>The managed node to connect to for the session.</p>
7 pub target: ::std::option::Option<::std::string::String>,
8 /// <p>The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, <code>SSM-SessionManagerRunShell</code>. You can call the <code>GetDocument</code> API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html">Start a session</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
9 pub document_name: ::std::option::Option<::std::string::String>,
10 /// <p>The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.</p>
11 pub reason: ::std::option::Option<::std::string::String>,
12 /// <p>The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html">Create a Session Manager preferences document</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
13 pub parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
14}
15impl StartSessionInput {
16 /// <p>The managed node to connect to for the session.</p>
17 pub fn target(&self) -> ::std::option::Option<&str> {
18 self.target.as_deref()
19 }
20 /// <p>The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, <code>SSM-SessionManagerRunShell</code>. You can call the <code>GetDocument</code> API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html">Start a session</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
21 pub fn document_name(&self) -> ::std::option::Option<&str> {
22 self.document_name.as_deref()
23 }
24 /// <p>The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.</p>
25 pub fn reason(&self) -> ::std::option::Option<&str> {
26 self.reason.as_deref()
27 }
28 /// <p>The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html">Create a Session Manager preferences document</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
29 pub fn parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>> {
30 self.parameters.as_ref()
31 }
32}
33impl StartSessionInput {
34 /// Creates a new builder-style object to manufacture [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
35 pub fn builder() -> crate::operation::start_session::builders::StartSessionInputBuilder {
36 crate::operation::start_session::builders::StartSessionInputBuilder::default()
37 }
38}
39
40/// A builder for [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct StartSessionInputBuilder {
44 pub(crate) target: ::std::option::Option<::std::string::String>,
45 pub(crate) document_name: ::std::option::Option<::std::string::String>,
46 pub(crate) reason: ::std::option::Option<::std::string::String>,
47 pub(crate) parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
48}
49impl StartSessionInputBuilder {
50 /// <p>The managed node to connect to for the session.</p>
51 /// This field is required.
52 pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
53 self.target = ::std::option::Option::Some(input.into());
54 self
55 }
56 /// <p>The managed node to connect to for the session.</p>
57 pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
58 self.target = input;
59 self
60 }
61 /// <p>The managed node to connect to for the session.</p>
62 pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
63 &self.target
64 }
65 /// <p>The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, <code>SSM-SessionManagerRunShell</code>. You can call the <code>GetDocument</code> API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html">Start a session</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
66 pub fn document_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
67 self.document_name = ::std::option::Option::Some(input.into());
68 self
69 }
70 /// <p>The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, <code>SSM-SessionManagerRunShell</code>. You can call the <code>GetDocument</code> API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html">Start a session</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
71 pub fn set_document_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
72 self.document_name = input;
73 self
74 }
75 /// <p>The name of the SSM document you want to use to define the type of session, input parameters, or preferences for the session. For example, <code>SSM-SessionManagerRunShell</code>. You can call the <code>GetDocument</code> API to verify the document exists before attempting to start a session. If no document name is provided, a shell to the managed node is launched by default. For more information, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html">Start a session</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
76 pub fn get_document_name(&self) -> &::std::option::Option<::std::string::String> {
77 &self.document_name
78 }
79 /// <p>The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.</p>
80 pub fn reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81 self.reason = ::std::option::Option::Some(input.into());
82 self
83 }
84 /// <p>The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.</p>
85 pub fn set_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86 self.reason = input;
87 self
88 }
89 /// <p>The reason for connecting to the instance. This value is included in the details for the Amazon CloudWatch Events event created when you start the session.</p>
90 pub fn get_reason(&self) -> &::std::option::Option<::std::string::String> {
91 &self.reason
92 }
93 /// Adds a key-value pair to `parameters`.
94 ///
95 /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
96 ///
97 /// <p>The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html">Create a Session Manager preferences document</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
98 pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::std::vec::Vec<::std::string::String>) -> Self {
99 let mut hash_map = self.parameters.unwrap_or_default();
100 hash_map.insert(k.into(), v);
101 self.parameters = ::std::option::Option::Some(hash_map);
102 self
103 }
104 /// <p>The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html">Create a Session Manager preferences document</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
105 pub fn set_parameters(
106 mut self,
107 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
108 ) -> Self {
109 self.parameters = input;
110 self
111 }
112 /// <p>The values you want to specify for the parameters defined in the Session document. For more information about these parameters, see <a href="https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-create-preferences-cli.html">Create a Session Manager preferences document</a> in the <i>Amazon Web Services Systems Manager User Guide</i>.</p>
113 pub fn get_parameters(
114 &self,
115 ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>> {
116 &self.parameters
117 }
118 /// Consumes the builder and constructs a [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
119 pub fn build(
120 self,
121 ) -> ::std::result::Result<crate::operation::start_session::StartSessionInput, ::aws_smithy_types::error::operation::BuildError> {
122 ::std::result::Result::Ok(crate::operation::start_session::StartSessionInput {
123 target: self.target,
124 document_name: self.document_name,
125 reason: self.reason,
126 parameters: self.parameters,
127 })
128 }
129}