Skip to main content

oci_rust_sdk/core/requests/
create_cpe_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 CreateCpeRequest {
11    /// Details for creating a CPE.
12    pub create_cpe_details: CreateCpeDetails,
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 CreateCpeRequest
20pub struct CreateCpeRequestRequired {
21    /// Details for creating a CPE.
22    pub create_cpe_details: CreateCpeDetails,
23}
24
25impl CreateCpeRequest {
26    /// Create a new CreateCpeRequest with required fields
27    pub fn new(required: CreateCpeRequestRequired) -> Self {
28        Self {
29            create_cpe_details: required.create_cpe_details,
30
31            opc_retry_token: None,
32        }
33    }
34
35    /// Set create_cpe_details
36    pub fn set_create_cpe_details(mut self, value: CreateCpeDetails) -> Self {
37        self.create_cpe_details = value;
38        self
39    }
40
41    /// Set opc_retry_token
42    pub fn set_opc_retry_token(mut self, value: Option<String>) -> Self {
43        self.opc_retry_token = value;
44        self
45    }
46
47    /// Set opc_retry_token (unwraps Option)
48    pub fn with_opc_retry_token(mut self, value: impl Into<String>) -> Self {
49        self.opc_retry_token = Some(value.into());
50        self
51    }
52}