Skip to main content

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    /// <p>A structure containing the Lake Formation audit context.</p>
15    pub audit_context: ::std::option::Option<crate::types::AuditContext>,
16}
17impl GetPartitionInput {
18    /// <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>
19    pub fn catalog_id(&self) -> ::std::option::Option<&str> {
20        self.catalog_id.as_deref()
21    }
22    /// <p>The name of the catalog database where the partition resides.</p>
23    pub fn database_name(&self) -> ::std::option::Option<&str> {
24        self.database_name.as_deref()
25    }
26    /// <p>The name of the partition's table.</p>
27    pub fn table_name(&self) -> ::std::option::Option<&str> {
28        self.table_name.as_deref()
29    }
30    /// <p>The values that define the partition.</p>
31    ///
32    /// 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()`.
33    pub fn partition_values(&self) -> &[::std::string::String] {
34        self.partition_values.as_deref().unwrap_or_default()
35    }
36    /// <p>A structure containing the Lake Formation audit context.</p>
37    pub fn audit_context(&self) -> ::std::option::Option<&crate::types::AuditContext> {
38        self.audit_context.as_ref()
39    }
40}
41impl GetPartitionInput {
42    /// Creates a new builder-style object to manufacture [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
43    pub fn builder() -> crate::operation::get_partition::builders::GetPartitionInputBuilder {
44        crate::operation::get_partition::builders::GetPartitionInputBuilder::default()
45    }
46}
47
48/// A builder for [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct GetPartitionInputBuilder {
52    pub(crate) catalog_id: ::std::option::Option<::std::string::String>,
53    pub(crate) database_name: ::std::option::Option<::std::string::String>,
54    pub(crate) table_name: ::std::option::Option<::std::string::String>,
55    pub(crate) partition_values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
56    pub(crate) audit_context: ::std::option::Option<crate::types::AuditContext>,
57}
58impl GetPartitionInputBuilder {
59    /// <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>
60    pub fn catalog_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
61        self.catalog_id = ::std::option::Option::Some(input.into());
62        self
63    }
64    /// <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>
65    pub fn set_catalog_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
66        self.catalog_id = input;
67        self
68    }
69    /// <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>
70    pub fn get_catalog_id(&self) -> &::std::option::Option<::std::string::String> {
71        &self.catalog_id
72    }
73    /// <p>The name of the catalog database where the partition resides.</p>
74    /// This field is required.
75    pub fn database_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.database_name = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The name of the catalog database where the partition resides.</p>
80    pub fn set_database_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.database_name = input;
82        self
83    }
84    /// <p>The name of the catalog database where the partition resides.</p>
85    pub fn get_database_name(&self) -> &::std::option::Option<::std::string::String> {
86        &self.database_name
87    }
88    /// <p>The name of the partition's table.</p>
89    /// This field is required.
90    pub fn table_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.table_name = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>The name of the partition's table.</p>
95    pub fn set_table_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.table_name = input;
97        self
98    }
99    /// <p>The name of the partition's table.</p>
100    pub fn get_table_name(&self) -> &::std::option::Option<::std::string::String> {
101        &self.table_name
102    }
103    /// Appends an item to `partition_values`.
104    ///
105    /// To override the contents of this collection use [`set_partition_values`](Self::set_partition_values).
106    ///
107    /// <p>The values that define the partition.</p>
108    pub fn partition_values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        let mut v = self.partition_values.unwrap_or_default();
110        v.push(input.into());
111        self.partition_values = ::std::option::Option::Some(v);
112        self
113    }
114    /// <p>The values that define the partition.</p>
115    pub fn set_partition_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
116        self.partition_values = input;
117        self
118    }
119    /// <p>The values that define the partition.</p>
120    pub fn get_partition_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
121        &self.partition_values
122    }
123    /// <p>A structure containing the Lake Formation audit context.</p>
124    pub fn audit_context(mut self, input: crate::types::AuditContext) -> Self {
125        self.audit_context = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p>A structure containing the Lake Formation audit context.</p>
129    pub fn set_audit_context(mut self, input: ::std::option::Option<crate::types::AuditContext>) -> Self {
130        self.audit_context = input;
131        self
132    }
133    /// <p>A structure containing the Lake Formation audit context.</p>
134    pub fn get_audit_context(&self) -> &::std::option::Option<crate::types::AuditContext> {
135        &self.audit_context
136    }
137    /// Consumes the builder and constructs a [`GetPartitionInput`](crate::operation::get_partition::GetPartitionInput).
138    pub fn build(
139        self,
140    ) -> ::std::result::Result<crate::operation::get_partition::GetPartitionInput, ::aws_smithy_types::error::operation::BuildError> {
141        ::std::result::Result::Ok(crate::operation::get_partition::GetPartitionInput {
142            catalog_id: self.catalog_id,
143            database_name: self.database_name,
144            table_name: self.table_name,
145            partition_values: self.partition_values,
146            audit_context: self.audit_context,
147        })
148    }
149}