Skip to main content

oci_rust_sdk/core/models/
route_table.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// A collection of {@code RouteRule} objects, which are used to route packets based on destination IP to a particular network entity. For more information, see [Overview of the Networking Service](https://docs.oracle.com/iaas/Content/Network/Concepts/overview.htm). <p> To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.oracle.com/iaas/Content/Identity/Concepts/policygetstarted.htm).
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct RouteTable {
11    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the route table.
12    pub compartment_id: String,
13
14    /// The route table's Oracle ID ([OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm)).
15    pub id: String,
16
17    /// The route table's current state.
18    pub lifecycle_state: RouteTableLifecycleState,
19
20    /// The collection of rules for routing destination IPs to network devices.
21    pub route_rules: Vec<RouteRule>,
22
23    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the VCN the route table list belongs to.
24    pub vcn_id: String,
25
26    /// Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Operations\": {\"CostCenter\": \"42\"}}}
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
29
30    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub display_name: Option<String>,
33
34    /// Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). <p> Example: {@code {\"Department\": \"Finance\"}}
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub freeform_tags: Option<HashMap<String, String>>,
37
38    /// The date and time the route table was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub time_created: Option<DateTime<Utc>>,
41}
42
43/// Required fields for RouteTable
44pub struct RouteTableRequired {
45    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the route table.
46    pub compartment_id: String,
47
48    /// The route table's Oracle ID ([OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm)).
49    pub id: String,
50
51    /// The route table's current state.
52    pub lifecycle_state: RouteTableLifecycleState,
53
54    /// The collection of rules for routing destination IPs to network devices.
55    pub route_rules: Vec<RouteRule>,
56
57    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the VCN the route table list belongs to.
58    pub vcn_id: String,
59}
60
61impl RouteTable {
62    /// Create a new RouteTable with required fields
63    pub fn new(required: RouteTableRequired) -> Self {
64        Self {
65            compartment_id: required.compartment_id,
66
67            id: required.id,
68
69            lifecycle_state: required.lifecycle_state,
70
71            route_rules: required.route_rules,
72
73            vcn_id: required.vcn_id,
74
75            defined_tags: None,
76
77            display_name: None,
78
79            freeform_tags: None,
80
81            time_created: None,
82        }
83    }
84
85    /// Set compartment_id
86    pub fn set_compartment_id(mut self, value: String) -> Self {
87        self.compartment_id = value;
88        self
89    }
90
91    /// Set defined_tags
92    pub fn set_defined_tags(
93        mut self,
94        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
95    ) -> Self {
96        self.defined_tags = value;
97        self
98    }
99
100    /// Set display_name
101    pub fn set_display_name(mut self, value: Option<String>) -> Self {
102        self.display_name = value;
103        self
104    }
105
106    /// Set freeform_tags
107    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
108        self.freeform_tags = value;
109        self
110    }
111
112    /// Set id
113    pub fn set_id(mut self, value: String) -> Self {
114        self.id = value;
115        self
116    }
117
118    /// Set lifecycle_state
119    pub fn set_lifecycle_state(mut self, value: RouteTableLifecycleState) -> Self {
120        self.lifecycle_state = value;
121        self
122    }
123
124    /// Set route_rules
125    pub fn set_route_rules(mut self, value: Vec<RouteRule>) -> Self {
126        self.route_rules = value;
127        self
128    }
129
130    /// Set time_created
131    pub fn set_time_created(mut self, value: Option<DateTime<Utc>>) -> Self {
132        self.time_created = value;
133        self
134    }
135
136    /// Set vcn_id
137    pub fn set_vcn_id(mut self, value: String) -> Self {
138        self.vcn_id = value;
139        self
140    }
141
142    /// Set defined_tags (unwraps Option)
143    pub fn with_defined_tags(
144        mut self,
145        value: HashMap<String, HashMap<String, serde_json::Value>>,
146    ) -> Self {
147        self.defined_tags = Some(value);
148        self
149    }
150
151    /// Set display_name (unwraps Option)
152    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
153        self.display_name = Some(value.into());
154        self
155    }
156
157    /// Set freeform_tags (unwraps Option)
158    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
159        self.freeform_tags = Some(value);
160        self
161    }
162
163    /// Set time_created (unwraps Option)
164    pub fn with_time_created(mut self, value: DateTime<Utc>) -> Self {
165        self.time_created = Some(value);
166        self
167    }
168}