Skip to main content

oci_rust_sdk/core/requests/
update_subnet_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 UpdateSubnetRequest {
11    /// Specify the [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet.
12    pub subnet_id: String,
13
14    /// Details object for updating a subnet.
15    pub update_subnet_details: UpdateSubnetDetails,
16
17    /// 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.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub if_match: Option<String>,
20}
21
22/// Required fields for UpdateSubnetRequest
23pub struct UpdateSubnetRequestRequired {
24    /// Specify the [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet.
25    pub subnet_id: String,
26
27    /// Details object for updating a subnet.
28    pub update_subnet_details: UpdateSubnetDetails,
29}
30
31impl UpdateSubnetRequest {
32    /// Create a new UpdateSubnetRequest with required fields
33    pub fn new(required: UpdateSubnetRequestRequired) -> Self {
34        Self {
35            subnet_id: required.subnet_id,
36
37            update_subnet_details: required.update_subnet_details,
38
39            if_match: None,
40        }
41    }
42
43    /// Set subnet_id
44    pub fn set_subnet_id(mut self, value: String) -> Self {
45        self.subnet_id = value;
46        self
47    }
48
49    /// Set update_subnet_details
50    pub fn set_update_subnet_details(mut self, value: UpdateSubnetDetails) -> Self {
51        self.update_subnet_details = value;
52        self
53    }
54
55    /// Set if_match
56    pub fn set_if_match(mut self, value: Option<String>) -> Self {
57        self.if_match = value;
58        self
59    }
60
61    /// Set if_match (unwraps Option)
62    pub fn with_if_match(mut self, value: impl Into<String>) -> Self {
63        self.if_match = Some(value.into());
64        self
65    }
66}