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 LabelParameterVersionInput {
    /// <p>The parameter name on which you want to attach one or more labels.</p><note>
    /// <p>You can't enter the Amazon Resource Name (ARN) for a parameter, only the parameter name itself.</p>
    /// </note>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>The specific version of the parameter on which you want to attach one or more labels. If no version is specified, the system attaches the label to the latest version.</p>
    pub parameter_version: ::std::option::Option<i64>,
    /// <p>One or more labels to attach to the specified parameter version.</p>
    pub labels: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl LabelParameterVersionInput {
    /// <p>The parameter name on which you want to attach one or more labels.</p><note>
    /// <p>You can't enter the Amazon Resource Name (ARN) for a parameter, only the parameter name itself.</p>
    /// </note>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>The specific version of the parameter on which you want to attach one or more labels. If no version is specified, the system attaches the label to the latest version.</p>
    pub fn parameter_version(&self) -> ::std::option::Option<i64> {
        self.parameter_version
    }
    /// <p>One or more labels to attach to the specified parameter version.</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 `.labels.is_none()`.
    pub fn labels(&self) -> &[::std::string::String] {
        self.labels.as_deref().unwrap_or_default()
    }
}
static LABELPARAMETERVERSIONINPUT_MEMBER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#LabelParameterVersionInput$Name",
        "com.amazonaws.ssm.synthetic",
        "LabelParameterVersionInput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "Name",
    0,
);
static LABELPARAMETERVERSIONINPUT_MEMBER_PARAMETER_VERSION: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#LabelParameterVersionInput$ParameterVersion",
        "com.amazonaws.ssm.synthetic",
        "LabelParameterVersionInput",
    ),
    ::aws_smithy_schema::ShapeType::Long,
    "ParameterVersion",
    1,
);
static LABELPARAMETERVERSIONINPUT_MEMBER_LABELS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#ParameterLabelList$member", "com.amazonaws.ssm", "ParameterLabelList"),
    ::aws_smithy_schema::ShapeType::String,
    "member",
    0,
);
static LABELPARAMETERVERSIONINPUT_MEMBER_LABELS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#LabelParameterVersionInput$Labels",
        "com.amazonaws.ssm.synthetic",
        "LabelParameterVersionInput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "Labels",
    2,
)
.with_list_member(&LABELPARAMETERVERSIONINPUT_MEMBER_LABELS_MEMBER);
static LABELPARAMETERVERSIONINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#LabelParameterVersionInput",
        "com.amazonaws.ssm.synthetic",
        "LabelParameterVersionInput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &LABELPARAMETERVERSIONINPUT_MEMBER_NAME,
        &LABELPARAMETERVERSIONINPUT_MEMBER_PARAMETER_VERSION,
        &LABELPARAMETERVERSIONINPUT_MEMBER_LABELS,
    ],
)
.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
.with_original_name("LabelParameterVersionRequest");
impl LabelParameterVersionInput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &LABELPARAMETERVERSIONINPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for LabelParameterVersionInput {
    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.name {
            ser.write_string(&LABELPARAMETERVERSIONINPUT_MEMBER_NAME, val)?;
        }
        if let Some(ref val) = self.parameter_version {
            ser.write_long(&LABELPARAMETERVERSIONINPUT_MEMBER_PARAMETER_VERSION, *val)?;
        }
        if let Some(ref val) = self.labels {
            ser.write_list(
                &LABELPARAMETERVERSIONINPUT_MEMBER_LABELS,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        Ok(())
    }
}
impl crate::operation::label_parameter_version::builders::LabelParameterVersionInputBuilder {
    #[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(&LABELPARAMETERVERSIONINPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.name = Some(deser.read_string(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.parameter_version = Some(deser.read_long(member)?);
                    }
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.labels = Some(deser.read_string_list(member)?);
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

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

/// A builder for [`LabelParameterVersionInput`](crate::operation::label_parameter_version::LabelParameterVersionInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct LabelParameterVersionInputBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) parameter_version: ::std::option::Option<i64>,
    pub(crate) labels: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl LabelParameterVersionInputBuilder {
    /// <p>The parameter name on which you want to attach one or more labels.</p><note>
    /// <p>You can't enter the Amazon Resource Name (ARN) for a parameter, only the parameter name itself.</p>
    /// </note>
    /// This field is required.
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The parameter name on which you want to attach one or more labels.</p><note>
    /// <p>You can't enter the Amazon Resource Name (ARN) for a parameter, only the parameter name itself.</p>
    /// </note>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The parameter name on which you want to attach one or more labels.</p><note>
    /// <p>You can't enter the Amazon Resource Name (ARN) for a parameter, only the parameter name itself.</p>
    /// </note>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>The specific version of the parameter on which you want to attach one or more labels. If no version is specified, the system attaches the label to the latest version.</p>
    pub fn parameter_version(mut self, input: i64) -> Self {
        self.parameter_version = ::std::option::Option::Some(input);
        self
    }
    /// <p>The specific version of the parameter on which you want to attach one or more labels. If no version is specified, the system attaches the label to the latest version.</p>
    pub fn set_parameter_version(mut self, input: ::std::option::Option<i64>) -> Self {
        self.parameter_version = input;
        self
    }
    /// <p>The specific version of the parameter on which you want to attach one or more labels. If no version is specified, the system attaches the label to the latest version.</p>
    pub fn get_parameter_version(&self) -> &::std::option::Option<i64> {
        &self.parameter_version
    }
    /// Appends an item to `labels`.
    ///
    /// To override the contents of this collection use [`set_labels`](Self::set_labels).
    ///
    /// <p>One or more labels to attach to the specified parameter version.</p>
    pub fn labels(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.labels.unwrap_or_default();
        v.push(input.into());
        self.labels = ::std::option::Option::Some(v);
        self
    }
    /// <p>One or more labels to attach to the specified parameter version.</p>
    pub fn set_labels(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.labels = input;
        self
    }
    /// <p>One or more labels to attach to the specified parameter version.</p>
    pub fn get_labels(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.labels
    }
    /// Consumes the builder and constructs a [`LabelParameterVersionInput`](crate::operation::label_parameter_version::LabelParameterVersionInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::label_parameter_version::LabelParameterVersionInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::label_parameter_version::LabelParameterVersionInput {
            name: self.name,
            parameter_version: self.parameter_version,
            labels: self.labels,
        })
    }
}