Skip to main content

oci_rust_sdk/core/models/
boot_volume.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// A detachable boot volume device that contains the image used to boot a Compute instance. For more information, see [Overview of Boot Volumes](https://docs.oracle.com/iaas/Content/Block/Concepts/bootvolumes.htm). <p> 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 BootVolume {
11    /// The availability domain of the boot volume. <p> Example: {@code Uocm:PHX-AD-1}
12    pub availability_domain: String,
13
14    /// The OCID of the compartment that contains the boot volume.
15    pub compartment_id: String,
16
17    /// The boot volume's Oracle ID (OCID).
18    pub id: String,
19
20    /// The current state of a boot volume.
21    pub lifecycle_state: BootVolumeLifecycleState,
22
23    /// The size of the volume in MBs. The value must be a multiple of 1024. This field is deprecated. Please use sizeInGBs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
24    pub size_in_mbs: i64,
25
26    /// The date and time the boot volume was created. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
27    pub time_created: DateTime<Utc>,
28
29    /// 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\"}}}
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
32
33    /// System tags for this resource. Each key is predefined and scoped to a namespace. Example: {@code {\"foo-namespace\": {\"bar-key\": \"value\"}}}
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub system_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
36
37    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub display_name: Option<String>,
40
41    /// 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\"}}
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub freeform_tags: Option<HashMap<String, String>>,
44
45    /// The image OCID used to create the boot volume.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub image_id: Option<String>,
48
49    /// Specifies whether the boot volume's data has finished copying from the source boot volume or boot volume backup.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub is_hydrated: Option<bool>,
52
53    /// The clusterPlacementGroup Id of the volume for volume placement.
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub cluster_placement_group_id: Option<String>,
56
57    /// The number of volume performance units (VPUs) that will be applied to this boot volume per GB, representing the Block Volume service's elastic performance options. See [Block Volume Performance Levels](https://docs.oracle.com/iaas/Content/Block/Concepts/blockvolumeperformance.htm#perf_levels) for more information. <p> Allowed values: <p> {@code 10}: Represents Balanced option. <p> {@code 20}: Represents Higher Performance option. <p> {@code 30}-{@code 120}: Represents the Ultra High Performance option. <p> For performance autotune enabled volumes, it would be the Default(Minimum) VPUs/GB. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
58    #[serde(skip_serializing_if = "Option::is_none")]
59    pub vpus_per_gb: Option<i64>,
60
61    /// The size of the boot volume in GBs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
62    #[serde(skip_serializing_if = "Option::is_none")]
63    pub size_in_gbs: Option<i64>,
64
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub source_details: Option<BootVolumeSourceFromBootVolumeBackupDetails>,
67
68    /// The OCID of the source volume group.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub volume_group_id: Option<String>,
71
72    /// The OCID of the Vault service master encryption key assigned to the boot volume.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub kms_key_id: Option<String>,
75
76    /// Specifies whether the auto-tune performance is enabled for this boot volume. This field is deprecated. Use the {@code DetachedVolumeAutotunePolicy} instead to enable the volume for detached autotune.
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub is_auto_tune_enabled: Option<bool>,
79
80    /// The number of Volume Performance Units per GB that this boot volume is effectively tuned to. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
81    #[serde(skip_serializing_if = "Option::is_none")]
82    pub auto_tuned_vpus_per_gb: Option<i64>,
83
84    /// The list of boot volume replicas of this boot volume
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub boot_volume_replicas: Option<Vec<BootVolumeReplicaInfo>>,
87
88    /// The list of autotune policies enabled for this volume.
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub autotune_policies: Option<Vec<AutotunePolicy>>,
91}
92
93/// Required fields for BootVolume
94pub struct BootVolumeRequired {
95    /// The availability domain of the boot volume. <p> Example: {@code Uocm:PHX-AD-1}
96    pub availability_domain: String,
97
98    /// The OCID of the compartment that contains the boot volume.
99    pub compartment_id: String,
100
101    /// The boot volume's Oracle ID (OCID).
102    pub id: String,
103
104    /// The current state of a boot volume.
105    pub lifecycle_state: BootVolumeLifecycleState,
106
107    /// The size of the volume in MBs. The value must be a multiple of 1024. This field is deprecated. Please use sizeInGBs. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
108    pub size_in_mbs: i64,
109
110    /// The date and time the boot volume was created. Format defined by [RFC3339](https://tools.ietf.org/html/rfc3339).
111    pub time_created: DateTime<Utc>,
112}
113
114impl BootVolume {
115    /// Create a new BootVolume with required fields
116    pub fn new(required: BootVolumeRequired) -> Self {
117        Self {
118            availability_domain: required.availability_domain,
119
120            compartment_id: required.compartment_id,
121
122            id: required.id,
123
124            lifecycle_state: required.lifecycle_state,
125
126            size_in_mbs: required.size_in_mbs,
127
128            time_created: required.time_created,
129
130            defined_tags: None,
131
132            system_tags: None,
133
134            display_name: None,
135
136            freeform_tags: None,
137
138            image_id: None,
139
140            is_hydrated: None,
141
142            cluster_placement_group_id: None,
143
144            vpus_per_gb: None,
145
146            size_in_gbs: None,
147
148            source_details: None,
149
150            volume_group_id: None,
151
152            kms_key_id: None,
153
154            is_auto_tune_enabled: None,
155
156            auto_tuned_vpus_per_gb: None,
157
158            boot_volume_replicas: None,
159
160            autotune_policies: None,
161        }
162    }
163
164    /// Set availability_domain
165    pub fn set_availability_domain(mut self, value: String) -> Self {
166        self.availability_domain = value;
167        self
168    }
169
170    /// Set compartment_id
171    pub fn set_compartment_id(mut self, value: String) -> Self {
172        self.compartment_id = value;
173        self
174    }
175
176    /// Set defined_tags
177    pub fn set_defined_tags(
178        mut self,
179        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
180    ) -> Self {
181        self.defined_tags = value;
182        self
183    }
184
185    /// Set system_tags
186    pub fn set_system_tags(
187        mut self,
188        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
189    ) -> Self {
190        self.system_tags = value;
191        self
192    }
193
194    /// Set display_name
195    pub fn set_display_name(mut self, value: Option<String>) -> Self {
196        self.display_name = value;
197        self
198    }
199
200    /// Set freeform_tags
201    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
202        self.freeform_tags = value;
203        self
204    }
205
206    /// Set id
207    pub fn set_id(mut self, value: String) -> Self {
208        self.id = value;
209        self
210    }
211
212    /// Set image_id
213    pub fn set_image_id(mut self, value: Option<String>) -> Self {
214        self.image_id = value;
215        self
216    }
217
218    /// Set is_hydrated
219    pub fn set_is_hydrated(mut self, value: Option<bool>) -> Self {
220        self.is_hydrated = value;
221        self
222    }
223
224    /// Set cluster_placement_group_id
225    pub fn set_cluster_placement_group_id(mut self, value: Option<String>) -> Self {
226        self.cluster_placement_group_id = value;
227        self
228    }
229
230    /// Set vpus_per_gb
231    pub fn set_vpus_per_gb(mut self, value: Option<i64>) -> Self {
232        self.vpus_per_gb = value;
233        self
234    }
235
236    /// Set lifecycle_state
237    pub fn set_lifecycle_state(mut self, value: BootVolumeLifecycleState) -> Self {
238        self.lifecycle_state = value;
239        self
240    }
241
242    /// Set size_in_gbs
243    pub fn set_size_in_gbs(mut self, value: Option<i64>) -> Self {
244        self.size_in_gbs = value;
245        self
246    }
247
248    /// Set size_in_mbs
249    pub fn set_size_in_mbs(mut self, value: i64) -> Self {
250        self.size_in_mbs = value;
251        self
252    }
253
254    /// Set source_details
255    pub fn set_source_details(
256        mut self,
257        value: Option<BootVolumeSourceFromBootVolumeBackupDetails>,
258    ) -> Self {
259        self.source_details = value;
260        self
261    }
262
263    /// Set time_created
264    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
265        self.time_created = value;
266        self
267    }
268
269    /// Set volume_group_id
270    pub fn set_volume_group_id(mut self, value: Option<String>) -> Self {
271        self.volume_group_id = value;
272        self
273    }
274
275    /// Set kms_key_id
276    pub fn set_kms_key_id(mut self, value: Option<String>) -> Self {
277        self.kms_key_id = value;
278        self
279    }
280
281    /// Set is_auto_tune_enabled
282    pub fn set_is_auto_tune_enabled(mut self, value: Option<bool>) -> Self {
283        self.is_auto_tune_enabled = value;
284        self
285    }
286
287    /// Set auto_tuned_vpus_per_gb
288    pub fn set_auto_tuned_vpus_per_gb(mut self, value: Option<i64>) -> Self {
289        self.auto_tuned_vpus_per_gb = value;
290        self
291    }
292
293    /// Set boot_volume_replicas
294    pub fn set_boot_volume_replicas(mut self, value: Option<Vec<BootVolumeReplicaInfo>>) -> Self {
295        self.boot_volume_replicas = value;
296        self
297    }
298
299    /// Set autotune_policies
300    pub fn set_autotune_policies(mut self, value: Option<Vec<AutotunePolicy>>) -> Self {
301        self.autotune_policies = value;
302        self
303    }
304
305    /// Set defined_tags (unwraps Option)
306    pub fn with_defined_tags(
307        mut self,
308        value: HashMap<String, HashMap<String, serde_json::Value>>,
309    ) -> Self {
310        self.defined_tags = Some(value);
311        self
312    }
313
314    /// Set system_tags (unwraps Option)
315    pub fn with_system_tags(
316        mut self,
317        value: HashMap<String, HashMap<String, serde_json::Value>>,
318    ) -> Self {
319        self.system_tags = Some(value);
320        self
321    }
322
323    /// Set display_name (unwraps Option)
324    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
325        self.display_name = Some(value.into());
326        self
327    }
328
329    /// Set freeform_tags (unwraps Option)
330    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
331        self.freeform_tags = Some(value);
332        self
333    }
334
335    /// Set image_id (unwraps Option)
336    pub fn with_image_id(mut self, value: impl Into<String>) -> Self {
337        self.image_id = Some(value.into());
338        self
339    }
340
341    /// Set is_hydrated (unwraps Option)
342    pub fn with_is_hydrated(mut self, value: bool) -> Self {
343        self.is_hydrated = Some(value);
344        self
345    }
346
347    /// Set cluster_placement_group_id (unwraps Option)
348    pub fn with_cluster_placement_group_id(mut self, value: impl Into<String>) -> Self {
349        self.cluster_placement_group_id = Some(value.into());
350        self
351    }
352
353    /// Set vpus_per_gb (unwraps Option)
354    pub fn with_vpus_per_gb(mut self, value: i64) -> Self {
355        self.vpus_per_gb = Some(value);
356        self
357    }
358
359    /// Set size_in_gbs (unwraps Option)
360    pub fn with_size_in_gbs(mut self, value: i64) -> Self {
361        self.size_in_gbs = Some(value);
362        self
363    }
364
365    /// Set source_details (unwraps Option)
366    pub fn with_source_details(
367        mut self,
368        value: BootVolumeSourceFromBootVolumeBackupDetails,
369    ) -> Self {
370        self.source_details = Some(value);
371        self
372    }
373
374    /// Set volume_group_id (unwraps Option)
375    pub fn with_volume_group_id(mut self, value: impl Into<String>) -> Self {
376        self.volume_group_id = Some(value.into());
377        self
378    }
379
380    /// Set kms_key_id (unwraps Option)
381    pub fn with_kms_key_id(mut self, value: impl Into<String>) -> Self {
382        self.kms_key_id = Some(value.into());
383        self
384    }
385
386    /// Set is_auto_tune_enabled (unwraps Option)
387    pub fn with_is_auto_tune_enabled(mut self, value: bool) -> Self {
388        self.is_auto_tune_enabled = Some(value);
389        self
390    }
391
392    /// Set auto_tuned_vpus_per_gb (unwraps Option)
393    pub fn with_auto_tuned_vpus_per_gb(mut self, value: i64) -> Self {
394        self.auto_tuned_vpus_per_gb = Some(value);
395        self
396    }
397
398    /// Set boot_volume_replicas (unwraps Option)
399    pub fn with_boot_volume_replicas(mut self, value: Vec<BootVolumeReplicaInfo>) -> Self {
400        self.boot_volume_replicas = Some(value);
401        self
402    }
403
404    /// Set autotune_policies (unwraps Option)
405    pub fn with_autotune_policies(mut self, value: Vec<AutotunePolicy>) -> Self {
406        self.autotune_policies = Some(value);
407        self
408    }
409}