1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
use serde::{Deserialize, Serialize}; /*
* Compute Engine API
*
* Creates and runs virtual machines on Google Cloud Platform.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::google_rest_apis::compute_v1::models;
/// Commitment : Represents a regional Commitment resource. Creating a commitment resource means that you are purchasing a committed use contract with an explicit start and end time. You can create commitments based on vCPUs and memory usage and receive discounted rates. For full details, read Signing Up for Committed Use Discounts.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Commitment {
/// Specifies whether to enable automatic renewal for the commitment. The default value is false if not specified. The field can be updated until the day of the commitment expiration at 12:00am PST. If the field is set to true, the commitment will be automatically renewed for either one or three years according to the terms of the existing commitment.
#[serde(rename = "autoRenew", skip_serializing_if = "Option::is_none")]
pub auto_renew: Option<bool>,
/// The category of the commitment. Category MACHINE specifies commitments composed of machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies commitments composed of software licenses, listed in licenseResources. Note that only MACHINE commitments should have a Type specified.
#[serde(rename = "category", skip_serializing_if = "Option::is_none")]
pub category: Option<Category>,
/// [Output Only] Creation timestamp in RFC3339 text format.
#[serde(rename = "creationTimestamp", skip_serializing_if = "Option::is_none")]
pub creation_timestamp: Option<String>,
/// An optional description of this resource. Provide this property when you create the resource.
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// [Output Only] Commitment end time in RFC3339 text format.
#[serde(rename = "endTimestamp", skip_serializing_if = "Option::is_none")]
pub end_timestamp: Option<String>,
/// Specifies the already existing reservations to attach to the Commitment. This field is optional, and it can be a full or partial URL. For example, the following are valid URLs to an reservation: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /reservations/reservation - projects/project/zones/zone/reservations/reservation
#[serde(
rename = "existingReservations",
skip_serializing_if = "Option::is_none"
)]
pub existing_reservations: Option<Vec<String>>,
/// [Output Only] The unique identifier for the resource. This identifier is defined by the server.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// [Output Only] Type of the resource. Always compute#commitment for commitments.
#[serde(rename = "kind", skip_serializing_if = "Option::is_none")]
pub kind: Option<String>,
#[serde(rename = "licenseResource", skip_serializing_if = "Option::is_none")]
pub license_resource: Option<Box<models::LicenseResourceCommitment>>,
/// List of source commitments to be merged into a new commitment.
#[serde(
rename = "mergeSourceCommitments",
skip_serializing_if = "Option::is_none"
)]
pub merge_source_commitments: Option<Vec<String>>,
/// Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
#[serde(rename = "plan", skip_serializing_if = "Option::is_none")]
pub plan: Option<Plan>,
/// [Output Only] URL of the region where this commitment may be used.
#[serde(rename = "region", skip_serializing_if = "Option::is_none")]
pub region: Option<String>,
/// List of create-on-create reservations for this commitment.
#[serde(rename = "reservations", skip_serializing_if = "Option::is_none")]
pub reservations: Option<Vec<models::Reservation>>,
/// A list of commitment amounts for particular resources. Note that VCPU and MEMORY resource commitments must occur together.
#[serde(rename = "resources", skip_serializing_if = "Option::is_none")]
pub resources: Option<Vec<models::ResourceCommitment>>,
/// [Output Only] Server-defined URL for the resource.
#[serde(rename = "selfLink", skip_serializing_if = "Option::is_none")]
pub self_link: Option<String>,
/// Source commitment to be split into a new commitment.
#[serde(
rename = "splitSourceCommitment",
skip_serializing_if = "Option::is_none"
)]
pub split_source_commitment: Option<String>,
/// [Output Only] Commitment start time in RFC3339 text format.
#[serde(rename = "startTimestamp", skip_serializing_if = "Option::is_none")]
pub start_timestamp: Option<String>,
/// [Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
/// [Output Only] An optional, human-readable explanation of the status.
#[serde(rename = "statusMessage", skip_serializing_if = "Option::is_none")]
pub status_message: Option<String>,
/// The type of commitment, which affects the discount rate and the eligible resources. Type MEMORY_OPTIMIZED specifies a commitment that will only apply to memory optimized machines. Type ACCELERATOR_OPTIMIZED specifies a commitment that will only apply to accelerator optimized machines.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub r#type: Option<Type>,
}
impl Commitment {
/// Represents a regional Commitment resource. Creating a commitment resource means that you are purchasing a committed use contract with an explicit start and end time. You can create commitments based on vCPUs and memory usage and receive discounted rates. For full details, read Signing Up for Committed Use Discounts.
pub fn new() -> Commitment {
Commitment {
auto_renew: None,
category: None,
creation_timestamp: None,
description: None,
end_timestamp: None,
existing_reservations: None,
id: None,
kind: None,
license_resource: None,
merge_source_commitments: None,
name: None,
plan: None,
region: None,
reservations: None,
resources: None,
self_link: None,
split_source_commitment: None,
start_timestamp: None,
status: None,
status_message: None,
r#type: None,
}
}
}
/// The category of the commitment. Category MACHINE specifies commitments composed of machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies commitments composed of software licenses, listed in licenseResources. Note that only MACHINE commitments should have a Type specified.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Category {
#[serde(rename = "CATEGORY_UNSPECIFIED")]
CategoryUnspecified,
#[serde(rename = "LICENSE")]
License,
#[serde(rename = "MACHINE")]
Machine,
}
impl Default for Category {
fn default() -> Category {
Self::CategoryUnspecified
}
}
/// The plan for this commitment, which determines duration and discount rate. The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Plan {
#[serde(rename = "INVALID")]
Invalid,
#[serde(rename = "THIRTY_SIX_MONTH")]
ThirtySixMonth,
#[serde(rename = "TWELVE_MONTH")]
TwelveMonth,
}
impl Default for Plan {
fn default() -> Plan {
Self::Invalid
}
}
/// [Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end date defined). One of the following values: NOT_YET_ACTIVE, ACTIVE, EXPIRED.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "ACTIVE")]
Active,
#[serde(rename = "CANCELLED")]
Cancelled,
#[serde(rename = "CREATING")]
Creating,
#[serde(rename = "EXPIRED")]
Expired,
#[serde(rename = "NOT_YET_ACTIVE")]
NotYetActive,
}
impl Default for Status {
fn default() -> Status {
Self::Active
}
}
/// The type of commitment, which affects the discount rate and the eligible resources. Type MEMORY_OPTIMIZED specifies a commitment that will only apply to memory optimized machines. Type ACCELERATOR_OPTIMIZED specifies a commitment that will only apply to accelerator optimized machines.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "ACCELERATOR_OPTIMIZED")]
AcceleratorOptimized,
#[serde(rename = "ACCELERATOR_OPTIMIZED_A3")]
AcceleratorOptimizedA3,
#[serde(rename = "COMPUTE_OPTIMIZED")]
ComputeOptimized,
#[serde(rename = "COMPUTE_OPTIMIZED_C2D")]
ComputeOptimizedC2D,
#[serde(rename = "COMPUTE_OPTIMIZED_C3")]
ComputeOptimizedC3,
#[serde(rename = "COMPUTE_OPTIMIZED_C3D")]
ComputeOptimizedC3D,
#[serde(rename = "COMPUTE_OPTIMIZED_H3")]
ComputeOptimizedH3,
#[serde(rename = "GENERAL_PURPOSE")]
GeneralPurpose,
#[serde(rename = "GENERAL_PURPOSE_E2")]
GeneralPurposeE2,
#[serde(rename = "GENERAL_PURPOSE_N2")]
GeneralPurposeN2,
#[serde(rename = "GENERAL_PURPOSE_N2D")]
GeneralPurposeN2D,
#[serde(rename = "GENERAL_PURPOSE_T2D")]
GeneralPurposeT2D,
#[serde(rename = "GRAPHICS_OPTIMIZED")]
GraphicsOptimized,
#[serde(rename = "MEMORY_OPTIMIZED")]
MemoryOptimized,
#[serde(rename = "MEMORY_OPTIMIZED_M3")]
MemoryOptimizedM3,
#[serde(rename = "STORAGE_OPTIMIZED_Z3")]
StorageOptimizedZ3,
#[serde(rename = "TYPE_UNSPECIFIED")]
TypeUnspecified,
}
impl Default for Type {
fn default() -> Type {
Self::AcceleratorOptimized
}
}