aws-sdk-deadline 1.64.0

AWS SDK for AWSDeadlineCloud
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 SearchWorkersOutput {
    /// <p>The workers for the search.</p>
    pub workers: ::std::vec::Vec<crate::types::WorkerSearchSummary>,
    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
    pub next_item_offset: ::std::option::Option<i32>,
    /// <p>The total number of results in the search.</p>
    pub total_results: i32,
    _request_id: Option<String>,
}
impl SearchWorkersOutput {
    /// <p>The workers for the search.</p>
    pub fn workers(&self) -> &[crate::types::WorkerSearchSummary] {
        use std::ops::Deref;
        self.workers.deref()
    }
    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
    pub fn next_item_offset(&self) -> ::std::option::Option<i32> {
        self.next_item_offset
    }
    /// <p>The total number of results in the search.</p>
    pub fn total_results(&self) -> i32 {
        self.total_results
    }
}
impl ::aws_types::request_id::RequestId for SearchWorkersOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl SearchWorkersOutput {
    /// Creates a new builder-style object to manufacture [`SearchWorkersOutput`](crate::operation::search_workers::SearchWorkersOutput).
    pub fn builder() -> crate::operation::search_workers::builders::SearchWorkersOutputBuilder {
        crate::operation::search_workers::builders::SearchWorkersOutputBuilder::default()
    }
}

/// A builder for [`SearchWorkersOutput`](crate::operation::search_workers::SearchWorkersOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SearchWorkersOutputBuilder {
    pub(crate) workers: ::std::option::Option<::std::vec::Vec<crate::types::WorkerSearchSummary>>,
    pub(crate) next_item_offset: ::std::option::Option<i32>,
    pub(crate) total_results: ::std::option::Option<i32>,
    _request_id: Option<String>,
}
impl SearchWorkersOutputBuilder {
    /// Appends an item to `workers`.
    ///
    /// To override the contents of this collection use [`set_workers`](Self::set_workers).
    ///
    /// <p>The workers for the search.</p>
    pub fn workers(mut self, input: crate::types::WorkerSearchSummary) -> Self {
        let mut v = self.workers.unwrap_or_default();
        v.push(input);
        self.workers = ::std::option::Option::Some(v);
        self
    }
    /// <p>The workers for the search.</p>
    pub fn set_workers(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::WorkerSearchSummary>>) -> Self {
        self.workers = input;
        self
    }
    /// <p>The workers for the search.</p>
    pub fn get_workers(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::WorkerSearchSummary>> {
        &self.workers
    }
    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
    pub fn next_item_offset(mut self, input: i32) -> Self {
        self.next_item_offset = ::std::option::Option::Some(input);
        self
    }
    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
    pub fn set_next_item_offset(mut self, input: ::std::option::Option<i32>) -> Self {
        self.next_item_offset = input;
        self
    }
    /// <p>The next incremental starting point after the defined <code>itemOffset</code>.</p>
    pub fn get_next_item_offset(&self) -> &::std::option::Option<i32> {
        &self.next_item_offset
    }
    /// <p>The total number of results in the search.</p>
    /// This field is required.
    pub fn total_results(mut self, input: i32) -> Self {
        self.total_results = ::std::option::Option::Some(input);
        self
    }
    /// <p>The total number of results in the search.</p>
    pub fn set_total_results(mut self, input: ::std::option::Option<i32>) -> Self {
        self.total_results = input;
        self
    }
    /// <p>The total number of results in the search.</p>
    pub fn get_total_results(&self) -> &::std::option::Option<i32> {
        &self.total_results
    }
    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 [`SearchWorkersOutput`](crate::operation::search_workers::SearchWorkersOutput).
    /// This method will fail if any of the following fields are not set:
    /// - [`workers`](crate::operation::search_workers::builders::SearchWorkersOutputBuilder::workers)
    /// - [`total_results`](crate::operation::search_workers::builders::SearchWorkersOutputBuilder::total_results)
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::search_workers::SearchWorkersOutput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::search_workers::SearchWorkersOutput {
            workers: self.workers.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "workers",
                    "workers was not specified but it is required when building SearchWorkersOutput",
                )
            })?,
            next_item_offset: self.next_item_offset,
            total_results: self.total_results.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "total_results",
                    "total_results was not specified but it is required when building SearchWorkersOutput",
                )
            })?,
            _request_id: self._request_id,
        })
    }
}