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 DescribeDocumentPermissionOutput {
    /// <p>The account IDs that have permission to use this document. The ID can be either an Amazon Web Services account number or <code>all</code>.</p>
    pub account_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <p>A list of Amazon Web Services accounts where the current document is shared and the version shared with each account.</p>
    pub account_sharing_info_list: ::std::option::Option<::std::vec::Vec<crate::types::AccountSharingInfo>>,
    /// <p>The token for the next set of items to return. Use this token to get the next set of results.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl DescribeDocumentPermissionOutput {
    /// <p>The account IDs that have permission to use this document. The ID can be either an Amazon Web Services account number or <code>all</code>.</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 `.account_ids.is_none()`.
    pub fn account_ids(&self) -> &[::std::string::String] {
        self.account_ids.as_deref().unwrap_or_default()
    }
    /// <p>A list of Amazon Web Services accounts where the current document is shared and the version shared with each account.</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 `.account_sharing_info_list.is_none()`.
    pub fn account_sharing_info_list(&self) -> &[crate::types::AccountSharingInfo] {
        self.account_sharing_info_list.as_deref().unwrap_or_default()
    }
    /// <p>The token for the next set of items to return. Use this token to get the next set of results.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
}
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_IDS_MEMBER: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts("com.amazonaws.ssm#AccountIdList$member", "com.amazonaws.ssm", "AccountIdList"),
    ::aws_smithy_schema::ShapeType::String,
    "member",
    0,
)
.with_xml_name("AccountId");
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_IDS: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#DescribeDocumentPermissionOutput$AccountIds",
        "com.amazonaws.ssm.synthetic",
        "DescribeDocumentPermissionOutput",
    ),
    ::aws_smithy_schema::ShapeType::List,
    "AccountIds",
    0,
)
.with_list_member(&DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_IDS_MEMBER);
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_SHARING_INFO_LIST_MEMBER: ::aws_smithy_schema::Schema<'static> =
    ::aws_smithy_schema::Schema::new_member(
        ::aws_smithy_schema::ShapeId::from_parts(
            "com.amazonaws.ssm#AccountSharingInfoList$member",
            "com.amazonaws.ssm",
            "AccountSharingInfoList",
        ),
        ::aws_smithy_schema::ShapeType::Structure,
        "member",
        0,
    )
    .with_xml_name("AccountSharingInfo");
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_SHARING_INFO_LIST: ::aws_smithy_schema::Schema<'static> =
    ::aws_smithy_schema::Schema::new_member(
        ::aws_smithy_schema::ShapeId::from_parts(
            "com.amazonaws.ssm.synthetic#DescribeDocumentPermissionOutput$AccountSharingInfoList",
            "com.amazonaws.ssm.synthetic",
            "DescribeDocumentPermissionOutput",
        ),
        ::aws_smithy_schema::ShapeType::List,
        "AccountSharingInfoList",
        1,
    )
    .with_list_member(&DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_SHARING_INFO_LIST_MEMBER);
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_NEXT_TOKEN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#DescribeDocumentPermissionOutput$NextToken",
        "com.amazonaws.ssm.synthetic",
        "DescribeDocumentPermissionOutput",
    ),
    ::aws_smithy_schema::ShapeType::String,
    "NextToken",
    2,
);
static DESCRIBEDOCUMENTPERMISSIONOUTPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
    ::aws_smithy_schema::ShapeId::from_parts(
        "com.amazonaws.ssm.synthetic#DescribeDocumentPermissionOutput",
        "com.amazonaws.ssm.synthetic",
        "DescribeDocumentPermissionOutput",
    ),
    ::aws_smithy_schema::ShapeType::Structure,
    &[
        &DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_IDS,
        &DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_SHARING_INFO_LIST,
        &DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_NEXT_TOKEN,
    ],
)
.with_original_name("DescribeDocumentPermissionResponse");
impl DescribeDocumentPermissionOutput {
    /// The schema for this shape.
    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &DESCRIBEDOCUMENTPERMISSIONOUTPUT_SCHEMA;
}
impl ::aws_smithy_schema::serde::SerializableStruct for DescribeDocumentPermissionOutput {
    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.account_ids {
            ser.write_list(
                &DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_IDS,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_string(&aws_smithy_schema::prelude::STRING, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        if let Some(ref val) = self.account_sharing_info_list {
            ser.write_list(
                &DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_ACCOUNT_SHARING_INFO_LIST,
                &|ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer| {
                    for item in val {
                        ser.write_struct(crate::types::AccountSharingInfo::SCHEMA, item)?;
                    }
                    Ok(())
                },
            )?;
        }
        if let Some(ref val) = self.next_token {
            ser.write_string(&DESCRIBEDOCUMENTPERMISSIONOUTPUT_MEMBER_NEXT_TOKEN, val)?;
        }
        Ok(())
    }
}
impl crate::operation::describe_document_permission::builders::DescribeDocumentPermissionOutputBuilder {
    #[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(&DESCRIBEDOCUMENTPERMISSIONOUTPUT_SCHEMA, &mut |member, deser| {
            match member.member_index() {
                Some(0) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.account_ids = Some(deser.read_string_list(member)?);
                    }
                }
                Some(1) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.account_sharing_info_list = Some({
                            let mut container = Vec::new();
                            deser.read_list(member, &mut |deser| {
                                container.push(crate::types::AccountSharingInfo::deserialize(deser)?);
                                Ok(())
                            })?;
                            container
                        });
                    }
                }
                Some(2) => {
                    if deser.is_null() {
                        deser.read_null()?;
                    } else {
                        self.next_token = Some(deser.read_string(member)?);
                    }
                }
                _ => {}
            }
            Ok(())
        })
    }
}

impl DescribeDocumentPermissionOutput {
    /// 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)?;
        Ok(builder.build())
    }
}
impl ::aws_types::request_id::RequestId for DescribeDocumentPermissionOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl DescribeDocumentPermissionOutput {
    /// Creates a new builder-style object to manufacture [`DescribeDocumentPermissionOutput`](crate::operation::describe_document_permission::DescribeDocumentPermissionOutput).
    pub fn builder() -> crate::operation::describe_document_permission::builders::DescribeDocumentPermissionOutputBuilder {
        crate::operation::describe_document_permission::builders::DescribeDocumentPermissionOutputBuilder::default()
    }
}

/// A builder for [`DescribeDocumentPermissionOutput`](crate::operation::describe_document_permission::DescribeDocumentPermissionOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct DescribeDocumentPermissionOutputBuilder {
    pub(crate) account_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) account_sharing_info_list: ::std::option::Option<::std::vec::Vec<crate::types::AccountSharingInfo>>,
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl DescribeDocumentPermissionOutputBuilder {
    /// Appends an item to `account_ids`.
    ///
    /// To override the contents of this collection use [`set_account_ids`](Self::set_account_ids).
    ///
    /// <p>The account IDs that have permission to use this document. The ID can be either an Amazon Web Services account number or <code>all</code>.</p>
    pub fn account_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.account_ids.unwrap_or_default();
        v.push(input.into());
        self.account_ids = ::std::option::Option::Some(v);
        self
    }
    /// <p>The account IDs that have permission to use this document. The ID can be either an Amazon Web Services account number or <code>all</code>.</p>
    pub fn set_account_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.account_ids = input;
        self
    }
    /// <p>The account IDs that have permission to use this document. The ID can be either an Amazon Web Services account number or <code>all</code>.</p>
    pub fn get_account_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.account_ids
    }
    /// Appends an item to `account_sharing_info_list`.
    ///
    /// To override the contents of this collection use [`set_account_sharing_info_list`](Self::set_account_sharing_info_list).
    ///
    /// <p>A list of Amazon Web Services accounts where the current document is shared and the version shared with each account.</p>
    pub fn account_sharing_info_list(mut self, input: crate::types::AccountSharingInfo) -> Self {
        let mut v = self.account_sharing_info_list.unwrap_or_default();
        v.push(input);
        self.account_sharing_info_list = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of Amazon Web Services accounts where the current document is shared and the version shared with each account.</p>
    pub fn set_account_sharing_info_list(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AccountSharingInfo>>) -> Self {
        self.account_sharing_info_list = input;
        self
    }
    /// <p>A list of Amazon Web Services accounts where the current document is shared and the version shared with each account.</p>
    pub fn get_account_sharing_info_list(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AccountSharingInfo>> {
        &self.account_sharing_info_list
    }
    /// <p>The token for the next set of items to return. Use this token to get the next set of results.</p>
    pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.next_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The token for the next set of items to return. Use this token to get the next set of results.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>The token for the next set of items to return. Use this token to get the next set of results.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.next_token
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`DescribeDocumentPermissionOutput`](crate::operation::describe_document_permission::DescribeDocumentPermissionOutput).
    pub fn build(self) -> crate::operation::describe_document_permission::DescribeDocumentPermissionOutput {
        crate::operation::describe_document_permission::DescribeDocumentPermissionOutput {
            account_ids: self.account_ids,
            account_sharing_info_list: self.account_sharing_info_list,
            next_token: self.next_token,
            _request_id: self._request_id,
        }
    }
}