oci_rust_sdk/core/models/
instance_summary.rs1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[allow(unused_imports)]
5use super::*;
6#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct InstanceSummary {
10 pub id: String,
12
13 pub availability_domain: String,
15
16 pub compartment_id: String,
18
19 pub instance_configuration_id: String,
21
22 pub region: String,
24
25 pub state: String,
27
28 pub time_created: DateTime<Utc>,
30
31 #[serde(skip_serializing_if = "Option::is_none")]
33 pub display_name: Option<String>,
34
35 #[serde(skip_serializing_if = "Option::is_none")]
37 pub fault_domain: Option<String>,
38
39 #[serde(skip_serializing_if = "Option::is_none")]
41 pub shape: Option<String>,
42
43 #[serde(skip_serializing_if = "Option::is_none")]
45 pub load_balancer_backends: Option<Vec<InstancePoolInstanceLoadBalancerBackend>>,
46}
47
48pub struct InstanceSummaryRequired {
50 pub id: String,
52
53 pub availability_domain: String,
55
56 pub compartment_id: String,
58
59 pub instance_configuration_id: String,
61
62 pub region: String,
64
65 pub state: String,
67
68 pub time_created: DateTime<Utc>,
70}
71
72impl InstanceSummary {
73 pub fn new(required: InstanceSummaryRequired) -> Self {
75 Self {
76 id: required.id,
77
78 availability_domain: required.availability_domain,
79
80 compartment_id: required.compartment_id,
81
82 instance_configuration_id: required.instance_configuration_id,
83
84 region: required.region,
85
86 state: required.state,
87
88 time_created: required.time_created,
89
90 display_name: None,
91
92 fault_domain: None,
93
94 shape: None,
95
96 load_balancer_backends: None,
97 }
98 }
99
100 pub fn set_id(mut self, value: String) -> Self {
102 self.id = value;
103 self
104 }
105
106 pub fn set_availability_domain(mut self, value: String) -> Self {
108 self.availability_domain = value;
109 self
110 }
111
112 pub fn set_compartment_id(mut self, value: String) -> Self {
114 self.compartment_id = value;
115 self
116 }
117
118 pub fn set_display_name(mut self, value: Option<String>) -> Self {
120 self.display_name = value;
121 self
122 }
123
124 pub fn set_fault_domain(mut self, value: Option<String>) -> Self {
126 self.fault_domain = value;
127 self
128 }
129
130 pub fn set_instance_configuration_id(mut self, value: String) -> Self {
132 self.instance_configuration_id = value;
133 self
134 }
135
136 pub fn set_region(mut self, value: String) -> Self {
138 self.region = value;
139 self
140 }
141
142 pub fn set_shape(mut self, value: Option<String>) -> Self {
144 self.shape = value;
145 self
146 }
147
148 pub fn set_state(mut self, value: String) -> Self {
150 self.state = value;
151 self
152 }
153
154 pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
156 self.time_created = value;
157 self
158 }
159
160 pub fn set_load_balancer_backends(
162 mut self,
163 value: Option<Vec<InstancePoolInstanceLoadBalancerBackend>>,
164 ) -> Self {
165 self.load_balancer_backends = value;
166 self
167 }
168
169 pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
171 self.display_name = Some(value.into());
172 self
173 }
174
175 pub fn with_fault_domain(mut self, value: impl Into<String>) -> Self {
177 self.fault_domain = Some(value.into());
178 self
179 }
180
181 pub fn with_shape(mut self, value: impl Into<String>) -> Self {
183 self.shape = Some(value.into());
184 self
185 }
186
187 pub fn with_load_balancer_backends(
189 mut self,
190 value: Vec<InstancePoolInstanceLoadBalancerBackend>,
191 ) -> Self {
192 self.load_balancer_backends = Some(value);
193 self
194 }
195}