aws-sdk-ssm 1.131.0

AWS SDK for Amazon Simple Systems Manager (SSM)
Documentation
// 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 StartAccessRequestInput {
    /// <p>A brief description explaining why you are requesting access to the node.</p>
    pub reason: ::std::option::Option<::std::string::String>,
    /// <p>The node you are requesting access to.</p>
    pub targets: ::std::option::Option<::std::vec::Vec<crate::types::Target>>,
    /// <p>Key-value pairs of metadata you want to assign to the access request.</p>
    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl StartAccessRequestInput {
    /// <p>A brief description explaining why you are requesting access to the node.</p>
    pub fn reason(&self) -> ::std::option::Option<&str> {
        self.reason.as_deref()
    }
    /// <p>The node you are requesting access to.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.targets.is_none()`.
    pub fn targets(&self) -> &[crate::types::Target] {
        self.targets.as_deref().unwrap_or_default()
    }
    /// <p>Key-value pairs of metadata you want to assign to the access request.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
    pub fn tags(&self) -> &[crate::types::Tag] {
        self.tags.as_deref().unwrap_or_default()
    }
}
static STARTACCESSREQUESTINPUT_MEMBER_REASON: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StartAccessRequestInput$Reason",
        "com.amazonaws.ssm.synthetic",
        "StartAccessRequestInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Reason",
    0,
);
static STARTACCESSREQUESTINPUT_MEMBER_TARGETS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#Targets$member", "com.amazonaws.ssm", "Targets"),
    ::aws_smithy_schema::ShapeType::Structure,
    "member",
    0,
);
static STARTACCESSREQUESTINPUT_MEMBER_TARGETS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StartAccessRequestInput$Targets",
        "com.amazonaws.ssm.synthetic",
        "StartAccessRequestInput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Targets",
    1,
)
.with_list_member(&STARTACCESSREQUESTINPUT_MEMBER_TARGETS_MEMBER);
static STARTACCESSREQUESTINPUT_MEMBER_TAGS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#TagList$member", "com.amazonaws.ssm", "TagList"),
    ::aws_smithy_schema::ShapeType::Structure,
    "member",
    0,
);
static STARTACCESSREQUESTINPUT_MEMBER_TAGS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StartAccessRequestInput$Tags",
        "com.amazonaws.ssm.synthetic",
        "StartAccessRequestInput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Tags",
    2,
)
.with_list_member(&STARTACCESSREQUESTINPUT_MEMBER_TAGS_MEMBER);
static STARTACCESSREQUESTINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#StartAccessRequestInput",
        "com.amazonaws.ssm.synthetic",
        "StartAccessRequestInput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &STARTACCESSREQUESTINPUT_MEMBER_REASON,
        &STARTACCESSREQUESTINPUT_MEMBER_TARGETS,
        &STARTACCESSREQUESTINPUT_MEMBER_TAGS,
    ],
)
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("StartAccessRequestRequest");
impl StartAccessRequestInput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &STARTACCESSREQUESTINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for StartAccessRequestInput {
    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.reason {
            ser.write_string(&STARTACCESSREQUESTINPUT_MEMBER_REASON, val)?;
        }
        if let Some(ref val) = self.targets {
            ser.write_list(
                &STARTACCESSREQUESTINPUT_MEMBER_TARGETS,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::Target::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        if let Some(ref val) = self.tags {
            ser.write_list(
                &STARTACCESSREQUESTINPUT_MEMBER_TAGS,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::Tag::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        Ok(())
    }
}
impl crate::operation::start_access_request::builders::StartAccessRequestInputBuilder {
    #[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(&STARTACCESSREQUESTINPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.reason = Some(deser.read_string(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.targets = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::Target::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.tags = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::Tag::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl StartAccessRequestInput {
    /// 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.reason = builder.reason.or(Some(String::new()));
        builder.targets = builder.targets.or(Some(Vec::new()));
        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
    }
}
impl StartAccessRequestInput {
    /// Creates a new builder-style object to manufacture [`StartAccessRequestInput`](crate::operation::start_access_request::StartAccessRequestInput).
    pub fn builder() -> crate::operation::start_access_request::builders::StartAccessRequestInputBuilder {
        crate::operation::start_access_request::builders::StartAccessRequestInputBuilder::default()
    }
}

/// A builder for [`StartAccessRequestInput`](crate::operation::start_access_request::StartAccessRequestInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct StartAccessRequestInputBuilder {
    pub(crate) reason: ::std::option::Option<::std::string::String>,
    pub(crate) targets: ::std::option::Option<::std::vec::Vec<crate::types::Target>>,
    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
}
impl StartAccessRequestInputBuilder {
    /// <p>A brief description explaining why you are requesting access to the node.</p>
    /// This field is required.
    pub fn reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.reason = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A brief description explaining why you are requesting access to the node.</p>
    pub fn set_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.reason = input;
        self
    }
    /// <p>A brief description explaining why you are requesting access to the node.</p>
    pub fn get_reason(&self) -> &::std::option::Option<::std::string::String> {
        &self.reason
    }
    /// Appends an item to `targets`.
    ///
    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
    ///
    /// <p>The node you are requesting access to.</p>
    pub fn targets(mut self, input: crate::types::Target) -> Self {
        let mut v = self.targets.unwrap_or_default();
        v.push(input);
        self.targets = ::std::option::Option::Some(v);
        self
    }
    /// <p>The node you are requesting access to.</p>
    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Target>>) -> Self {
        self.targets = input;
        self
    }
    /// <p>The node you are requesting access to.</p>
    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Target>> {
        &self.targets
    }
    /// Appends an item to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>Key-value pairs of metadata you want to assign to the access request.</p>
    pub fn tags(mut self, input: crate::types::Tag) -> Self {
        let mut v = self.tags.unwrap_or_default();
        v.push(input);
        self.tags = ::std::option::Option::Some(v);
        self
    }
    /// <p>Key-value pairs of metadata you want to assign to the access request.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.tags = input;
        self
    }
    /// <p>Key-value pairs of metadata you want to assign to the access request.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        &self.tags
    }
    /// Consumes the builder and constructs a [`StartAccessRequestInput`](crate::operation::start_access_request::StartAccessRequestInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::start_access_request::StartAccessRequestInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::start_access_request::StartAccessRequestInput {
            reason: self.reason,
            targets: self.targets,
            tags: self.tags,
        })
    }
}