Skip to main content

oci_rust_sdk/core/requests/
update_image_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 UpdateImageRequest {
11    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the image.
12    pub image_id: String,
13
14    /// Updates the image display name field. Avoid entering confidential information.
15    pub update_image_details: UpdateImageDetails,
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 UpdateImageRequest
27pub struct UpdateImageRequestRequired {
28    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the image.
29    pub image_id: String,
30
31    /// Updates the image display name field. Avoid entering confidential information.
32    pub update_image_details: UpdateImageDetails,
33}
34
35impl UpdateImageRequest {
36    /// Create a new UpdateImageRequest with required fields
37    pub fn new(required: UpdateImageRequestRequired) -> Self {
38        Self {
39            image_id: required.image_id,
40
41            update_image_details: required.update_image_details,
42
43            opc_retry_token: None,
44
45            if_match: None,
46        }
47    }
48
49    /// Set image_id
50    pub fn set_image_id(mut self, value: String) -> Self {
51        self.image_id = value;
52        self
53    }
54
55    /// Set update_image_details
56    pub fn set_update_image_details(mut self, value: UpdateImageDetails) -> Self {
57        self.update_image_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}