Skip to main content

oci_rust_sdk/core/requests/
attach_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 AttachVolumeRequest {
11    /// Attach volume request
12    pub attach_volume_details: AttachServiceDeterminedVolumeDetails,
13
14    /// A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub opc_retry_token: Option<String>,
17}
18
19/// Required fields for AttachVolumeRequest
20pub struct AttachVolumeRequestRequired {
21    /// Attach volume request
22    pub attach_volume_details: AttachServiceDeterminedVolumeDetails,
23}
24
25impl AttachVolumeRequest {
26    /// Create a new AttachVolumeRequest with required fields
27    pub fn new(required: AttachVolumeRequestRequired) -> Self {
28        Self {
29            attach_volume_details: required.attach_volume_details,
30
31            opc_retry_token: None,
32        }
33    }
34
35    /// Set attach_volume_details
36    pub fn set_attach_volume_details(
37        mut self,
38        value: AttachServiceDeterminedVolumeDetails,
39    ) -> Self {
40        self.attach_volume_details = value;
41        self
42    }
43
44    /// Set opc_retry_token
45    pub fn set_opc_retry_token(mut self, value: Option<String>) -> Self {
46        self.opc_retry_token = value;
47        self
48    }
49
50    /// Set opc_retry_token (unwraps Option)
51    pub fn with_opc_retry_token(mut self, value: impl Into<String>) -> Self {
52        self.opc_retry_token = Some(value.into());
53        self
54    }
55}