Skip to main content

oci_rust_sdk/core/models/
boot_volume_backup.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// A point-in-time copy of a boot volume that can then be used to create a new boot volume or recover a boot volume. For more information, see [Overview of Boot Volume Backups](https://docs.oracle.com/iaas/Content/Block/Concepts/bootvolumebackups.htm) To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.oracle.com/iaas/Content/Identity/Concepts/policygetstarted.htm). <p> *Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct BootVolumeBackup {
11    /// The OCID of the compartment that contains the boot volume backup.
12    pub compartment_id: String,
13
14    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
15    pub display_name: String,
16
17    /// The OCID of the boot volume backup.
18    pub id: String,
19
20    /// The current state of a boot volume backup.
21    pub lifecycle_state: BootVolumeBackupLifecycleState,
22
23    /// The date and time the boot volume backup was created. This is the time the actual point-in-time image of the volume data was taken. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
24    pub time_created: DateTime<Utc>,
25
26    /// The OCID of the boot volume.
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub boot_volume_id: Option<String>,
29
30    /// Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Operations\": {\"CostCenter\": \"42\"}}}
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
33
34    /// System tags for this resource. Each key is predefined and scoped to a namespace. Example: {@code {\"foo-namespace\": {\"bar-key\": \"value\"}}}
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub system_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
37
38    /// The date and time the volume backup will expire and be automatically deleted. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). This parameter will always be present for backups that were created automatically by a scheduled-backup policy. For manually created backups, it will be absent, signifying that there is no expiration time and the backup will last forever until manually deleted.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub expiration_time: Option<DateTime<Utc>>,
41
42    /// Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Department\": \"Finance\"}}
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub freeform_tags: Option<HashMap<String, String>>,
45
46    /// The image OCID used to create the boot volume the backup is taken from.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub image_id: Option<String>,
49
50    /// The OCID of the Vault service master encryption assigned to the boot volume backup. For more information about the Vault service and encryption keys, see [Overview of Vault service](https://docs.oracle.com/iaas/Content/KeyManagement/Concepts/keyoverview.htm) and [Using Keys](https://docs.oracle.com/iaas/Content/KeyManagement/Tasks/usingkeys.htm).
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub kms_key_id: Option<String>,
53
54    /// The size of the boot volume, in GBs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub size_in_gbs: Option<i64>,
57
58    /// The OCID of the source boot volume backup.
59    #[serde(skip_serializing_if = "Option::is_none")]
60    pub source_boot_volume_backup_id: Option<String>,
61
62    /// Specifies whether the backup was created manually, or via scheduled backup policy.
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub source_type: Option<BootVolumeBackupSourceType>,
65
66    /// The date and time the request to create the boot volume backup was received. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub time_request_received: Option<DateTime<Utc>>,
69
70    /// The type of a volume backup.
71    #[serde(rename = "type")]
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub r#type: Option<BootVolumeBackupType>,
74
75    /// The size used by the backup, in GBs. It is typically smaller than sizeInGBs, depending on the space consumed on the boot volume and whether the backup is full or incremental. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
76    #[serde(skip_serializing_if = "Option::is_none")]
77    pub unique_size_in_gbs: Option<i64>,
78}
79
80/// Required fields for BootVolumeBackup
81pub struct BootVolumeBackupRequired {
82    /// The OCID of the compartment that contains the boot volume backup.
83    pub compartment_id: String,
84
85    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
86    pub display_name: String,
87
88    /// The OCID of the boot volume backup.
89    pub id: String,
90
91    /// The current state of a boot volume backup.
92    pub lifecycle_state: BootVolumeBackupLifecycleState,
93
94    /// The date and time the boot volume backup was created. This is the time the actual point-in-time image of the volume data was taken. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
95    pub time_created: DateTime<Utc>,
96}
97
98impl BootVolumeBackup {
99    /// Create a new BootVolumeBackup with required fields
100    pub fn new(required: BootVolumeBackupRequired) -> Self {
101        Self {
102            compartment_id: required.compartment_id,
103
104            display_name: required.display_name,
105
106            id: required.id,
107
108            lifecycle_state: required.lifecycle_state,
109
110            time_created: required.time_created,
111
112            boot_volume_id: None,
113
114            defined_tags: None,
115
116            system_tags: None,
117
118            expiration_time: None,
119
120            freeform_tags: None,
121
122            image_id: None,
123
124            kms_key_id: None,
125
126            size_in_gbs: None,
127
128            source_boot_volume_backup_id: None,
129
130            source_type: None,
131
132            time_request_received: None,
133
134            r#type: None,
135
136            unique_size_in_gbs: None,
137        }
138    }
139
140    /// Set boot_volume_id
141    pub fn set_boot_volume_id(mut self, value: Option<String>) -> Self {
142        self.boot_volume_id = value;
143        self
144    }
145
146    /// Set compartment_id
147    pub fn set_compartment_id(mut self, value: String) -> Self {
148        self.compartment_id = value;
149        self
150    }
151
152    /// Set defined_tags
153    pub fn set_defined_tags(
154        mut self,
155        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
156    ) -> Self {
157        self.defined_tags = value;
158        self
159    }
160
161    /// Set system_tags
162    pub fn set_system_tags(
163        mut self,
164        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
165    ) -> Self {
166        self.system_tags = value;
167        self
168    }
169
170    /// Set display_name
171    pub fn set_display_name(mut self, value: String) -> Self {
172        self.display_name = value;
173        self
174    }
175
176    /// Set expiration_time
177    pub fn set_expiration_time(mut self, value: Option<DateTime<Utc>>) -> Self {
178        self.expiration_time = value;
179        self
180    }
181
182    /// Set freeform_tags
183    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
184        self.freeform_tags = value;
185        self
186    }
187
188    /// Set id
189    pub fn set_id(mut self, value: String) -> Self {
190        self.id = value;
191        self
192    }
193
194    /// Set image_id
195    pub fn set_image_id(mut self, value: Option<String>) -> Self {
196        self.image_id = value;
197        self
198    }
199
200    /// Set kms_key_id
201    pub fn set_kms_key_id(mut self, value: Option<String>) -> Self {
202        self.kms_key_id = value;
203        self
204    }
205
206    /// Set lifecycle_state
207    pub fn set_lifecycle_state(mut self, value: BootVolumeBackupLifecycleState) -> Self {
208        self.lifecycle_state = value;
209        self
210    }
211
212    /// Set size_in_gbs
213    pub fn set_size_in_gbs(mut self, value: Option<i64>) -> Self {
214        self.size_in_gbs = value;
215        self
216    }
217
218    /// Set source_boot_volume_backup_id
219    pub fn set_source_boot_volume_backup_id(mut self, value: Option<String>) -> Self {
220        self.source_boot_volume_backup_id = value;
221        self
222    }
223
224    /// Set source_type
225    pub fn set_source_type(mut self, value: Option<BootVolumeBackupSourceType>) -> Self {
226        self.source_type = value;
227        self
228    }
229
230    /// Set time_created
231    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
232        self.time_created = value;
233        self
234    }
235
236    /// Set time_request_received
237    pub fn set_time_request_received(mut self, value: Option<DateTime<Utc>>) -> Self {
238        self.time_request_received = value;
239        self
240    }
241
242    /// Set r#type
243    pub fn set_type(mut self, value: Option<BootVolumeBackupType>) -> Self {
244        self.r#type = value;
245        self
246    }
247
248    /// Set unique_size_in_gbs
249    pub fn set_unique_size_in_gbs(mut self, value: Option<i64>) -> Self {
250        self.unique_size_in_gbs = value;
251        self
252    }
253
254    /// Set boot_volume_id (unwraps Option)
255    pub fn with_boot_volume_id(mut self, value: impl Into<String>) -> Self {
256        self.boot_volume_id = Some(value.into());
257        self
258    }
259
260    /// Set defined_tags (unwraps Option)
261    pub fn with_defined_tags(
262        mut self,
263        value: HashMap<String, HashMap<String, serde_json::Value>>,
264    ) -> Self {
265        self.defined_tags = Some(value);
266        self
267    }
268
269    /// Set system_tags (unwraps Option)
270    pub fn with_system_tags(
271        mut self,
272        value: HashMap<String, HashMap<String, serde_json::Value>>,
273    ) -> Self {
274        self.system_tags = Some(value);
275        self
276    }
277
278    /// Set expiration_time (unwraps Option)
279    pub fn with_expiration_time(mut self, value: DateTime<Utc>) -> Self {
280        self.expiration_time = Some(value);
281        self
282    }
283
284    /// Set freeform_tags (unwraps Option)
285    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
286        self.freeform_tags = Some(value);
287        self
288    }
289
290    /// Set image_id (unwraps Option)
291    pub fn with_image_id(mut self, value: impl Into<String>) -> Self {
292        self.image_id = Some(value.into());
293        self
294    }
295
296    /// Set kms_key_id (unwraps Option)
297    pub fn with_kms_key_id(mut self, value: impl Into<String>) -> Self {
298        self.kms_key_id = Some(value.into());
299        self
300    }
301
302    /// Set size_in_gbs (unwraps Option)
303    pub fn with_size_in_gbs(mut self, value: i64) -> Self {
304        self.size_in_gbs = Some(value);
305        self
306    }
307
308    /// Set source_boot_volume_backup_id (unwraps Option)
309    pub fn with_source_boot_volume_backup_id(mut self, value: impl Into<String>) -> Self {
310        self.source_boot_volume_backup_id = Some(value.into());
311        self
312    }
313
314    /// Set source_type (unwraps Option)
315    pub fn with_source_type(mut self, value: BootVolumeBackupSourceType) -> Self {
316        self.source_type = Some(value);
317        self
318    }
319
320    /// Set time_request_received (unwraps Option)
321    pub fn with_time_request_received(mut self, value: DateTime<Utc>) -> Self {
322        self.time_request_received = Some(value);
323        self
324    }
325
326    /// Set r#type (unwraps Option)
327    pub fn with_type(mut self, value: BootVolumeBackupType) -> Self {
328        self.r#type = Some(value);
329        self
330    }
331
332    /// Set unique_size_in_gbs (unwraps Option)
333    pub fn with_unique_size_in_gbs(mut self, value: i64) -> Self {
334        self.unique_size_in_gbs = Some(value);
335        self
336    }
337}