aws_sdk_glue/operation/get_partition/
_get_partition_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct GetPartitionInput {
6    /// <p>The ID of the Data Catalog where the partition in question resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
7    pub catalog_id: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the catalog database where the partition resides.</p>
9    pub database_name: ::std::option::Option<::std::string::String>,
10    /// <p>The name of the partition's table.</p>
11    pub table_name: ::std::option::Option<::std::string::String>,
12    /// <p>The values that define the partition.</p>
13    pub partition_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14}
15impl GetPartitionInput {
16    /// <p>The ID of the Data Catalog where the partition in question resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
17    pub fn catalog_id(&self) -> ::std::option::Option<&str> {
18        self.catalog_id.as_deref()
19    }
20    /// <p>The name of the catalog database where the partition resides.</p>
21    pub fn database_name(&self) -> ::std::option::Option<&str> {
22        self.database_name.as_deref()
23    }
24    /// <p>The name of the partition's table.</p>
25    pub fn table_name(&self) -> ::std::option::Option<&str> {
26        self.table_name.as_deref()
27    }
28    /// <p>The values that define the partition.</p>
29    ///
30    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.partition_values.is_none()`.
31    pub fn partition_values(&self) -> &[::std::string::String] {
32        self.partition_values.as_deref().unwrap_or_default()
33    }
34}
35impl GetPartitionInput {
36    /// Creates a new builder-style object to manufacture [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
37    pub fn builder() -> crate::operation::get_partition::builders::GetPartitionInputBuilder {
38        crate::operation::get_partition::builders::GetPartitionInputBuilder::default()
39    }
40}
41
42/// A builder for [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct GetPartitionInputBuilder {
46    pub(crate) catalog_id: ::std::option::Option<::std::string::String>,
47    pub(crate) database_name: ::std::option::Option<::std::string::String>,
48    pub(crate) table_name: ::std::option::Option<::std::string::String>,
49    pub(crate) partition_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
50}
51impl GetPartitionInputBuilder {
52    /// <p>The ID of the Data Catalog where the partition in question resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
53    pub fn catalog_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
54        self.catalog_id = ::std::option::Option::Some(input.into());
55        self
56    }
57    /// <p>The ID of the Data Catalog where the partition in question resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
58    pub fn set_catalog_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
59        self.catalog_id = input;
60        self
61    }
62    /// <p>The ID of the Data Catalog where the partition in question resides. If none is provided, the Amazon Web Services account ID is used by default.</p>
63    pub fn get_catalog_id(&self) -> &::std::option::Option<::std::string::String> {
64        &self.catalog_id
65    }
66    /// <p>The name of the catalog database where the partition resides.</p>
67    /// This field is required.
68    pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.database_name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of the catalog database where the partition resides.</p>
73    pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.database_name = input;
75        self
76    }
77    /// <p>The name of the catalog database where the partition resides.</p>
78    pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.database_name
80    }
81    /// <p>The name of the partition's table.</p>
82    /// This field is required.
83    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.table_name = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The name of the partition's table.</p>
88    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.table_name = input;
90        self
91    }
92    /// <p>The name of the partition's table.</p>
93    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
94        &self.table_name
95    }
96    /// Appends an item to `partition_values`.
97    ///
98    /// To override the contents of this collection use [`set_partition_values`](Self::set_partition_values).
99    ///
100    /// <p>The values that define the partition.</p>
101    pub fn partition_values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
102        let mut v = self.partition_values.unwrap_or_default();
103        v.push(input.into());
104        self.partition_values = ::std::option::Option::Some(v);
105        self
106    }
107    /// <p>The values that define the partition.</p>
108    pub fn set_partition_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
109        self.partition_values = input;
110        self
111    }
112    /// <p>The values that define the partition.</p>
113    pub fn get_partition_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
114        &self.partition_values
115    }
116    /// Consumes the builder and constructs a [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
117    pub fn build(
118        self,
119    ) -> ::std::result::Result<crate::operation::get_partition::GetPartitionInput, ::aws_smithy_types::error::operation::BuildError> {
120        ::std::result::Result::Ok(crate::operation::get_partition::GetPartitionInput {
121            catalog_id: self.catalog_id,
122            database_name: self.database_name,
123            table_name: self.table_name,
124            partition_values: self.partition_values,
125        })
126    }
127}