Skip to main content

oci_rust_sdk/core/models/
instance_summary.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4#[allow(unused_imports)]
5use super::*;
6/// Condensed instance data when listing instances in an instance pool.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct InstanceSummary {
10    /// The OCID of the instance.
11    pub id: String,
12
13    /// The availability domain the instance is running in.
14    pub availability_domain: String,
15
16    /// The OCID of the compartment that contains the instance.
17    pub compartment_id: String,
18
19    /// The OCID of the instance confgiuration used to create the instance.
20    pub instance_configuration_id: String,
21
22    /// The region that contains the availability domain the instance is running in.
23    pub region: String,
24
25    /// The current state of the instance pool instance.
26    pub state: String,
27
28    /// 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}
29    pub time_created: DateTime<Utc>,
30
31    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub display_name: Option<String>,
34
35    /// The fault domain the instance is running in.
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub fault_domain: Option<String>,
38
39    /// The shape of an instance. The shape determines the number of CPUs, amount of memory, and other resources allocated to the instance. <p> You can enumerate all available shapes by calling {@link #listShapes(ListShapesRequest) listShapes}.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub shape: Option<String>,
42
43    /// The load balancer backends that are configured for the instance pool instance.
44    #[serde(skip_serializing_if = "Option::is_none")]
45    pub load_balancer_backends: Option<Vec<InstancePoolInstanceLoadBalancerBackend>>,
46}
47
48/// Required fields for InstanceSummary
49pub struct InstanceSummaryRequired {
50    /// The OCID of the instance.
51    pub id: String,
52
53    /// The availability domain the instance is running in.
54    pub availability_domain: String,
55
56    /// The OCID of the compartment that contains the instance.
57    pub compartment_id: String,
58
59    /// The OCID of the instance confgiuration used to create the instance.
60    pub instance_configuration_id: String,
61
62    /// The region that contains the availability domain the instance is running in.
63    pub region: String,
64
65    /// The current state of the instance pool instance.
66    pub state: String,
67
68    /// 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}
69    pub time_created: DateTime<Utc>,
70}
71
72impl InstanceSummary {
73    /// Create a new InstanceSummary with required fields
74    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    /// Set id
101    pub fn set_id(mut self, value: String) -> Self {
102        self.id = value;
103        self
104    }
105
106    /// Set availability_domain
107    pub fn set_availability_domain(mut self, value: String) -> Self {
108        self.availability_domain = value;
109        self
110    }
111
112    /// Set compartment_id
113    pub fn set_compartment_id(mut self, value: String) -> Self {
114        self.compartment_id = value;
115        self
116    }
117
118    /// Set display_name
119    pub fn set_display_name(mut self, value: Option<String>) -> Self {
120        self.display_name = value;
121        self
122    }
123
124    /// Set fault_domain
125    pub fn set_fault_domain(mut self, value: Option<String>) -> Self {
126        self.fault_domain = value;
127        self
128    }
129
130    /// Set instance_configuration_id
131    pub fn set_instance_configuration_id(mut self, value: String) -> Self {
132        self.instance_configuration_id = value;
133        self
134    }
135
136    /// Set region
137    pub fn set_region(mut self, value: String) -> Self {
138        self.region = value;
139        self
140    }
141
142    /// Set shape
143    pub fn set_shape(mut self, value: Option<String>) -> Self {
144        self.shape = value;
145        self
146    }
147
148    /// Set state
149    pub fn set_state(mut self, value: String) -> Self {
150        self.state = value;
151        self
152    }
153
154    /// Set time_created
155    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
156        self.time_created = value;
157        self
158    }
159
160    /// Set load_balancer_backends
161    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    /// Set display_name (unwraps Option)
170    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
171        self.display_name = Some(value.into());
172        self
173    }
174
175    /// Set fault_domain (unwraps Option)
176    pub fn with_fault_domain(mut self, value: impl Into<String>) -> Self {
177        self.fault_domain = Some(value.into());
178        self
179    }
180
181    /// Set shape (unwraps Option)
182    pub fn with_shape(mut self, value: impl Into<String>) -> Self {
183        self.shape = Some(value.into());
184        self
185    }
186
187    /// Set load_balancer_backends (unwraps Option)
188    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}