aws-sdk-transfer 1.113.0

AWS SDK for AWS Transfer Family
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 ListServersOutput {
    /// <p>When you can get additional results from the <code>ListServers</code> operation, a <code>NextToken</code> parameter is returned in the output. In a following command, you can pass in the <code>NextToken</code> parameter to continue listing additional servers.</p>
    pub next_token: ::std::option::Option<::std::string::String>,
    /// <p>An array of servers that were listed.</p>
    pub servers: ::std::vec::Vec<crate::types::ListedServer>,
    _request_id: Option<String>,
}
impl ListServersOutput {
    /// <p>When you can get additional results from the <code>ListServers</code> operation, a <code>NextToken</code> parameter is returned in the output. In a following command, you can pass in the <code>NextToken</code> parameter to continue listing additional servers.</p>
    pub fn next_token(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
    /// <p>An array of servers that were listed.</p>
    pub fn servers(&self) -> &[crate::types::ListedServer] {
        use std::ops::Deref;
        self.servers.deref()
    }
}
impl ::aws_types::request_id::RequestId for ListServersOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl ListServersOutput {
    /// Creates a new builder-style object to manufacture [`ListServersOutput`](crate::operation::list_servers::ListServersOutput).
    pub fn builder() -> crate::operation::list_servers::builders::ListServersOutputBuilder {
        crate::operation::list_servers::builders::ListServersOutputBuilder::default()
    }
}

/// A builder for [`ListServersOutput`](crate::operation::list_servers::ListServersOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ListServersOutputBuilder {
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
    pub(crate) servers: ::std::option::Option<::std::vec::Vec<crate::types::ListedServer>>,
    _request_id: Option<String>,
}
impl ListServersOutputBuilder {
    /// <p>When you can get additional results from the <code>ListServers</code> operation, a <code>NextToken</code> parameter is returned in the output. In a following command, you can pass in the <code>NextToken</code> parameter to continue listing additional servers.</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>When you can get additional results from the <code>ListServers</code> operation, a <code>NextToken</code> parameter is returned in the output. In a following command, you can pass in the <code>NextToken</code> parameter to continue listing additional servers.</p>
    pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.next_token = input;
        self
    }
    /// <p>When you can get additional results from the <code>ListServers</code> operation, a <code>NextToken</code> parameter is returned in the output. In a following command, you can pass in the <code>NextToken</code> parameter to continue listing additional servers.</p>
    pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.next_token
    }
    /// Appends an item to `servers`.
    ///
    /// To override the contents of this collection use [`set_servers`](Self::set_servers).
    ///
    /// <p>An array of servers that were listed.</p>
    pub fn servers(mut self, input: crate::types::ListedServer) -> Self {
        let mut v = self.servers.unwrap_or_default();
        v.push(input);
        self.servers = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of servers that were listed.</p>
    pub fn set_servers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ListedServer>>) -> Self {
        self.servers = input;
        self
    }
    /// <p>An array of servers that were listed.</p>
    pub fn get_servers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ListedServer>> {
        &self.servers
    }
    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 [`ListServersOutput`](crate::operation::list_servers::ListServersOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`servers`](crate::operation::list_servers::builders::ListServersOutputBuilder::servers)
    pub fn build(self) -> ::std::result::Result<crate::operation::list_servers::ListServersOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::list_servers::ListServersOutput {
            next_token: self.next_token,
            servers: self.servers.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "servers",
                    "servers was not specified but it is required when building ListServersOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}