oci_rust_sdk/core/models/ipsec_connection.rs
1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// A connection between a DRG and CPE. This connection consists of multiple IPSec tunnels. Creating this connection is one of the steps required when setting up a Site-to-Site VPN. <p> *Important:** Each tunnel in an IPSec connection can use either static routing or BGP dynamic routing (see the {@link IPSecConnectionTunnel} object's {@code routing} attribute). Originally only static routing was supported and every IPSec connection was required to have at least one static route configured. To maintain backward compatibility in the API when support for BPG dynamic routing was introduced, the API accepts an empty list of static routes if you configure both of the IPSec tunnels to use BGP dynamic routing. If you switch a tunnel's routing from {@code BGP} to {@code STATIC}, you must first ensure that the IPSec connection is configured with at least one valid CIDR block static route. Oracle uses the IPSec connection's static routes when routing a tunnel's traffic *only* if that tunnel's {@code routing} attribute = {@code STATIC}. Otherwise the static routes are ignored. <p> For more information about the workflow for setting up an IPSec connection, see [Site-to-Site VPN Overview](https://docs.oracle.com/iaas/Content/Network/Tasks/overviewIPsec.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 IPSecConnection {
11 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the IPSec connection.
12 pub compartment_id: String,
13
14 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the {@link Cpe} object.
15 pub cpe_id: String,
16
17 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the DRG.
18 pub drg_id: String,
19
20 /// The IPSec connection's Oracle ID ([OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm)).
21 pub id: String,
22
23 /// The IPSec connection's current state.
24 pub lifecycle_state: IPSecConnectionLifecycleState,
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 /// Your identifier for your CPE device. Can be either an IP address or a hostname (specifically, the fully qualified domain name (FQDN)). The type of identifier here must correspond to the value for {@code cpeLocalIdentifierType}. <p> If you don't provide a value when creating the IPSec connection, the {@code ipAddress} attribute for the {@link Cpe} object specified by {@code cpeId} is used as the {@code cpeLocalIdentifier}. <p> For information about why you'd provide this value, see [If Your CPE Is Behind a NAT Device](https://docs.oracle.com/iaas/Content/Network/Tasks/overviewIPsec.htm#nat). <p> Example IP address: {@code 10.0.3.3} <p> Example hostname: {@code cpe.example.com}
39 #[serde(skip_serializing_if = "Option::is_none")]
40 pub cpe_local_identifier: Option<String>,
41
42 /// The type of identifier for your CPE device. The value here must correspond to the value for {@code cpeLocalIdentifier}.
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub cpe_local_identifier_type: Option<IPSecConnectionCpeLocalIdentifierType>,
45
46 /// Static routes to the CPE. The CIDR must not be a multicast address or class E address. <p> Used for routing a given IPSec tunnel's traffic only if the tunnel is using static routing. If you configure at least one tunnel to use static routing, then you must provide at least one valid static route. If you configure both tunnels to use BGP dynamic routing, you can provide an empty list for the static routes. <p> The CIDR can be either IPv4 or IPv6. IPv6 addressing is supported for all commercial and government regions. See [IPv6 Addresses](https://docs.oracle.com/iaas/Content/Network/Concepts/ipv6.htm). <p> Example: {@code 10.0.1.0/24} <p> Example: {@code 2001:db8::/32}
47 #[serde(skip_serializing_if = "Option::is_none")]
48 pub static_routes: Option<Vec<String>>,
49
50 /// The date and time the IPSec connection was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). <p> Example: {@code 2016-08-25T21:10:29.600Z}
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub time_created: Option<DateTime<Utc>>,
53
54 /// The transport type used for the IPSec connection.
55 #[serde(skip_serializing_if = "Option::is_none")]
56 pub transport_type: Option<IPSecConnectionTransportType>,
57}
58
59/// Required fields for IPSecConnection
60pub struct IPSecConnectionRequired {
61 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the IPSec connection.
62 pub compartment_id: String,
63
64 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the {@link Cpe} object.
65 pub cpe_id: String,
66
67 /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the DRG.
68 pub drg_id: String,
69
70 /// The IPSec connection's Oracle ID ([OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm)).
71 pub id: String,
72
73 /// The IPSec connection's current state.
74 pub lifecycle_state: IPSecConnectionLifecycleState,
75}
76
77impl IPSecConnection {
78 /// Create a new IPSecConnection with required fields
79 pub fn new(required: IPSecConnectionRequired) -> Self {
80 Self {
81 compartment_id: required.compartment_id,
82
83 cpe_id: required.cpe_id,
84
85 drg_id: required.drg_id,
86
87 id: required.id,
88
89 lifecycle_state: required.lifecycle_state,
90
91 defined_tags: None,
92
93 display_name: None,
94
95 freeform_tags: None,
96
97 cpe_local_identifier: None,
98
99 cpe_local_identifier_type: None,
100
101 static_routes: None,
102
103 time_created: None,
104
105 transport_type: None,
106 }
107 }
108
109 /// Set compartment_id
110 pub fn set_compartment_id(mut self, value: String) -> Self {
111 self.compartment_id = value;
112 self
113 }
114
115 /// Set cpe_id
116 pub fn set_cpe_id(mut self, value: String) -> Self {
117 self.cpe_id = value;
118 self
119 }
120
121 /// Set defined_tags
122 pub fn set_defined_tags(
123 mut self,
124 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
125 ) -> Self {
126 self.defined_tags = value;
127 self
128 }
129
130 /// Set display_name
131 pub fn set_display_name(mut self, value: Option<String>) -> Self {
132 self.display_name = value;
133 self
134 }
135
136 /// Set drg_id
137 pub fn set_drg_id(mut self, value: String) -> Self {
138 self.drg_id = value;
139 self
140 }
141
142 /// Set freeform_tags
143 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
144 self.freeform_tags = value;
145 self
146 }
147
148 /// Set id
149 pub fn set_id(mut self, value: String) -> Self {
150 self.id = value;
151 self
152 }
153
154 /// Set lifecycle_state
155 pub fn set_lifecycle_state(mut self, value: IPSecConnectionLifecycleState) -> Self {
156 self.lifecycle_state = value;
157 self
158 }
159
160 /// Set cpe_local_identifier
161 pub fn set_cpe_local_identifier(mut self, value: Option<String>) -> Self {
162 self.cpe_local_identifier = value;
163 self
164 }
165
166 /// Set cpe_local_identifier_type
167 pub fn set_cpe_local_identifier_type(
168 mut self,
169 value: Option<IPSecConnectionCpeLocalIdentifierType>,
170 ) -> Self {
171 self.cpe_local_identifier_type = value;
172 self
173 }
174
175 /// Set static_routes
176 pub fn set_static_routes(mut self, value: Option<Vec<String>>) -> Self {
177 self.static_routes = value;
178 self
179 }
180
181 /// Set time_created
182 pub fn set_time_created(mut self, value: Option<DateTime<Utc>>) -> Self {
183 self.time_created = value;
184 self
185 }
186
187 /// Set transport_type
188 pub fn set_transport_type(mut self, value: Option<IPSecConnectionTransportType>) -> Self {
189 self.transport_type = value;
190 self
191 }
192
193 /// Set defined_tags (unwraps Option)
194 pub fn with_defined_tags(
195 mut self,
196 value: HashMap<String, HashMap<String, serde_json::Value>>,
197 ) -> Self {
198 self.defined_tags = Some(value);
199 self
200 }
201
202 /// Set display_name (unwraps Option)
203 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
204 self.display_name = Some(value.into());
205 self
206 }
207
208 /// Set freeform_tags (unwraps Option)
209 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
210 self.freeform_tags = Some(value);
211 self
212 }
213
214 /// Set cpe_local_identifier (unwraps Option)
215 pub fn with_cpe_local_identifier(mut self, value: impl Into<String>) -> Self {
216 self.cpe_local_identifier = Some(value.into());
217 self
218 }
219
220 /// Set cpe_local_identifier_type (unwraps Option)
221 pub fn with_cpe_local_identifier_type(
222 mut self,
223 value: IPSecConnectionCpeLocalIdentifierType,
224 ) -> Self {
225 self.cpe_local_identifier_type = Some(value);
226 self
227 }
228
229 /// Set static_routes (unwraps Option)
230 pub fn with_static_routes(mut self, value: Vec<String>) -> Self {
231 self.static_routes = Some(value);
232 self
233 }
234
235 /// Set time_created (unwraps Option)
236 pub fn with_time_created(mut self, value: DateTime<Utc>) -> Self {
237 self.time_created = Some(value);
238 self
239 }
240
241 /// Set transport_type (unwraps Option)
242 pub fn with_transport_type(mut self, value: IPSecConnectionTransportType) -> Self {
243 self.transport_type = Some(value);
244 self
245 }
246}