Skip to main content

oci_rust_sdk/core/requests/
update_volume_request.rs

1use serde::{Deserialize, Serialize};
2
3#[allow(unused_imports)]
4use super::super::models::*;
5#[allow(unused_imports)]
6use super::*;
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct UpdateVolumeRequest {
11    /// The OCID of the volume.
12    pub volume_id: String,
13
14    /// Update volume's display name. Avoid entering confidential information.
15    pub update_volume_details: UpdateVolumeDetails,
16
17    /// For optimistic concurrency control. In the PUT or DELETE call for a resource, set the {@code if-match} parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub if_match: Option<String>,
20}
21
22/// Required fields for UpdateVolumeRequest
23pub struct UpdateVolumeRequestRequired {
24    /// The OCID of the volume.
25    pub volume_id: String,
26
27    /// Update volume's display name. Avoid entering confidential information.
28    pub update_volume_details: UpdateVolumeDetails,
29}
30
31impl UpdateVolumeRequest {
32    /// Create a new UpdateVolumeRequest with required fields
33    pub fn new(required: UpdateVolumeRequestRequired) -> Self {
34        Self {
35            volume_id: required.volume_id,
36
37            update_volume_details: required.update_volume_details,
38
39            if_match: None,
40        }
41    }
42
43    /// Set volume_id
44    pub fn set_volume_id(mut self, value: String) -> Self {
45        self.volume_id = value;
46        self
47    }
48
49    /// Set update_volume_details
50    pub fn set_update_volume_details(mut self, value: UpdateVolumeDetails) -> Self {
51        self.update_volume_details = value;
52        self
53    }
54
55    /// Set if_match
56    pub fn set_if_match(mut self, value: Option<String>) -> Self {
57        self.if_match = value;
58        self
59    }
60
61    /// Set if_match (unwraps Option)
62    pub fn with_if_match(mut self, value: impl Into<String>) -> Self {
63        self.if_match = Some(value.into());
64        self
65    }
66}