Skip to main content

oci_rust_sdk/core/models/
instance_pool_summary.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use std::collections::HashMap;
4
5#[allow(unused_imports)]
6use super::*;
7/// Summary information for an instance pool.
8#[derive(Debug, Clone, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct InstancePoolSummary {
11    /// The OCID of the instance pool.
12    pub id: String,
13
14    /// The OCID of the compartment containing the instance pool.
15    pub compartment_id: String,
16
17    /// The OCID of the instance configuration associated with the instance pool.
18    pub instance_configuration_id: String,
19
20    /// The current state of the instance pool.
21    pub lifecycle_state: InstancePoolSummaryLifecycleState,
22
23    /// The availability domains for the instance pool.
24    pub availability_domains: Vec<String>,
25
26    /// The number of instances that should be in the instance pool. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
27    pub size: i64,
28
29    /// The date and time the instance pool was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
30    pub time_created: DateTime<Utc>,
31
32    /// A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub display_name: Option<String>,
35
36    /// 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\"}}}
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub defined_tags: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
39
40    /// 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\"}}
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub freeform_tags: Option<HashMap<String, String>>,
43}
44
45/// Required fields for InstancePoolSummary
46pub struct InstancePoolSummaryRequired {
47    /// The OCID of the instance pool.
48    pub id: String,
49
50    /// The OCID of the compartment containing the instance pool.
51    pub compartment_id: String,
52
53    /// The OCID of the instance configuration associated with the instance pool.
54    pub instance_configuration_id: String,
55
56    /// The current state of the instance pool.
57    pub lifecycle_state: InstancePoolSummaryLifecycleState,
58
59    /// The availability domains for the instance pool.
60    pub availability_domains: Vec<String>,
61
62    /// The number of instances that should be in the instance pool. Note: Numbers greater than Number.MAX_SAFE_INTEGER will result in rounding issues.
63    pub size: i64,
64
65    /// The date and time the instance pool was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: {@code 2016-08-25T21:10:29.600Z}
66    pub time_created: DateTime<Utc>,
67}
68
69impl InstancePoolSummary {
70    /// Create a new InstancePoolSummary with required fields
71    pub fn new(required: InstancePoolSummaryRequired) -> Self {
72        Self {
73            id: required.id,
74
75            compartment_id: required.compartment_id,
76
77            instance_configuration_id: required.instance_configuration_id,
78
79            lifecycle_state: required.lifecycle_state,
80
81            availability_domains: required.availability_domains,
82
83            size: required.size,
84
85            time_created: required.time_created,
86
87            display_name: None,
88
89            defined_tags: None,
90
91            freeform_tags: None,
92        }
93    }
94
95    /// Set id
96    pub fn set_id(mut self, value: String) -> Self {
97        self.id = value;
98        self
99    }
100
101    /// Set compartment_id
102    pub fn set_compartment_id(mut self, value: String) -> Self {
103        self.compartment_id = value;
104        self
105    }
106
107    /// Set display_name
108    pub fn set_display_name(mut self, value: Option<String>) -> Self {
109        self.display_name = value;
110        self
111    }
112
113    /// Set instance_configuration_id
114    pub fn set_instance_configuration_id(mut self, value: String) -> Self {
115        self.instance_configuration_id = value;
116        self
117    }
118
119    /// Set lifecycle_state
120    pub fn set_lifecycle_state(mut self, value: InstancePoolSummaryLifecycleState) -> Self {
121        self.lifecycle_state = value;
122        self
123    }
124
125    /// Set availability_domains
126    pub fn set_availability_domains(mut self, value: Vec<String>) -> Self {
127        self.availability_domains = value;
128        self
129    }
130
131    /// Set size
132    pub fn set_size(mut self, value: i64) -> Self {
133        self.size = value;
134        self
135    }
136
137    /// Set time_created
138    pub fn set_time_created(mut self, value: DateTime<Utc>) -> Self {
139        self.time_created = value;
140        self
141    }
142
143    /// Set defined_tags
144    pub fn set_defined_tags(
145        mut self,
146        value: Option<HashMap<String, HashMap<String, serde_json::Value>>>,
147    ) -> Self {
148        self.defined_tags = value;
149        self
150    }
151
152    /// Set freeform_tags
153    pub fn set_freeform_tags(mut self, value: Option<HashMap<String, String>>) -> Self {
154        self.freeform_tags = value;
155        self
156    }
157
158    /// Set display_name (unwraps Option)
159    pub fn with_display_name(mut self, value: impl Into<String>) -> Self {
160        self.display_name = Some(value.into());
161        self
162    }
163
164    /// Set defined_tags (unwraps Option)
165    pub fn with_defined_tags(
166        mut self,
167        value: HashMap<String, HashMap<String, serde_json::Value>>,
168    ) -> Self {
169        self.defined_tags = Some(value);
170        self
171    }
172
173    /// Set freeform_tags (unwraps Option)
174    pub fn with_freeform_tags(mut self, value: HashMap<String, String>) -> Self {
175        self.freeform_tags = Some(value);
176        self
177    }
178}