oci_rust_sdk/core/models/
instance_pool.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct InstancePool {
11 pub id: String,
13
14 pub compartment_id: String,
16
17 pub instance_configuration_id: String,
19
20 pub lifecycle_state: InstancePoolLifecycleState,
22
23 pub placement_configurations: Vec<InstancePoolPlacementConfiguration>,
25
26 pub size: i64,
28
29 pub time_created: DateTime<Utc>,
31
32 #[serde(skip_serializing_if = "Option::is_none")]
34 pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
35
36 #[serde(skip_serializing_if = "Option::is_none")]
38 pub display_name: Option<String>,
39
40 #[serde(skip_serializing_if = "Option::is_none")]
42 pub freeform_tags: Option<HashMap<String, String>>,
43
44 #[serde(skip_serializing_if = "Option::is_none")]
46 pub load_balancers: Option<Vec<InstancePoolLoadBalancerAttachment>>,
47
48 #[serde(skip_serializing_if = "Option::is_none")]
50 pub instance_display_name_formatter: Option<String>,
51
52 #[serde(skip_serializing_if = "Option::is_none")]
54 pub instance_hostname_formatter: Option<String>,
55
56 #[serde(skip_serializing_if = "Option::is_none")]
57 pub lifecycle_management: Option<InstancePoolLifecycleManagementDetails>,
58}
59
60pub struct InstancePoolRequired {
62 pub id: String,
64
65 pub compartment_id: String,
67
68 pub instance_configuration_id: String,
70
71 pub lifecycle_state: InstancePoolLifecycleState,
73
74 pub placement_configurations: Vec<InstancePoolPlacementConfiguration>,
76
77 pub size: i64,
79
80 pub time_created: DateTime<Utc>,
82}
83
84impl InstancePool {
85 pub fn new(required: InstancePoolRequired) -> Self {
87 Self {
88 id: required.id,
89
90 compartment_id: required.compartment_id,
91
92 instance_configuration_id: required.instance_configuration_id,
93
94 lifecycle_state: required.lifecycle_state,
95
96 placement_configurations: required.placement_configurations,
97
98 size: required.size,
99
100 time_created: required.time_created,
101
102 defined_tags: None,
103
104 display_name: None,
105
106 freeform_tags: None,
107
108 load_balancers: None,
109
110 instance_display_name_formatter: None,
111
112 instance_hostname_formatter: None,
113
114 lifecycle_management: None,
115 }
116 }
117
118 pub fn set_id(mut self, value: String) -> Self {
120 self.id = value;
121 self
122 }
123
124 pub fn set_compartment_id(mut self, value: String) -> Self {
126 self.compartment_id = value;
127 self
128 }
129
130 pub fn set_defined_tags(
132 mut self,
133 value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
134 ) -> Self {
135 self.defined_tags = value;
136 self
137 }
138
139 pub fn set_display_name(mut self, value: Option<String>) -> Self {
141 self.display_name = value;
142 self
143 }
144
145 pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
147 self.freeform_tags = value;
148 self
149 }
150
151 pub fn set_instance_configuration_id(mut self, value: String) -> Self {
153 self.instance_configuration_id = value;
154 self
155 }
156
157 pub fn set_lifecycle_state(mut self, value: InstancePoolLifecycleState) -> Self {
159 self.lifecycle_state = value;
160 self
161 }
162
163 pub fn set_placement_configurations(
165 mut self,
166 value: Vec<InstancePoolPlacementConfiguration>,
167 ) -> Self {
168 self.placement_configurations = value;
169 self
170 }
171
172 pub fn set_size(mut self, value: i64) -> Self {
174 self.size = value;
175 self
176 }
177
178 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
180 self.time_created = value;
181 self
182 }
183
184 pub fn set_load_balancers(
186 mut self,
187 value: Option<Vec<InstancePoolLoadBalancerAttachment>>,
188 ) -> Self {
189 self.load_balancers = value;
190 self
191 }
192
193 pub fn set_instance_display_name_formatter(mut self, value: Option<String>) -> Self {
195 self.instance_display_name_formatter = value;
196 self
197 }
198
199 pub fn set_instance_hostname_formatter(mut self, value: Option<String>) -> Self {
201 self.instance_hostname_formatter = value;
202 self
203 }
204
205 pub fn set_lifecycle_management(
207 mut self,
208 value: Option<InstancePoolLifecycleManagementDetails>,
209 ) -> Self {
210 self.lifecycle_management = value;
211 self
212 }
213
214 pub fn with_defined_tags(
216 mut self,
217 value: HashMap<String, HashMap<String, serde_json::Value>>,
218 ) -> Self {
219 self.defined_tags = Some(value);
220 self
221 }
222
223 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
225 self.display_name = Some(value.into());
226 self
227 }
228
229 pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
231 self.freeform_tags = Some(value);
232 self
233 }
234
235 pub fn with_load_balancers(mut self, value: Vec<InstancePoolLoadBalancerAttachment>) -> Self {
237 self.load_balancers = Some(value);
238 self
239 }
240
241 pub fn with_instance_display_name_formatter(mut self, value: impl Into<String>) -> Self {
243 self.instance_display_name_formatter = Some(value.into());
244 self
245 }
246
247 pub fn with_instance_hostname_formatter(mut self, value: impl Into<String>) -> Self {
249 self.instance_hostname_formatter = Some(value.into());
250 self
251 }
252
253 pub fn with_lifecycle_management(
255 mut self,
256 value: InstancePoolLifecycleManagementDetails,
257 ) -> Self {
258 self.lifecycle_management = Some(value);
259 self
260 }
261}