1
1
/*******************************************************************************
2
*Copyright (c) 2009 Eucalyptus Systems, Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, only version 3 of the License.
9
* This file is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Please contact Eucalyptus Systems, Inc., 130 Castilian
18
* Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
19
* if you need additional information or have any questions.
21
* This file may incorporate work covered under the following copyright and
24
* Software License Agreement (BSD License)
26
* Copyright (c) 2008, Regents of the University of California
27
* All rights reserved.
29
* Redistribution and use of this software in source and binary forms, with
30
* or without modification, are permitted provided that the following
33
* Redistributions of source code must retain the above copyright notice,
34
* this list of conditions and the following disclaimer.
36
* Redistributions in binary form must reproduce the above copyright
37
* notice, this list of conditions and the following disclaimer in the
38
* documentation and/or other materials provided with the distribution.
40
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
41
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
42
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
44
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
46
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
51
* THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
52
* LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
53
* SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
54
* IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
55
* BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
56
* THE REGENTSā DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
57
* OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
58
* WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
* ANY SUCH LICENSES OR RIGHTS.
60
*******************************************************************************/
2
*Copyright (c) 2009 Eucalyptus Systems, Inc.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, only version 3 of the License.
9
* This file is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Please contact Eucalyptus Systems, Inc., 130 Castilian
18
* Dr., Goleta, CA 93101 USA or visit <http://www.eucalyptus.com/licenses/>
19
* if you need additional information or have any questions.
21
* This file may incorporate work covered under the following copyright and
24
* Software License Agreement (BSD License)
26
* Copyright (c) 2008, Regents of the University of California
27
* All rights reserved.
29
* Redistribution and use of this software in source and binary forms, with
30
* or without modification, are permitted provided that the following
33
* Redistributions of source code must retain the above copyright notice,
34
* this list of conditions and the following disclaimer.
36
* Redistributions in binary form must reproduce the above copyright
37
* notice, this list of conditions and the following disclaimer in the
38
* documentation and/or other materials provided with the distribution.
40
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
41
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
42
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
43
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
44
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
45
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
46
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
47
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
48
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
49
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
50
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. USERS OF
51
* THIS SOFTWARE ACKNOWLEDGE THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE
52
* LICENSED MATERIAL, COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS
53
* SOFTWARE, AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
54
* IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA, SANTA
55
* BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY, WHICH IN
56
* THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION, REPLACEMENT
57
* OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO IDENTIFIED, OR
58
* WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT NEEDED TO COMPLY WITH
59
* ANY SUCH LICENSES OR RIGHTS.
60
*******************************************************************************/
62
62
* Author: chris grzegorczyk <grze@eucalyptus.com>
64
64
package edu.ucsb.eucalyptus.msgs
66
import com.eucalyptus.binding.HttpEmbedded;
67
import com.eucalyptus.binding.HttpParameterMapping;
66
import com.eucalyptus.binding.HttpEmbedded
67
import com.eucalyptus.binding.HttpParameterMapping
69
public class VmControlMessage extends EucalyptusMessage {}
69
public class VmControlMessage extends EucalyptusMessage {
71
public VmControlMessage( ) {
75
public VmControlMessage( EucalyptusMessage msg ) {
79
public VmControlMessage( String userId ) {
83
public class ResourceTagMessage extends EucalyptusMessage {
85
public ResourceTagMessage( ) {
89
public ResourceTagMessage( EucalyptusMessage msg ) {
93
public ResourceTagMessage( String userId ) {
97
public class VmPlacementMessage extends EucalyptusMessage {
99
public VmPlacementMessage( ) {
103
public VmPlacementMessage( EucalyptusMessage msg ) {
107
public VmPlacementMessage( String userId ) {
70
111
/** *******************************************************************************/
71
112
public class TerminateInstancesResponseType extends VmControlMessage {
72
113
boolean terminated = false;
73
114
ArrayList<TerminateInstancesItemType> instancesSet = new ArrayList<TerminateInstancesItemType>();
75
116
public class TerminateInstancesType extends VmControlMessage {
77
118
@HttpParameterMapping (parameter = "InstanceId")
78
119
ArrayList<String> instancesSet = new ArrayList<String>();
80
def TerminateInstancesType() {}
121
def TerminateInstancesType() {
82
124
def TerminateInstancesType(String instanceId) {
83
125
this.instancesSet.add(instanceId);
86
def TerminateInstancesType(String instanceId, EucalyptusMessage parent) {
87
this.instancesSet.add(instanceId);
88
this.correlationId = parent.correlationId;
89
this.userId = parent.userId;
90
this.effectiveUserId = parent.effectiveUserId;
93
128
/** *******************************************************************************/
94
130
public class DescribeInstancesType extends VmControlMessage {
96
132
@HttpParameterMapping (parameter = "InstanceId")
97
133
ArrayList<String> instancesSet = new ArrayList<String>();
134
@HttpParameterMapping (parameter = "FilterSet")
135
ArrayList<Filter> filterSet = new ArrayList<Filter>();
99
137
public class DescribeInstancesResponseType extends VmControlMessage {
101
139
ArrayList<ReservationInfoType> reservationSet = new ArrayList<ReservationInfoType>();
103
141
/** *******************************************************************************/
104
143
public class RebootInstancesType extends VmControlMessage {
106
145
@HttpParameterMapping (parameter = "InstanceId")
107
146
ArrayList<String> instancesSet = new ArrayList<String>();
109
def RebootInstancesType() {}
148
def RebootInstancesType() {
110
150
def RebootInstancesType(String instanceId) {
111
151
this.instancesSet.add(instanceId);
114
def RebootInstancesType(String instanceId, EucalyptusMessage parent) {
115
this.instancesSet.add(instanceId);
116
this.correlationId = parent.correlationId;
117
this.userId = parent.userId;
118
this.effectiveUserId = parent.effectiveUserId;
121
154
public class RebootInstancesResponseType extends VmControlMessage {
125
156
/** *******************************************************************************/
126
157
public class RunInstancesResponseType extends VmControlMessage {
128
159
ReservationInfoType rsvInfo;
130
163
public class RunInstancesType extends VmControlMessage {
133
166
String reservationId;
147
180
String ramdiskId; //** added 2008-02-01 **/
148
181
@HttpParameterMapping (parameter = "Placement.AvailabilityZone")
149
182
String availabilityZone = "default"; //** added 2008-02-01 **/
183
@HttpParameterMapping (parameter = "Placement.GroupName")
184
String placementGroup = "default"; //** added 2010-02-01 **/
150
185
@HttpEmbedded (multiple = true)
151
186
ArrayList<BlockDeviceMappingItemType> blockDeviceMapping = new ArrayList<BlockDeviceMappingItemType>(); //** added 2008-02-01 **/
152
boolean monitoring = false;
187
Boolean monitoring = false;
155
189
Boolean disableTerminate;
156
String shutdownAction;
190
String shutdownAction = "stop"; //or "terminate"
191
/** InstanceLicenseRequest license; **/
192
String privateIpAddress = "";
193
String clientToken = "";
159
195
ArrayList<Integer> networkIndexList = new ArrayList<Integer>();
160
196
String privateMacBase;
161
197
String publicMacBase;
164
200
VmTypeInfo vmType = new VmTypeInfo();
167
203
public Object clone() {
168
204
RunInstancesType c = (RunInstancesType) super.clone();
169
205
c.instanceIds = new ArrayList<String>();
170
206
if ( this.instanceIds != null )
171
for ( String b: this.instanceIds )
172
c.instanceIds.add((String) b.clone());
207
for ( String b: this.instanceIds )
208
c.instanceIds.add((String) b.clone());
173
209
c.blockDeviceMapping = new ArrayList<BlockDeviceMappingItemType>();
174
210
if ( this.blockDeviceMapping != null )
175
for ( BlockDeviceMappingItemType b: this.blockDeviceMapping )
176
c.blockDeviceMapping.add((BlockDeviceMappingItemType) b.clone());
211
for ( BlockDeviceMappingItemType b: this.blockDeviceMapping )
212
c.blockDeviceMapping.add((BlockDeviceMappingItemType) b.clone());
177
213
if ( this.vmType != null )
178
c.vmType = (VmTypeInfo) this.vmType.clone();
214
c.vmType = (VmTypeInfo) this.vmType.clone();
179
215
c.networkIndexList = this.networkIndexList.clone( );
184
220
/** *******************************************************************************/
185
221
public class GetConsoleOutputResponseType extends VmControlMessage {
187
223
String instanceId;
191
228
public class GetConsoleOutputType extends VmControlMessage {
192
229
@HttpParameterMapping (parameter = "InstanceId.1")
193
230
String instanceId;
233
public class GetPasswordDataType extends VmControlMessage {
236
public class GetPasswordDataResponseType extends VmControlMessage {
195
242
/** *******************************************************************************/
196
243
public class ReservationInfoType extends EucalyptusData {
197
244
String reservationId;
199
246
ArrayList<String> groupSet = new ArrayList<String>();
200
247
ArrayList<RunningInstancesItemType> instancesSet = new ArrayList<RunningInstancesItemType>();
202
249
def ReservationInfoType(final reservationId, final ownerId, final groupSet) {
203
250
this.reservationId = reservationId;
204
251
this.ownerId = ownerId;
205
this.groupSet = groupSet;
252
this.groupSet.addAll( groupSet );
208
255
def ReservationInfoType() {
211
public class RunningInstancesItemType extends EucalyptusData {
258
public class RunningInstancesItemType extends EucalyptusData implements Comparable<RunningInstancesItemType> {
212
259
String instanceId;
214
261
String stateCode;
224
271
String placement;
227
boolean monitoring = false;
275
Boolean monitoring = false;
276
Boolean disableApiTermination = false;
277
Boolean instanceInitiatedShutdownBehavior = "stop"; //or "terminate"
279
String privateIpAddress;
280
String rootDeviceType = "instance-store";
281
String rootDeviceName = "/dev/sda1";
282
ArrayList<InstanceBlockDeviceMapping> blockDevices = new ArrayList<InstanceBlockDeviceMapping>();
284
public int compareTo( RunningInstancesItemType that ) {
285
return this.instanceId.compareTo( that.instanceId );
288
public int hashCode( ) {
289
final int prime = 31;
291
result = prime * result + ( ( this.instanceId == null )
293
: this.instanceId.hashCode( ) );
297
public boolean equals( Object obj ) {
298
if ( this.is( obj ) ) {
304
if ( !getClass( ).equals( obj.getClass( ) ) ) {
307
RunningInstancesItemType other = ( RunningInstancesItemType ) obj;
308
if ( this.instanceId == null ) {
309
if ( other.instanceId != null ) {
312
} else if ( !this.instanceId.equals( other.instanceId ) ) {
320
public class InstanceBlockDeviceMapping extends EucalyptusData {
322
EbsInstanceBlockDeviceMapping ebs;
323
public InstanceBlockDeviceMapping() {}
324
public InstanceBlockDeviceMapping( String deviceName ) {
325
this.deviceName = deviceName;
327
public InstanceBlockDeviceMapping( String deviceName, String volumeId, String status, Date attachTime ) {
328
this.deviceName = deviceName;
329
this.ebs = new EbsInstanceBlockDeviceMapping( volumeId, status, attachTime );
333
public class EbsInstanceBlockDeviceMapping extends EucalyptusData {
337
Boolean deleteOnTermination = Boolean.TRUE;
338
public EbsInstanceBlockDeviceMapping() {}
339
public EbsInstanceBlockDeviceMapping( String volumeId, String status, Date attachTime ) {
340
this.volumeId = volumeId;
341
this.status = status;
342
this.attachTime = attachTime;
345
public class EbsDeviceMapping extends EucalyptusData { //** added 2008-02-01 **/
346
String virtualName; // ephemeralN, root, ami, swap
348
Integer volumeSize = null;
349
Boolean deleteOnTermination = Boolean.TRUE;
229
352
public class BlockDeviceMappingItemType extends EucalyptusData { //** added 2008-02-01 **/
230
353
String virtualName; // ephemeralN, root, ami, swap
231
354
String deviceName;
232
// Integer deviceSize; // in megabytes
233
// String format; // optional, defaults to none (none, ext3, ntfs, swap)
355
Integer size; // in megabytes //TODO:GRZE: maybe remove
356
String format; // optional, defaults to none (none, ext3, ntfs, swap) //TODO:GRZE: maybe remove
357
@HttpEmbedded (multiple = true)
358
EbsDeviceMapping ebs;
234
359
def BlockDeviceMappingItemType(final virtualName, final deviceName) {
235
360
this.virtualName = virtualName;
236
361
this.deviceName = deviceName;
239
364
def BlockDeviceMappingItemType() {
257
382
this.shutdownStateCode = shutdownStateCode;
258
383
this.shutdownStateName = shutdownStateName;
261
386
def TerminateInstancesItemType() {
390
public int hashCode( ) {
391
final int prime = 31;
393
result = prime * result + ( ( this.instanceId == null ) ? 0 : this.instanceId.hashCode( ) );
398
public boolean equals( Object obj ) {
399
if ( this.is( obj ) ) {
405
if ( !getClass( ).is( obj.getClass( ) ) ) {
408
TerminateInstancesItemType other = ( TerminateInstancesItemType ) obj;
409
if ( this.instanceId == null ) {
410
if ( other.instanceId != null ) {
413
} else if ( !this.instanceId.equals( other.instanceId ) ) {
421
public class StopInstancesResponseType extends VmControlMessage{
422
ArrayList<TerminateInstancesItemType> instancesSet = new ArrayList<TerminateInstancesItemType>();
423
public StopInstancesResponseType() { }
426
public class StopInstancesType extends VmControlMessage{
427
@HttpParameterMapping( parameter = "InstanceId" )
428
ArrayList<String> instancesSet = new ArrayList<String>();
430
public StopInstancesType() { }
432
public class StartInstancesResponseType extends VmControlMessage{
433
ArrayList<TerminateInstancesItemType> instancesSet = new ArrayList<TerminateInstancesItemType>();
434
public StartInstancesResponseType() { }
437
public class StartInstancesType extends VmControlMessage{
438
@HttpParameterMapping( parameter = "InstanceId" )
439
ArrayList<String> instancesSet = new ArrayList<String>();
440
public StartInstancesType() { }
443
public class ModifyInstanceAttributeType extends VmControlMessage {
447
enum Attr { instanceType, kernel, ramdisk, userData, disableApiTermination, instanceInitiatedShutdownBehavior };
448
ArrayList<BlockDeviceMappingItemType> blockDeviceMapping = new ArrayList<BlockDeviceMappingItemType>();
449
public ModifyInstanceAttributeType() { }
450
public void instanceType( String value ) { this.element = Attr.instanceType; this.value = value; }
451
public void kernel( String value ) { this.element = Attr.kernel; this.value = value; }
452
public void ramdisk( String value ) { this.element = Attr.ramdisk; this.value = value; }
453
public void userData( String value ) { this.element = Attr.userData; this.value = value; }
454
public void disableApiTermination( String value ) { this.element = Attr.disableApiTermination; this.value = value; }
455
public void instanceInitiatedShutdownBehavior( String value ) { this.element = Attr.instanceInitiatedShutdownBehavior; this.value = value; }
457
public class ModifyInstanceAttributeResponseType extends VmControlMessage {
458
public ModifyInstanceAttributeResponseType() { }
461
public class ResetInstanceAttributeType extends VmControlMessage {
463
public ResetInstanceAttributeType() { }
465
public class ResetInstanceAttributeResponseType extends VmControlMessage {
466
public ResetInstanceAttributeResponseType() { }
469
public class DescribeInstanceAttributeType extends VmControlMessage {
471
public DescribeInstanceAttributeType() { }
473
public class DescribeInstanceAttributeResponseType extends VmControlMessage {
480
String disableApiTermination;
481
String instanceInitiatedShutdownBehavior;
482
String rootDeviceName;
483
ArrayList<BlockDeviceMappingItemType> blockDeviceMapping = new ArrayList<BlockDeviceMappingItemType>();
484
public DescribeInstanceAttributeResponseType() { }
486
public class MonitorInstanceState extends EucalyptusData {
488
String monitoringState;
489
public MonitorInstanceState() {}
491
public class MonitorInstancesResponseType extends VmControlMessage {
492
ArrayList<MonitorInstanceState> instancesSet = new ArrayList<MonitorInstanceState>();
493
public MonitorInstancesResponseType() { }
496
public class MonitorInstancesType extends VmControlMessage {
497
ArrayList<String> instancesSet = new ArrayList<String>();
498
public MonitorInstancesType() { }
500
public class UnmonitorInstancesResponseType extends VmControlMessage {
501
ArrayList<MonitorInstanceState> instancesSet = new ArrayList<MonitorInstanceState>();
502
public UnmonitorInstancesResponseType() { }
505
public class UnmonitorInstancesType extends VmControlMessage {
506
ArrayList<String> instancesSet = new ArrayList<String>();
507
public MonitorInstancesType() { }