Skip to main content

oci_rust_sdk/core/models/
instance_pool_instance.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[allow(unused_imports)]
5use super::*;
6/// Information about an instance that belongs to an instance pool.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct InstancePoolInstance {
10    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance.
11    pub id: String,
12
13    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance pool.
14    pub instance_pool_id: String,
15
16    /// The availability domain the instance is running in.
17    pub availability_domain: String,
18
19    /// The attachment state of the instance in relation to the instance pool.
20    pub lifecycle_state: InstancePoolInstanceLifecycleState,
21
22    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment that contains the instance.
23    pub compartment_id: String,
24
25    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance configuration used to create the instance.
26    pub instance_configuration_id: String,
27
28    /// The region that contains the availability domain the instance is running in.
29    pub region: String,
30
31    /// The shape of the instance. The shape determines the number of CPUs, amount of memory, and other resources allocated to the instance.
32    pub shape: String,
33
34    /// The lifecycle state of the instance. Refer to {@code lifecycleState} in the {@link Instance} resource.
35    pub state: String,
36
37    /// The date and time the instance pool instance was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
38    pub time_created: DateTime<Utc>,
39
40    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub display_name: Option<String>,
43
44    /// The fault domain the instance is running in.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub fault_domain: Option<String>,
47
48    /// The load balancer backends that are configured for the instance.
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub load_balancer_backends: Option<Vec<InstancePoolInstanceLoadBalancerBackend>>,
51}
52
53/// Required fields for InstancePoolInstance
54pub struct InstancePoolInstanceRequired {
55    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance.
56    pub id: String,
57
58    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance pool.
59    pub instance_pool_id: String,
60
61    /// The availability domain the instance is running in.
62    pub availability_domain: String,
63
64    /// The attachment state of the instance in relation to the instance pool.
65    pub lifecycle_state: InstancePoolInstanceLifecycleState,
66
67    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment that contains the instance.
68    pub compartment_id: String,
69
70    /// The [OCID](https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the instance configuration used to create the instance.
71    pub instance_configuration_id: String,
72
73    /// The region that contains the availability domain the instance is running in.
74    pub region: String,
75
76    /// The shape of the instance. The shape determines the number of CPUs, amount of memory, and other resources allocated to the instance.
77    pub shape: String,
78
79    /// The lifecycle state of the instance. Refer to {@code lifecycleState} in the {@link Instance} resource.
80    pub state: String,
81
82    /// The date and time the instance pool instance was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
83    pub time_created: DateTime<Utc>,
84}
85
86impl InstancePoolInstance {
87    /// Create a new InstancePoolInstance with required fields
88    pub fn new(required: InstancePoolInstanceRequired) -> Self {
89        Self {
90            id: required.id,
91
92            instance_pool_id: required.instance_pool_id,
93
94            availability_domain: required.availability_domain,
95
96            lifecycle_state: required.lifecycle_state,
97
98            compartment_id: required.compartment_id,
99
100            instance_configuration_id: required.instance_configuration_id,
101
102            region: required.region,
103
104            shape: required.shape,
105
106            state: required.state,
107
108            time_created: required.time_created,
109
110            display_name: None,
111
112            fault_domain: None,
113
114            load_balancer_backends: None,
115        }
116    }
117
118    /// Set id
119    pub fn set_id(mut self, value: String) -> Self {
120        self.id = value;
121        self
122    }
123
124    /// Set instance_pool_id
125    pub fn set_instance_pool_id(mut self, value: String) -> Self {
126        self.instance_pool_id = value;
127        self
128    }
129
130    /// Set availability_domain
131    pub fn set_availability_domain(mut self, value: String) -> Self {
132        self.availability_domain = value;
133        self
134    }
135
136    /// Set lifecycle_state
137    pub fn set_lifecycle_state(mut self, value: InstancePoolInstanceLifecycleState) -> Self {
138        self.lifecycle_state = value;
139        self
140    }
141
142    /// Set compartment_id
143    pub fn set_compartment_id(mut self, value: String) -> Self {
144        self.compartment_id = value;
145        self
146    }
147
148    /// Set display_name
149    pub fn set_display_name(mut self, value: Option<String>) -> Self {
150        self.display_name = value;
151        self
152    }
153
154    /// Set fault_domain
155    pub fn set_fault_domain(mut self, value: Option<String>) -> Self {
156        self.fault_domain = value;
157        self
158    }
159
160    /// Set instance_configuration_id
161    pub fn set_instance_configuration_id(mut self, value: String) -> Self {
162        self.instance_configuration_id = value;
163        self
164    }
165
166    /// Set region
167    pub fn set_region(mut self, value: String) -> Self {
168        self.region = value;
169        self
170    }
171
172    /// Set shape
173    pub fn set_shape(mut self, value: String) -> Self {
174        self.shape = value;
175        self
176    }
177
178    /// Set state
179    pub fn set_state(mut self, value: String) -> Self {
180        self.state = value;
181        self
182    }
183
184    /// Set time_created
185    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
186        self.time_created = value;
187        self
188    }
189
190    /// Set load_balancer_backends
191    pub fn set_load_balancer_backends(
192        mut self,
193        value: Option<Vec<InstancePoolInstanceLoadBalancerBackend>>,
194    ) -> Self {
195        self.load_balancer_backends = value;
196        self
197    }
198
199    /// Set display_name (unwraps Option)
200    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
201        self.display_name = Some(value.into());
202        self
203    }
204
205    /// Set fault_domain (unwraps Option)
206    pub fn with_fault_domain(mut self, value: impl Into<String>) -> Self {
207        self.fault_domain = Some(value.into());
208        self
209    }
210
211    /// Set load_balancer_backends (unwraps Option)
212    pub fn with_load_balancer_backends(
213        mut self,
214        value: Vec<InstancePoolInstanceLoadBalancerBackend>,
215    ) -> Self {
216        self.load_balancer_backends = Some(value);
217        self
218    }
219}