aws_sdk_backupstorage/types/
_backup_object.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// Object
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BackupObject {
7    /// Object name
8    pub name: ::std::string::String,
9    /// Number of chunks in object
10    pub chunks_count: ::std::option::Option<i64>,
11    /// Metadata string associated with the Object
12    pub metadata_string: ::std::option::Option<::std::string::String>,
13    /// Object checksum
14    pub object_checksum: ::std::string::String,
15    /// Checksum algorithm
16    pub object_checksum_algorithm: crate::types::SummaryChecksumAlgorithm,
17    /// Object token
18    pub object_token: ::std::string::String,
19}
20impl BackupObject {
21    /// Object name
22    pub fn name(&self) -> &str {
23        use std::ops::Deref;
24        self.name.deref()
25    }
26    /// Number of chunks in object
27    pub fn chunks_count(&self) -> ::std::option::Option<i64> {
28        self.chunks_count
29    }
30    /// Metadata string associated with the Object
31    pub fn metadata_string(&self) -> ::std::option::Option<&str> {
32        self.metadata_string.as_deref()
33    }
34    /// Object checksum
35    pub fn object_checksum(&self) -> &str {
36        use std::ops::Deref;
37        self.object_checksum.deref()
38    }
39    /// Checksum algorithm
40    pub fn object_checksum_algorithm(&self) -> &crate::types::SummaryChecksumAlgorithm {
41        &self.object_checksum_algorithm
42    }
43    /// Object token
44    pub fn object_token(&self) -> &str {
45        use std::ops::Deref;
46        self.object_token.deref()
47    }
48}
49impl BackupObject {
50    /// Creates a new builder-style object to manufacture [`BackupObject`](crate::types::BackupObject).
51    pub fn builder() -> crate::types::builders::BackupObjectBuilder {
52        crate::types::builders::BackupObjectBuilder::default()
53    }
54}
55
56/// A builder for [`BackupObject`](crate::types::BackupObject).
57#[non_exhaustive]
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59pub struct BackupObjectBuilder {
60    pub(crate) name: ::std::option::Option<::std::string::String>,
61    pub(crate) chunks_count: ::std::option::Option<i64>,
62    pub(crate) metadata_string: ::std::option::Option<::std::string::String>,
63    pub(crate) object_checksum: ::std::option::Option<::std::string::String>,
64    pub(crate) object_checksum_algorithm: ::std::option::Option<crate::types::SummaryChecksumAlgorithm>,
65    pub(crate) object_token: ::std::option::Option<::std::string::String>,
66}
67impl BackupObjectBuilder {
68    /// Object name
69    /// This field is required.
70    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.name = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// Object name
75    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.name = input;
77        self
78    }
79    /// Object name
80    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
81        &self.name
82    }
83    /// Number of chunks in object
84    pub fn chunks_count(mut self, input: i64) -> Self {
85        self.chunks_count = ::std::option::Option::Some(input);
86        self
87    }
88    /// Number of chunks in object
89    pub fn set_chunks_count(mut self, input: ::std::option::Option<i64>) -> Self {
90        self.chunks_count = input;
91        self
92    }
93    /// Number of chunks in object
94    pub fn get_chunks_count(&self) -> &::std::option::Option<i64> {
95        &self.chunks_count
96    }
97    /// Metadata string associated with the Object
98    pub fn metadata_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.metadata_string = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// Metadata string associated with the Object
103    pub fn set_metadata_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.metadata_string = input;
105        self
106    }
107    /// Metadata string associated with the Object
108    pub fn get_metadata_string(&self) -> &::std::option::Option<::std::string::String> {
109        &self.metadata_string
110    }
111    /// Object checksum
112    /// This field is required.
113    pub fn object_checksum(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.object_checksum = ::std::option::Option::Some(input.into());
115        self
116    }
117    /// Object checksum
118    pub fn set_object_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.object_checksum = input;
120        self
121    }
122    /// Object checksum
123    pub fn get_object_checksum(&self) -> &::std::option::Option<::std::string::String> {
124        &self.object_checksum
125    }
126    /// Checksum algorithm
127    /// This field is required.
128    pub fn object_checksum_algorithm(mut self, input: crate::types::SummaryChecksumAlgorithm) -> Self {
129        self.object_checksum_algorithm = ::std::option::Option::Some(input);
130        self
131    }
132    /// Checksum algorithm
133    pub fn set_object_checksum_algorithm(mut self, input: ::std::option::Option<crate::types::SummaryChecksumAlgorithm>) -> Self {
134        self.object_checksum_algorithm = input;
135        self
136    }
137    /// Checksum algorithm
138    pub fn get_object_checksum_algorithm(&self) -> &::std::option::Option<crate::types::SummaryChecksumAlgorithm> {
139        &self.object_checksum_algorithm
140    }
141    /// Object token
142    /// This field is required.
143    pub fn object_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.object_token = ::std::option::Option::Some(input.into());
145        self
146    }
147    /// Object token
148    pub fn set_object_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149        self.object_token = input;
150        self
151    }
152    /// Object token
153    pub fn get_object_token(&self) -> &::std::option::Option<::std::string::String> {
154        &self.object_token
155    }
156    /// Consumes the builder and constructs a [`BackupObject`](crate::types::BackupObject).
157    /// This method will fail if any of the following fields are not set:
158    /// - [`name`](crate::types::builders::BackupObjectBuilder::name)
159    /// - [`object_checksum`](crate::types::builders::BackupObjectBuilder::object_checksum)
160    /// - [`object_checksum_algorithm`](crate::types::builders::BackupObjectBuilder::object_checksum_algorithm)
161    /// - [`object_token`](crate::types::builders::BackupObjectBuilder::object_token)
162    pub fn build(self) -> ::std::result::Result<crate::types::BackupObject, ::aws_smithy_types::error::operation::BuildError> {
163        ::std::result::Result::Ok(crate::types::BackupObject {
164            name: self.name.ok_or_else(|| {
165                ::aws_smithy_types::error::operation::BuildError::missing_field(
166                    "name",
167                    "name was not specified but it is required when building BackupObject",
168                )
169            })?,
170            chunks_count: self.chunks_count,
171            metadata_string: self.metadata_string,
172            object_checksum: self.object_checksum.ok_or_else(|| {
173                ::aws_smithy_types::error::operation::BuildError::missing_field(
174                    "object_checksum",
175                    "object_checksum was not specified but it is required when building BackupObject",
176                )
177            })?,
178            object_checksum_algorithm: self.object_checksum_algorithm.ok_or_else(|| {
179                ::aws_smithy_types::error::operation::BuildError::missing_field(
180                    "object_checksum_algorithm",
181                    "object_checksum_algorithm was not specified but it is required when building BackupObject",
182                )
183            })?,
184            object_token: self.object_token.ok_or_else(|| {
185                ::aws_smithy_types::error::operation::BuildError::missing_field(
186                    "object_token",
187                    "object_token was not specified but it is required when building BackupObject",
188                )
189            })?,
190        })
191    }
192}