Skip to main content

oci_rust_sdk/core/requests/
update_instance_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 UpdateInstanceRequest {
11    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance.
12    pub instance_id: String,
13
14    /// Update instance fields
15    pub update_instance_details: UpdateInstanceDetails,
16
17    /// 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).
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub opc_retry_token: Option<String>,
20
21    /// 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.
22    #[serde(skip_serializing_if = "Option::is_none")]
23    pub if_match: Option<String>,
24}
25
26/// Required fields for UpdateInstanceRequest
27pub struct UpdateInstanceRequestRequired {
28    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance.
29    pub instance_id: String,
30
31    /// Update instance fields
32    pub update_instance_details: UpdateInstanceDetails,
33}
34
35impl UpdateInstanceRequest {
36    /// Create a new UpdateInstanceRequest with required fields
37    pub fn new(required: UpdateInstanceRequestRequired) -> Self {
38        Self {
39            instance_id: required.instance_id,
40
41            update_instance_details: required.update_instance_details,
42
43            opc_retry_token: None,
44
45            if_match: None,
46        }
47    }
48
49    /// Set instance_id
50    pub fn set_instance_id(mut self, value: String) -> Self {
51        self.instance_id = value;
52        self
53    }
54
55    /// Set update_instance_details
56    pub fn set_update_instance_details(mut self, value: UpdateInstanceDetails) -> Self {
57        self.update_instance_details = value;
58        self
59    }
60
61    /// Set opc_retry_token
62    pub fn set_opc_retry_token(mut self, value: Option<String>) -> Self {
63        self.opc_retry_token = value;
64        self
65    }
66
67    /// Set if_match
68    pub fn set_if_match(mut self, value: Option<String>) -> Self {
69        self.if_match = value;
70        self
71    }
72
73    /// Set opc_retry_token (unwraps Option)
74    pub fn with_opc_retry_token(mut self, value: impl Into<String>) -> Self {
75        self.opc_retry_token = Some(value.into());
76        self
77    }
78
79    /// Set if_match (unwraps Option)
80    pub fn with_if_match(mut self, value: impl Into<String>) -> Self {
81        self.if_match = Some(value.into());
82        self
83    }
84}