aws_sdk_m2/types/
_vsam_attributes.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The attributes of a VSAM type data set.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct VsamAttributes {
7    /// <p>The record format of the data set.</p>
8    pub format: ::std::string::String,
9    /// <p>The character set used by the data set. Can be ASCII, EBCDIC, or unknown.</p>
10    pub encoding: ::std::option::Option<::std::string::String>,
11    /// <p>Indicates whether indexes for this dataset are stored as compressed values. If you have a large data set (typically &gt; 100 Mb), consider setting this flag to True.</p>
12    pub compressed: bool,
13    /// <p>The primary key of the data set.</p>
14    pub primary_key: ::std::option::Option<crate::types::PrimaryKey>,
15    /// <p>The alternate key definitions, if any. A legacy dataset might not have any alternate key defined, but if those alternate keys definitions exist, provide them as some applications will make use of them.</p>
16    pub alternate_keys: ::std::option::Option<::std::vec::Vec<crate::types::AlternateKey>>,
17}
18impl VsamAttributes {
19    /// <p>The record format of the data set.</p>
20    pub fn format(&self) -> &str {
21        use std::ops::Deref;
22        self.format.deref()
23    }
24    /// <p>The character set used by the data set. Can be ASCII, EBCDIC, or unknown.</p>
25    pub fn encoding(&self) -> ::std::option::Option<&str> {
26        self.encoding.as_deref()
27    }
28    /// <p>Indicates whether indexes for this dataset are stored as compressed values. If you have a large data set (typically &gt; 100 Mb), consider setting this flag to True.</p>
29    pub fn compressed(&self) -> bool {
30        self.compressed
31    }
32    /// <p>The primary key of the data set.</p>
33    pub fn primary_key(&self) -> ::std::option::Option<&crate::types::PrimaryKey> {
34        self.primary_key.as_ref()
35    }
36    /// <p>The alternate key definitions, if any. A legacy dataset might not have any alternate key defined, but if those alternate keys definitions exist, provide them as some applications will make use of them.</p>
37    ///
38    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.alternate_keys.is_none()`.
39    pub fn alternate_keys(&self) -> &[crate::types::AlternateKey] {
40        self.alternate_keys.as_deref().unwrap_or_default()
41    }
42}
43impl VsamAttributes {
44    /// Creates a new builder-style object to manufacture [`VsamAttributes`](crate::types::VsamAttributes).
45    pub fn builder() -> crate::types::builders::VsamAttributesBuilder {
46        crate::types::builders::VsamAttributesBuilder::default()
47    }
48}
49
50/// A builder for [`VsamAttributes`](crate::types::VsamAttributes).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct VsamAttributesBuilder {
54    pub(crate) format: ::std::option::Option<::std::string::String>,
55    pub(crate) encoding: ::std::option::Option<::std::string::String>,
56    pub(crate) compressed: ::std::option::Option<bool>,
57    pub(crate) primary_key: ::std::option::Option<crate::types::PrimaryKey>,
58    pub(crate) alternate_keys: ::std::option::Option<::std::vec::Vec<crate::types::AlternateKey>>,
59}
60impl VsamAttributesBuilder {
61    /// <p>The record format of the data set.</p>
62    /// This field is required.
63    pub fn format(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.format = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The record format of the data set.</p>
68    pub fn set_format(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.format = input;
70        self
71    }
72    /// <p>The record format of the data set.</p>
73    pub fn get_format(&self) -> &::std::option::Option<::std::string::String> {
74        &self.format
75    }
76    /// <p>The character set used by the data set. Can be ASCII, EBCDIC, or unknown.</p>
77    pub fn encoding(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.encoding = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The character set used by the data set. Can be ASCII, EBCDIC, or unknown.</p>
82    pub fn set_encoding(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.encoding = input;
84        self
85    }
86    /// <p>The character set used by the data set. Can be ASCII, EBCDIC, or unknown.</p>
87    pub fn get_encoding(&self) -> &::std::option::Option<::std::string::String> {
88        &self.encoding
89    }
90    /// <p>Indicates whether indexes for this dataset are stored as compressed values. If you have a large data set (typically &gt; 100 Mb), consider setting this flag to True.</p>
91    pub fn compressed(mut self, input: bool) -> Self {
92        self.compressed = ::std::option::Option::Some(input);
93        self
94    }
95    /// <p>Indicates whether indexes for this dataset are stored as compressed values. If you have a large data set (typically &gt; 100 Mb), consider setting this flag to True.</p>
96    pub fn set_compressed(mut self, input: ::std::option::Option<bool>) -> Self {
97        self.compressed = input;
98        self
99    }
100    /// <p>Indicates whether indexes for this dataset are stored as compressed values. If you have a large data set (typically &gt; 100 Mb), consider setting this flag to True.</p>
101    pub fn get_compressed(&self) -> &::std::option::Option<bool> {
102        &self.compressed
103    }
104    /// <p>The primary key of the data set.</p>
105    pub fn primary_key(mut self, input: crate::types::PrimaryKey) -> Self {
106        self.primary_key = ::std::option::Option::Some(input);
107        self
108    }
109    /// <p>The primary key of the data set.</p>
110    pub fn set_primary_key(mut self, input: ::std::option::Option<crate::types::PrimaryKey>) -> Self {
111        self.primary_key = input;
112        self
113    }
114    /// <p>The primary key of the data set.</p>
115    pub fn get_primary_key(&self) -> &::std::option::Option<crate::types::PrimaryKey> {
116        &self.primary_key
117    }
118    /// Appends an item to `alternate_keys`.
119    ///
120    /// To override the contents of this collection use [`set_alternate_keys`](Self::set_alternate_keys).
121    ///
122    /// <p>The alternate key definitions, if any. A legacy dataset might not have any alternate key defined, but if those alternate keys definitions exist, provide them as some applications will make use of them.</p>
123    pub fn alternate_keys(mut self, input: crate::types::AlternateKey) -> Self {
124        let mut v = self.alternate_keys.unwrap_or_default();
125        v.push(input);
126        self.alternate_keys = ::std::option::Option::Some(v);
127        self
128    }
129    /// <p>The alternate key definitions, if any. A legacy dataset might not have any alternate key defined, but if those alternate keys definitions exist, provide them as some applications will make use of them.</p>
130    pub fn set_alternate_keys(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AlternateKey>>) -> Self {
131        self.alternate_keys = input;
132        self
133    }
134    /// <p>The alternate key definitions, if any. A legacy dataset might not have any alternate key defined, but if those alternate keys definitions exist, provide them as some applications will make use of them.</p>
135    pub fn get_alternate_keys(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AlternateKey>> {
136        &self.alternate_keys
137    }
138    /// Consumes the builder and constructs a [`VsamAttributes`](crate::types::VsamAttributes).
139    /// This method will fail if any of the following fields are not set:
140    /// - [`format`](crate::types::builders::VsamAttributesBuilder::format)
141    pub fn build(self) -> ::std::result::Result<crate::types::VsamAttributes, ::aws_smithy_types::error::operation::BuildError> {
142        ::std::result::Result::Ok(crate::types::VsamAttributes {
143            format: self.format.ok_or_else(|| {
144                ::aws_smithy_types::error::operation::BuildError::missing_field(
145                    "format",
146                    "format was not specified but it is required when building VsamAttributes",
147                )
148            })?,
149            encoding: self.encoding,
150            compressed: self.compressed.unwrap_or_default(),
151            primary_key: self.primary_key,
152            alternate_keys: self.alternate_keys,
153        })
154    }
155}