Skip to main content

oci_rust_sdk/core/requests/
delete_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 DeleteVolumeRequest {
11    /// The OCID of the volume.
12    pub volume_id: String,
13
14    /// 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.
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub if_match: Option<String>,
17}
18
19/// Required fields for DeleteVolumeRequest
20pub struct DeleteVolumeRequestRequired {
21    /// The OCID of the volume.
22    pub volume_id: String,
23}
24
25impl DeleteVolumeRequest {
26    /// Create a new DeleteVolumeRequest with required fields
27    pub fn new(required: DeleteVolumeRequestRequired) -> Self {
28        Self {
29            volume_id: required.volume_id,
30
31            if_match: None,
32        }
33    }
34
35    /// Set volume_id
36    pub fn set_volume_id(mut self, value: String) -> Self {
37        self.volume_id = value;
38        self
39    }
40
41    /// Set if_match
42    pub fn set_if_match(mut self, value: Option<String>) -> Self {
43        self.if_match = value;
44        self
45    }
46
47    /// Set if_match (unwraps Option)
48    pub fn with_if_match(mut self, value: impl Into<String>) -> Self {
49        self.if_match = Some(value.into());
50        self
51    }
52}