-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
TemplateResponse.java
357 lines (276 loc) · 10.6 KB
/
TemplateResponse.java
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponseWithTagInformation;
import org.apache.cloudstack.api.EntityReference;
import com.cloud.serializer.Param;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = VirtualMachineTemplate.class)
@SuppressWarnings("unused")
public class TemplateResponse extends BaseResponseWithTagInformation implements ControlledViewEntityResponse {
@SerializedName(ApiConstants.ID)
@Param(description = "the template ID")
private String id;
@SerializedName(ApiConstants.NAME)
@Param(description = "the template name")
private String name;
@SerializedName(ApiConstants.DISPLAY_TEXT)
@Param(description = "the template display text")
private String displayText;
@SerializedName(ApiConstants.IS_PUBLIC)
// propName="public" (FIXME: this used to be part of Param annotation, do we need it?)
@Param(description = "true if this template is a public template, false otherwise")
private boolean isPublic;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date this template was created")
private Date created;
@SerializedName("removed")
@Param(description = "the date this template was removed")
private Date removed;
@SerializedName(ApiConstants.IS_READY)
// propName="ready" (FIXME: this used to be part of Param annotation, do we need it?)
@Param(description = "true if the template is ready to be deployed from, false otherwise.")
private boolean isReady;
@SerializedName(ApiConstants.PASSWORD_ENABLED)
@Param(description = "true if the reset password feature is enabled, false otherwise")
private Boolean passwordEnabled;
@SerializedName(ApiConstants.FORMAT)
@Param(description = "the format of the template.")
private ImageFormat format;
@SerializedName(ApiConstants.BOOTABLE)
@Param(description = "true if the ISO is bootable, false otherwise")
private Boolean bootable;
@SerializedName(ApiConstants.IS_FEATURED)
@Param(description = "true if this template is a featured template, false otherwise")
private boolean featured;
@SerializedName("crossZones")
@Param(description = "true if the template is managed across all Zones, false otherwise")
private boolean crossZones;
@SerializedName(ApiConstants.OS_TYPE_ID)
@Param(description = "the ID of the OS type for this template.")
private String osTypeId;
@SerializedName("ostypename")
@Param(description = "the name of the OS type for this template.")
private String osTypeName;
@SerializedName(ApiConstants.ACCOUNT_ID)
@Param(description = "the account id to which the template belongs")
private String accountId;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account name to which the template belongs")
private String account;
//TODO: since a template can be associated to more than one zones, this model is not accurate. For backward-compatibility, keep these fields
// here, but add a zones field to capture multiple zones.
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "the ID of the zone for this template")
private String zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "the name of the zone for this template")
private String zoneName;
@SerializedName(ApiConstants.STATUS)
@Param(description = "the status of the template")
private String status;
@SerializedName(ApiConstants.SIZE)
@Param(description = "the size of the template")
private Long size;
@SerializedName("templatetype")
@Param(description = "the type of the template")
private String templateType;
@SerializedName(ApiConstants.HYPERVISOR)
@Param(description = "the hypervisor on which the template runs")
private String hypervisor;
@SerializedName(ApiConstants.DOMAIN)
@Param(description = "the name of the domain to which the template belongs")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_ID)
@Param(description = "the ID of the domain to which the template belongs")
private String domainId;
@SerializedName(ApiConstants.IS_EXTRACTABLE)
@Param(description = "true if the template is extractable, false otherwise")
private Boolean extractable;
@SerializedName(ApiConstants.CHECKSUM)
@Param(description = "checksum of the template")
private String checksum;
@SerializedName("sourcetemplateid")
@Param(description = "the template ID of the parent template if present")
private String sourcetemplateId;
@SerializedName(ApiConstants.HOST_ID)
@Param(description = "the ID of the secondary storage host for the template")
private String hostId;
@SerializedName("hostname")
@Param(description = "the name of the secondary storage host for the template")
private String hostName;
@SerializedName(ApiConstants.TEMPLATE_TAG)
@Param(description = "the tag of this template")
private String templateTag;
@SerializedName(ApiConstants.PROJECT_ID)
@Param(description = "the project id of the template")
private String projectId;
@SerializedName(ApiConstants.PROJECT)
@Param(description = "the project name of the template")
private String projectName;
@SerializedName(ApiConstants.DETAILS)
@Param(description = "additional key/value details tied with template")
private Map details;
@SerializedName(ApiConstants.BITS)
@Param(description="the processor bit size", since = "4.10")
private int bits;
@SerializedName(ApiConstants.SSHKEY_ENABLED)
@Param(description = "true if template is sshkey enabled, false otherwise")
private Boolean sshKeyEnabled;
@SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE)
@Param(description = "true if template contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
private Boolean isDynamicallyScalable;
public TemplateResponse() {
tags = new LinkedHashSet<ResourceTagResponse>();
}
@Override
public String getObjectId() {
return this.getId();
}
public String getId() {
return id;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setAccountId(String accountId) {
this.accountId = accountId;
}
@Override
public void setAccountName(String account) {
this.account = account;
}
public void setOsTypeId(String osTypeId) {
this.osTypeId = osTypeId;
}
public void setOsTypeName(String osTypeName) {
this.osTypeName = osTypeName;
}
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setDisplayText(String displayText) {
this.displayText = displayText;
}
public void setPublic(boolean isPublic) {
this.isPublic = isPublic;
}
public void setCreated(Date created) {
this.created = created;
}
public void setRemoved(Date removed) {
this.removed = removed;
}
public void setReady(boolean isReady) {
this.isReady = isReady;
}
public void setPasswordEnabled(boolean passwordEnabled) {
this.passwordEnabled = passwordEnabled;
}
public void setFormat(ImageFormat format) {
this.format = format;
}
public void setBootable(Boolean bootable) {
this.bootable = bootable;
}
public void setFeatured(boolean featured) {
this.featured = featured;
}
public void setCrossZones(boolean crossZones) {
this.crossZones = crossZones;
}
public void setStatus(String status) {
this.status = status;
}
public void setSize(Long size) {
this.size = size;
}
public void setTemplateType(String templateType) {
this.templateType = templateType;
}
public void setHypervisor(String hypervisor) {
this.hypervisor = hypervisor;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setExtractable(Boolean extractable) {
this.extractable = extractable;
}
public void setChecksum(String checksum) {
this.checksum = checksum;
}
public void setSourceTemplateId(String sourcetemplateId) {
this.sourcetemplateId = sourcetemplateId;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
public void setTemplateTag(String templateTag) {
this.templateTag = templateTag;
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public Map getDetails() {
return this.details;
}
public void setDetails(Map details) {
this.details = details;
}
public void setTags(Set<ResourceTagResponse> tags) {
this.tags = tags;
}
public void setSshKeyEnabled(boolean sshKeyEnabled) {
this.sshKeyEnabled = sshKeyEnabled;
}
public void setDynamicallyScalable(boolean isDynamicallyScalable) {
this.isDynamicallyScalable = isDynamicallyScalable;
}
public String getZoneId() {
return zoneId;
}
public void setBits(int bits) {
this.bits = bits;
}
}