aws_sdk_glue/types/
_glue_schema.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies a user-defined schema when a schema cannot be determined by Glue.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct GlueSchema {
7    /// <p>Specifies the column definitions that make up a Glue schema.</p>
8    pub columns: ::std::option::Option<::std::vec::Vec<crate::types::GlueStudioSchemaColumn>>,
9}
10impl GlueSchema {
11    /// <p>Specifies the column definitions that make up a Glue schema.</p>
12    ///
13    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.columns.is_none()`.
14    pub fn columns(&self) -> &[crate::types::GlueStudioSchemaColumn] {
15        self.columns.as_deref().unwrap_or_default()
16    }
17}
18impl GlueSchema {
19    /// Creates a new builder-style object to manufacture [`GlueSchema`](crate::types::GlueSchema).
20    pub fn builder() -> crate::types::builders::GlueSchemaBuilder {
21        crate::types::builders::GlueSchemaBuilder::default()
22    }
23}
24
25/// A builder for [`GlueSchema`](crate::types::GlueSchema).
26#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
27#[non_exhaustive]
28pub struct GlueSchemaBuilder {
29    pub(crate) columns: ::std::option::Option<::std::vec::Vec<crate::types::GlueStudioSchemaColumn>>,
30}
31impl GlueSchemaBuilder {
32    /// Appends an item to `columns`.
33    ///
34    /// To override the contents of this collection use [`set_columns`](Self::set_columns).
35    ///
36    /// <p>Specifies the column definitions that make up a Glue schema.</p>
37    pub fn columns(mut self, input: crate::types::GlueStudioSchemaColumn) -> Self {
38        let mut v = self.columns.unwrap_or_default();
39        v.push(input);
40        self.columns = ::std::option::Option::Some(v);
41        self
42    }
43    /// <p>Specifies the column definitions that make up a Glue schema.</p>
44    pub fn set_columns(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GlueStudioSchemaColumn>>) -> Self {
45        self.columns = input;
46        self
47    }
48    /// <p>Specifies the column definitions that make up a Glue schema.</p>
49    pub fn get_columns(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GlueStudioSchemaColumn>> {
50        &self.columns
51    }
52    /// Consumes the builder and constructs a [`GlueSchema`](crate::types::GlueSchema).
53    pub fn build(self) -> crate::types::GlueSchema {
54        crate::types::GlueSchema { columns: self.columns }
55    }
56}