// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>An adapter selected for use when analyzing documents. Contains an adapter ID and a version number. Contains information on pages selected for analysis when analyzing documents asychronously.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Adapter {
/// <p>A unique identifier for the adapter resource.</p>
pub adapter_id: ::std::string::String,
/// <p>Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>["1"]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>["1-3", "1-1", "4-*"]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub pages: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>A string that identifies the version of the adapter.</p>
pub version: ::std::string::String,
}
impl Adapter {
/// <p>A unique identifier for the adapter resource.</p>
pub fn adapter_id(&self) -> &str {
use std::ops::Deref;
self.adapter_id.deref()
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>["1"]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>["1-3", "1-1", "4-*"]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.pages.is_none()`.
pub fn pages(&self) -> &[::std::string::String] {
self.pages.as_deref().unwrap_or_default()
}
/// <p>A string that identifies the version of the adapter.</p>
pub fn version(&self) -> &str {
use std::ops::Deref;
self.version.deref()
}
}
impl Adapter {
/// Creates a new builder-style object to manufacture [`Adapter`](crate::types::Adapter).
pub fn builder() -> crate::types::builders::AdapterBuilder {
crate::types::builders::AdapterBuilder::default()
}
}
/// A builder for [`Adapter`](crate::types::Adapter).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct AdapterBuilder {
pub(crate) adapter_id: ::std::option::Option<::std::string::String>,
pub(crate) pages: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) version: ::std::option::Option<::std::string::String>,
}
impl AdapterBuilder {
/// <p>A unique identifier for the adapter resource.</p>
/// This field is required.
pub fn adapter_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.adapter_id = ::std::option::Option::Some(input.into());
self
}
/// <p>A unique identifier for the adapter resource.</p>
pub fn set_adapter_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.adapter_id = input;
self
}
/// <p>A unique identifier for the adapter resource.</p>
pub fn get_adapter_id(&self) -> &::std::option::Option<::std::string::String> {
&self.adapter_id
}
/// Appends an item to `pages`.
///
/// To override the contents of this collection use [`set_pages`](Self::set_pages).
///
/// <p>Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>["1"]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>["1-3", "1-1", "4-*"]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn pages(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.pages.unwrap_or_default();
v.push(input.into());
self.pages = ::std::option::Option::Some(v);
self
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>["1"]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>["1-3", "1-1", "4-*"]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn set_pages(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.pages = input;
self
}
/// <p>Pages is a parameter that the user inputs to specify which pages to apply an adapter to. The following is a list of rules for using this parameter.</p>
/// <ul>
/// <li>
/// <p>If a page is not specified, it is set to <code>["1"]</code> by default.</p></li>
/// <li>
/// <p>The following characters are allowed in the parameter's string: <code>0 1 2 3 4 5 6 7 8 9 - *</code>. No whitespace is allowed.</p></li>
/// <li>
/// <p>When using * to indicate all pages, it must be the only element in the list.</p></li>
/// <li>
/// <p>You can use page intervals, such as <code>["1-3", "1-1", "4-*"]</code>. Where <code>*</code> indicates last page of document.</p></li>
/// <li>
/// <p>Specified pages must be greater than 0 and less than or equal to the number of pages in the document.</p></li>
/// </ul>
pub fn get_pages(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.pages
}
/// <p>A string that identifies the version of the adapter.</p>
/// This field is required.
pub fn version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.version = ::std::option::Option::Some(input.into());
self
}
/// <p>A string that identifies the version of the adapter.</p>
pub fn set_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.version = input;
self
}
/// <p>A string that identifies the version of the adapter.</p>
pub fn get_version(&self) -> &::std::option::Option<::std::string::String> {
&self.version
}
/// Consumes the builder and constructs a [`Adapter`](crate::types::Adapter).
/// This method will fail if any of the following fields are not set:
/// - [`adapter_id`](crate::types::builders::AdapterBuilder::adapter_id)
/// - [`version`](crate::types::builders::AdapterBuilder::version)
pub fn build(self) -> ::std::result::Result<crate::types::Adapter, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Adapter {
adapter_id: self.adapter_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"adapter_id",
"adapter_id was not specified but it is required when building Adapter",
)
})?,
pages: self.pages,
version: self.version.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"version",
"version was not specified but it is required when building Adapter",
)
})?,
})
}
}