// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct StartSessionInput {
/// <p>The managed node to connect to for the session.</p>
pub target: ::std::option::Option<::std::string::String>,
/// <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>
pub document_name: ::std::option::Option<::std::string::String>,
/// <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>
pub reason: ::std::option::Option<::std::string::String>,
/// <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>
pub parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
}
impl StartSessionInput {
/// <p>The managed node to connect to for the session.</p>
pub fn target(&self) -> ::std::option::Option<&str> {
self.target.as_deref()
}
/// <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>
pub fn document_name(&self) -> ::std::option::Option<&str> {
self.document_name.as_deref()
}
/// <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>
pub fn reason(&self) -> ::std::option::Option<&str> {
self.reason.as_deref()
}
/// <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>
pub fn parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>> {
self.parameters.as_ref()
}
}
static STARTSESSIONINPUT_MEMBER_TARGET: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm.synthetic#StartSessionInput$Target",
"com.amazonaws.ssm.synthetic",
"StartSessionInput",
),
::aws_smithy_schema::ShapeType::String,
"Target",
0,
);
static STARTSESSIONINPUT_MEMBER_DOCUMENT_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm.synthetic#StartSessionInput$DocumentName",
"com.amazonaws.ssm.synthetic",
"StartSessionInput",
),
::aws_smithy_schema::ShapeType::String,
"DocumentName",
1,
);
static STARTSESSIONINPUT_MEMBER_REASON: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm.synthetic#StartSessionInput$Reason",
"com.amazonaws.ssm.synthetic",
"StartSessionInput",
),
::aws_smithy_schema::ShapeType::String,
"Reason",
2,
);
static STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm#SessionManagerParameterValueList$member",
"com.amazonaws.ssm",
"SessionManagerParameterValueList",
),
::aws_smithy_schema::ShapeType::String,
"member",
0,
);
static STARTSESSIONINPUT_MEMBER_PARAMETERS_KEY: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm#SessionManagerParameters$key",
"com.amazonaws.ssm",
"SessionManagerParameters",
),
::aws_smithy_schema::ShapeType::String,
"key",
0,
);
static STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm#SessionManagerParameters$value",
"com.amazonaws.ssm",
"SessionManagerParameters",
),
::aws_smithy_schema::ShapeType::List,
"value",
1,
)
.with_list_member(&STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE_MEMBER);
static STARTSESSIONINPUT_MEMBER_PARAMETERS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm.synthetic#StartSessionInput$Parameters",
"com.amazonaws.ssm.synthetic",
"StartSessionInput",
),
::aws_smithy_schema::ShapeType::Map,
"Parameters",
3,
)
.with_map_members(&STARTSESSIONINPUT_MEMBER_PARAMETERS_KEY, &STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE);
static STARTSESSIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
::aws_smithy_schema::ShapeId::from_parts(
"com.amazonaws.ssm.synthetic#StartSessionInput",
"com.amazonaws.ssm.synthetic",
"StartSessionInput",
),
::aws_smithy_schema::ShapeType::Structure,
&[
&STARTSESSIONINPUT_MEMBER_TARGET,
&STARTSESSIONINPUT_MEMBER_DOCUMENT_NAME,
&STARTSESSIONINPUT_MEMBER_REASON,
&STARTSESSIONINPUT_MEMBER_PARAMETERS,
],
)
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("StartSessionRequest");
impl StartSessionInput {
/// The schema for this shape.
pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &STARTSESSIONINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for StartSessionInput {
fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
Self::SCHEMA
}
#[allow(unused_variables, clippy::diverging_sub_expression)]
fn serialize_members(
&self,
ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
if let Some(ref val) = self.target {
ser.write_string(&STARTSESSIONINPUT_MEMBER_TARGET, val)?;
}
if let Some(ref val) = self.document_name {
ser.write_string(&STARTSESSIONINPUT_MEMBER_DOCUMENT_NAME, val)?;
}
if let Some(ref val) = self.reason {
ser.write_string(&STARTSESSIONINPUT_MEMBER_REASON, val)?;
}
if let Some(ref val) = self.parameters {
ser.write_map(
&STARTSESSIONINPUT_MEMBER_PARAMETERS,
&|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
for (key, value) in val {
ser.write_string(&::aws_smithy_schema::prelude::STRING, key)?;
ser.write_list(
&STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE,
&|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
for item in value {
ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
}
Ok(())
},
)?;
}
Ok(())
},
)?;
}
Ok(())
}
}
impl crate::operation::start_session::builders::StartSessionInputBuilder {
#[allow(
unused_variables,
unreachable_code,
clippy::single_match,
clippy::match_single_binding,
clippy::diverging_sub_expression
)]
pub(crate) fn deserialize_members(
&mut self,
deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
deserializer.read_struct(&STARTSESSIONINPUT_SCHEMA, &mut |member, deser| {
match member.member_index() {
Some(0) => {
if deser.is_null() {
deser.read_null()?;
} else {
self.target = Some(deser.read_string(member)?);
}
}
Some(1) => {
if deser.is_null() {
deser.read_null()?;
} else {
self.document_name = Some(deser.read_string(member)?);
}
}
Some(2) => {
if deser.is_null() {
deser.read_null()?;
} else {
self.reason = Some(deser.read_string(member)?);
}
}
Some(3) => {
if deser.is_null() {
deser.read_null()?;
} else {
self.parameters = Some({
let mut container = std::collections::HashMap::new();
deser.read_map(member, &mut |key, deser| {
container.insert(key, {
let mut list = Vec::new();
deser.read_list(&STARTSESSIONINPUT_MEMBER_PARAMETERS_VALUE, &mut |deser| {
list.push(deser.read_string(&::aws_smithy_schema::prelude::STRING)?);
Ok(())
})?;
list
});
Ok(())
})?;
container
});
}
}
_ => {}
}
Ok(())
})
}
}
impl StartSessionInput {
/// Deserializes this structure from a [`ShapeDeserializer`].
pub fn deserialize(
deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
let mut builder = Self::builder();
builder.deserialize_members(deserializer)?;
builder.target = builder.target.or(Some(String::new()));
builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
}
}
impl StartSessionInput {
/// Creates a new builder-style object to manufacture [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
pub fn builder() -> crate::operation::start_session::builders::StartSessionInputBuilder {
crate::operation::start_session::builders::StartSessionInputBuilder::default()
}
}
/// A builder for [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StartSessionInputBuilder {
pub(crate) target: ::std::option::Option<::std::string::String>,
pub(crate) document_name: ::std::option::Option<::std::string::String>,
pub(crate) reason: ::std::option::Option<::std::string::String>,
pub(crate) parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
}
impl StartSessionInputBuilder {
/// <p>The managed node to connect to for the session.</p>
/// This field is required.
pub fn target(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.target = ::std::option::Option::Some(input.into());
self
}
/// <p>The managed node to connect to for the session.</p>
pub fn set_target(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.target = input;
self
}
/// <p>The managed node to connect to for the session.</p>
pub fn get_target(&self) -> &::std::option::Option<::std::string::String> {
&self.target
}
/// <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>
pub fn document_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.document_name = ::std::option::Option::Some(input.into());
self
}
/// <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>
pub fn set_document_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.document_name = input;
self
}
/// <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>
pub fn get_document_name(&self) -> &::std::option::Option<::std::string::String> {
&self.document_name
}
/// <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>
pub fn reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.reason = ::std::option::Option::Some(input.into());
self
}
/// <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>
pub fn set_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.reason = input;
self
}
/// <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>
pub fn get_reason(&self) -> &::std::option::Option<::std::string::String> {
&self.reason
}
/// Adds a key-value pair to `parameters`.
///
/// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
///
/// <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>
pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::std::vec::Vec<::std::string::String>) -> Self {
let mut hash_map = self.parameters.unwrap_or_default();
hash_map.insert(k.into(), v);
self.parameters = ::std::option::Option::Some(hash_map);
self
}
/// <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>
pub fn set_parameters(
mut self,
input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>>,
) -> Self {
self.parameters = input;
self
}
/// <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>
pub fn get_parameters(
&self,
) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<::std::string::String>>> {
&self.parameters
}
/// Consumes the builder and constructs a [`StartSessionInput`](crate::operation::start_session::StartSessionInput).
pub fn build(
self,
) -> ::std::result::Result<crate::operation::start_session::StartSessionInput, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::operation::start_session::StartSessionInput {
target: self.target,
document_name: self.document_name,
reason: self.reason,
parameters: self.parameters,
})
}
}