aws_sdk_backupstorage/types/
_backup_object.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BackupObject {
7 pub name: ::std::string::String,
9 pub chunks_count: ::std::option::Option<i64>,
11 pub metadata_string: ::std::option::Option<::std::string::String>,
13 pub object_checksum: ::std::string::String,
15 pub object_checksum_algorithm: crate::types::SummaryChecksumAlgorithm,
17 pub object_token: ::std::string::String,
19}
20impl BackupObject {
21 pub fn name(&self) -> &str {
23 use std::ops::Deref;
24 self.name.deref()
25 }
26 pub fn chunks_count(&self) -> ::std::option::Option<i64> {
28 self.chunks_count
29 }
30 pub fn metadata_string(&self) -> ::std::option::Option<&str> {
32 self.metadata_string.as_deref()
33 }
34 pub fn object_checksum(&self) -> &str {
36 use std::ops::Deref;
37 self.object_checksum.deref()
38 }
39 pub fn object_checksum_algorithm(&self) -> &crate::types::SummaryChecksumAlgorithm {
41 &self.object_checksum_algorithm
42 }
43 pub fn object_token(&self) -> &str {
45 use std::ops::Deref;
46 self.object_token.deref()
47 }
48}
49impl BackupObject {
50 pub fn builder() -> crate::types::builders::BackupObjectBuilder {
52 crate::types::builders::BackupObjectBuilder::default()
53 }
54}
55
56#[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 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 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76 self.name = input;
77 self
78 }
79 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
81 &self.name
82 }
83 pub fn chunks_count(mut self, input: i64) -> Self {
85 self.chunks_count = ::std::option::Option::Some(input);
86 self
87 }
88 pub fn set_chunks_count(mut self, input: ::std::option::Option<i64>) -> Self {
90 self.chunks_count = input;
91 self
92 }
93 pub fn get_chunks_count(&self) -> &::std::option::Option<i64> {
95 &self.chunks_count
96 }
97 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 pub fn set_metadata_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104 self.metadata_string = input;
105 self
106 }
107 pub fn get_metadata_string(&self) -> &::std::option::Option<::std::string::String> {
109 &self.metadata_string
110 }
111 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 pub fn set_object_checksum(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.object_checksum = input;
120 self
121 }
122 pub fn get_object_checksum(&self) -> &::std::option::Option<::std::string::String> {
124 &self.object_checksum
125 }
126 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 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 pub fn get_object_checksum_algorithm(&self) -> &::std::option::Option<crate::types::SummaryChecksumAlgorithm> {
139 &self.object_checksum_algorithm
140 }
141 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 pub fn set_object_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.object_token = input;
150 self
151 }
152 pub fn get_object_token(&self) -> &::std::option::Option<::std::string::String> {
154 &self.object_token
155 }
156 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}