Revision f8be9cce
b/main/java/net/elasticgrid/rackspace/cloudservers/Addresses.java | ||
---|---|---|
1 |
/**
|
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3 |
* or more contributor license agreements. See the NOTICE file
|
|
4 |
* distributed with this work for additional information
|
|
5 |
* regarding copyright ownership. The ASF licenses this file
|
|
6 |
* to you under the Apache License, Version 2.0 (the
|
|
7 |
* "License"); you may not use this file except in compliance
|
|
8 |
* with the License. You may obtain a copy of the License at
|
|
9 |
*
|
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11 |
*
|
|
12 |
* Unless required by applicable law or agreed to in writing,
|
|
13 |
* software distributed under the License is distributed on an
|
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15 |
* KIND, either express or implied. See the License for the
|
|
16 |
* specific language governing permissions and limitations
|
|
17 |
* under the License.
|
|
18 |
*/
|
|
19 |
package net.elasticgrid.rackspace.cloudservers;
|
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.Public;
|
|
22 |
import net.elasticgrid.rackspace.cloudservers.internal.Private;
|
|
23 |
import java.io.Serializable;
|
|
24 |
import java.net.InetAddress;
|
|
25 |
import java.net.UnknownHostException;
|
|
26 |
import java.util.List;
|
|
27 |
import java.util.ArrayList;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* Addresses are either public or private.
|
|
31 |
* @author Jerome Bernard
|
|
32 |
*/
|
|
33 |
public class Addresses implements Serializable {
|
|
34 |
private final List<InetAddress> publicAddresses;
|
|
35 |
private final List<InetAddress> privateAddresses;
|
|
36 |
|
|
37 |
public Addresses(List<InetAddress> publicAddresses, List<InetAddress> privateAddresses) {
|
|
38 |
this.publicAddresses = publicAddresses;
|
|
39 |
this.privateAddresses = privateAddresses;
|
|
40 |
}
|
|
41 |
|
|
42 |
public Addresses(net.elasticgrid.rackspace.cloudservers.internal.Addresses addresses) throws UnknownHostException {
|
|
43 |
// populate public addresses list
|
|
44 |
Public publicAddresses = addresses.getPublic();
|
|
45 |
this.publicAddresses = new ArrayList<InetAddress>(publicAddresses.getAddressLists().size());
|
|
46 |
for (net.elasticgrid.rackspace.cloudservers.internal.Address address : publicAddresses.getAddressLists()) {
|
|
47 |
this.publicAddresses.add(InetAddress.getByName(address.getAddr()));
|
|
48 |
}
|
|
49 |
// populate private addresses list
|
|
50 |
Private privateAddresses = addresses.getPrivate();
|
|
51 |
this.privateAddresses = new ArrayList<InetAddress>(privateAddresses.getAddressLists().size());
|
|
52 |
for (net.elasticgrid.rackspace.cloudservers.internal.Address address : privateAddresses.getAddressLists()) {
|
|
53 |
this.privateAddresses.add(InetAddress.getByName(address.getAddr()));
|
|
54 |
}
|
|
55 |
}
|
|
56 |
|
|
57 |
public List<InetAddress> getPublicAddresses() {
|
|
58 |
return publicAddresses;
|
|
59 |
}
|
|
60 |
|
|
61 |
public List<InetAddress> getPrivateAddresses() {
|
|
62 |
return privateAddresses;
|
|
63 |
}
|
|
64 |
|
|
65 |
@Override
|
|
66 |
public String toString() {
|
|
67 |
final StringBuilder sb = new StringBuilder();
|
|
68 |
sb.append("Addresses");
|
|
69 |
sb.append("{publicAddresses=").append(publicAddresses);
|
|
70 |
sb.append(", privateAddresses=").append(privateAddresses);
|
|
71 |
sb.append('}');
|
|
72 |
return sb.toString();
|
|
73 |
}
|
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.Public; |
|
22 |
import net.elasticgrid.rackspace.cloudservers.internal.Private; |
|
23 |
import java.io.Serializable; |
|
24 |
import java.net.InetAddress; |
|
25 |
import java.net.UnknownHostException; |
|
26 |
import java.util.List; |
|
27 |
import java.util.ArrayList; |
|
28 |
|
|
29 |
/** |
|
30 |
* Addresses are either public or private. |
|
31 |
* @author Jerome Bernard |
|
32 |
*/ |
|
33 |
public class Addresses implements Serializable { |
|
34 |
private final List<InetAddress> publicAddresses; |
|
35 |
private final List<InetAddress> privateAddresses; |
|
36 |
|
|
37 |
public Addresses(List<InetAddress> publicAddresses, List<InetAddress> privateAddresses) { |
|
38 |
this.publicAddresses = publicAddresses; |
|
39 |
this.privateAddresses = privateAddresses; |
|
40 |
} |
|
41 |
|
|
42 |
public Addresses(net.elasticgrid.rackspace.cloudservers.internal.Addresses addresses) throws UnknownHostException { |
|
43 |
// populate public addresses list |
|
44 |
Public publicAddresses = addresses.getPublic(); |
|
45 |
this.publicAddresses = new ArrayList<InetAddress>(publicAddresses.getAddressLists().size()); |
|
46 |
for (net.elasticgrid.rackspace.cloudservers.internal.Address address : publicAddresses.getAddressLists()) { |
|
47 |
this.publicAddresses.add(InetAddress.getByName(address.getAddr())); |
|
48 |
} |
|
49 |
// populate private addresses list |
|
50 |
Private privateAddresses = addresses.getPrivate(); |
|
51 |
this.privateAddresses = new ArrayList<InetAddress>(privateAddresses.getAddressLists().size()); |
|
52 |
for (net.elasticgrid.rackspace.cloudservers.internal.Address address : privateAddresses.getAddressLists()) { |
|
53 |
this.privateAddresses.add(InetAddress.getByName(address.getAddr())); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
public List<InetAddress> getPublicAddresses() { |
|
58 |
return publicAddresses; |
|
59 |
} |
|
60 |
|
|
61 |
public List<InetAddress> getPrivateAddresses() { |
|
62 |
return privateAddresses; |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public String toString() { |
|
67 |
final StringBuilder sb = new StringBuilder(); |
|
68 |
sb.append("Addresses"); |
|
69 |
sb.append("{publicAddresses=").append(publicAddresses); |
|
70 |
sb.append(", privateAddresses=").append(privateAddresses); |
|
71 |
sb.append('}'); |
|
72 |
return sb.toString(); |
|
73 |
} |
|
74 | 74 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/BackupSchedule.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Server backup schedule. |
|
25 |
* |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class BackupSchedule implements Serializable { |
|
29 |
private boolean enabled; |
|
30 |
private WeeklyBackup weekly; |
|
31 |
private DailyBackup daily; |
|
32 |
|
|
33 |
public BackupSchedule(boolean enabled, WeeklyBackup weekly, DailyBackup daily) { |
|
34 |
this.enabled = enabled; |
|
35 |
this.weekly = weekly; |
|
36 |
this.daily = daily; |
|
37 |
} |
|
38 |
|
|
39 |
public boolean isEnabled() { |
|
40 |
return enabled; |
|
41 |
} |
|
42 |
|
|
43 |
public WeeklyBackup getWeekly() { |
|
44 |
return weekly; |
|
45 |
} |
|
46 |
|
|
47 |
public DailyBackup getDaily() { |
|
48 |
return daily; |
|
49 |
} |
|
50 |
|
|
51 |
public enum WeeklyBackup implements Serializable { |
|
52 |
DISABLED("DISABLED"), SUNDAY("SUNDAY"), MONDAY("MONDAY"), TUESDAY("TUESDAY"), |
|
53 |
WEDNESDAY("WEDNESDAY"), THURSDAY("THURSDAY"), FRIDAY("FRIDAY"), |
|
54 |
SATURDAY("SATURDAY"), SUNDAY1("SUNDAY"); |
|
55 |
private final String value; |
|
56 |
|
|
57 |
private WeeklyBackup(String value) { |
|
58 |
this.value = value; |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
public enum DailyBackup implements Serializable { |
|
63 |
DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, |
|
64 |
H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, |
|
65 |
H_2000_2200, H_2200_0000 |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public String toString() { |
|
70 |
final StringBuilder sb = new StringBuilder(); |
|
71 |
sb.append("BackupSchedule"); |
|
72 |
sb.append("{enabled=").append(enabled); |
|
73 |
sb.append(", weekly=").append(weekly); |
|
74 |
sb.append(", daily=").append(daily); |
|
75 |
sb.append('}'); |
|
76 |
return sb.toString(); |
|
77 |
} |
|
78 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Server backup schedule. |
|
25 |
* |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class BackupSchedule implements Serializable { |
|
29 |
private boolean enabled; |
|
30 |
private WeeklyBackup weekly; |
|
31 |
private DailyBackup daily; |
|
32 |
|
|
33 |
public BackupSchedule(boolean enabled, WeeklyBackup weekly, DailyBackup daily) { |
|
34 |
this.enabled = enabled; |
|
35 |
this.weekly = weekly; |
|
36 |
this.daily = daily; |
|
37 |
} |
|
38 |
|
|
39 |
public boolean isEnabled() { |
|
40 |
return enabled; |
|
41 |
} |
|
42 |
|
|
43 |
public WeeklyBackup getWeekly() { |
|
44 |
return weekly; |
|
45 |
} |
|
46 |
|
|
47 |
public DailyBackup getDaily() { |
|
48 |
return daily; |
|
49 |
} |
|
50 |
|
|
51 |
public enum WeeklyBackup implements Serializable { |
|
52 |
DISABLED("DISABLED"), SUNDAY("SUNDAY"), MONDAY("MONDAY"), TUESDAY("TUESDAY"), |
|
53 |
WEDNESDAY("WEDNESDAY"), THURSDAY("THURSDAY"), FRIDAY("FRIDAY"), |
|
54 |
SATURDAY("SATURDAY"), SUNDAY1("SUNDAY"); |
|
55 |
private final String value; |
|
56 |
|
|
57 |
private WeeklyBackup(String value) { |
|
58 |
this.value = value; |
|
59 |
} |
|
60 |
} |
|
61 |
|
|
62 |
public enum DailyBackup implements Serializable { |
|
63 |
DISABLED, H_0000_0200, H_0200_0400, H_0400_0600, H_0600_0800, H_0800_1000, |
|
64 |
H_1000_1200, H_1200_1400, H_1400_1600, H_1600_1800, H_1800_2000, |
|
65 |
H_2000_2200, H_2200_0000 |
|
66 |
} |
|
67 |
|
|
68 |
@Override |
|
69 |
public String toString() { |
|
70 |
final StringBuilder sb = new StringBuilder(); |
|
71 |
sb.append("BackupSchedule"); |
|
72 |
sb.append("{enabled=").append(enabled); |
|
73 |
sb.append(", weekly=").append(weekly); |
|
74 |
sb.append(", daily=").append(daily); |
|
75 |
sb.append('}'); |
|
76 |
return sb.toString(); |
|
77 |
} |
|
78 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/CloudServersException.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.common.RackspaceException; |
|
22 |
|
|
23 |
/** |
|
24 |
* A wrapper exception to simplify catching errors related to Rackspace Cloud Servers activity. |
|
25 |
* |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class CloudServersException extends RackspaceException { |
|
29 |
public CloudServersException(String message) { |
|
30 |
super(message); |
|
31 |
} |
|
32 |
|
|
33 |
public CloudServersException(Throwable cause) { |
|
34 |
super(cause); |
|
35 |
} |
|
36 |
|
|
37 |
public CloudServersException(String message, Throwable cause) { |
|
38 |
super(message, cause); |
|
39 |
} |
|
40 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.common.RackspaceException; |
|
22 |
|
|
23 |
/** |
|
24 |
* A wrapper exception to simplify catching errors related to Rackspace Cloud Servers activity. |
|
25 |
* |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class CloudServersException extends RackspaceException { |
|
29 |
public CloudServersException(String message) { |
|
30 |
super(message); |
|
31 |
} |
|
32 |
|
|
33 |
public CloudServersException(Throwable cause) { |
|
34 |
super(cause); |
|
35 |
} |
|
36 |
|
|
37 |
public CloudServersException(String message, Throwable cause) { |
|
38 |
super(message, cause); |
|
39 |
} |
|
40 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/File.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* File description. |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public class File implements Serializable { |
|
28 |
private final String path; |
|
29 |
private final byte[] base64Binary; |
|
30 |
|
|
31 |
public File(String path, byte[] base64Binary) { |
|
32 |
this.path = path; |
|
33 |
this.base64Binary = base64Binary; |
|
34 |
} |
|
35 |
|
|
36 |
public String getPath() { |
|
37 |
return path; |
|
38 |
} |
|
39 |
|
|
40 |
public byte[] getBase64Binary() { |
|
41 |
return base64Binary; |
|
42 |
} |
|
43 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* File description. |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public class File implements Serializable { |
|
28 |
private final String path; |
|
29 |
private final byte[] base64Binary; |
|
30 |
|
|
31 |
public File(String path, byte[] base64Binary) { |
|
32 |
this.path = path; |
|
33 |
this.base64Binary = base64Binary; |
|
34 |
} |
|
35 |
|
|
36 |
public String getPath() { |
|
37 |
return path; |
|
38 |
} |
|
39 |
|
|
40 |
public byte[] getBase64Binary() { |
|
41 |
return base64Binary; |
|
42 |
} |
|
43 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/Flavor.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Hardware configuration for a server. |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public class Flavor implements Serializable { |
|
28 |
private final int id; |
|
29 |
private final String name; |
|
30 |
private final Integer ram; |
|
31 |
private final Integer disk; |
|
32 |
|
|
33 |
public Flavor(int id, String name, Integer ram, Integer disk) { |
|
34 |
this.id = id; |
|
35 |
this.name = name; |
|
36 |
this.ram = ram; |
|
37 |
this.disk = disk; |
|
38 |
} |
|
39 |
|
|
40 |
public int getId() { |
|
41 |
return id; |
|
42 |
} |
|
43 |
|
|
44 |
public String getName() { |
|
45 |
return name; |
|
46 |
} |
|
47 |
|
|
48 |
public Integer getRam() { |
|
49 |
return ram; |
|
50 |
} |
|
51 |
|
|
52 |
public Integer getDisk() { |
|
53 |
return disk; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String toString() { |
|
58 |
final StringBuilder sb = new StringBuilder(); |
|
59 |
sb.append("Flavor"); |
|
60 |
sb.append("{id=").append(id); |
|
61 |
sb.append(", name='").append(name).append('\''); |
|
62 |
sb.append(", ram=").append(ram); |
|
63 |
sb.append(", disk=").append(disk); |
|
64 |
sb.append('}'); |
|
65 |
return sb.toString(); |
|
66 |
} |
|
67 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Hardware configuration for a server. |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public class Flavor implements Serializable { |
|
28 |
private final int id; |
|
29 |
private final String name; |
|
30 |
private final Integer ram; |
|
31 |
private final Integer disk; |
|
32 |
|
|
33 |
public Flavor(int id, String name, Integer ram, Integer disk) { |
|
34 |
this.id = id; |
|
35 |
this.name = name; |
|
36 |
this.ram = ram; |
|
37 |
this.disk = disk; |
|
38 |
} |
|
39 |
|
|
40 |
public int getId() { |
|
41 |
return id; |
|
42 |
} |
|
43 |
|
|
44 |
public String getName() { |
|
45 |
return name; |
|
46 |
} |
|
47 |
|
|
48 |
public Integer getRam() { |
|
49 |
return ram; |
|
50 |
} |
|
51 |
|
|
52 |
public Integer getDisk() { |
|
53 |
return disk; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public String toString() { |
|
58 |
final StringBuilder sb = new StringBuilder(); |
|
59 |
sb.append("Flavor"); |
|
60 |
sb.append("{id=").append(id); |
|
61 |
sb.append(", name='").append(name).append('\''); |
|
62 |
sb.append(", ram=").append(ram); |
|
63 |
sb.append(", disk=").append(disk); |
|
64 |
sb.append('}'); |
|
65 |
return sb.toString(); |
|
66 |
} |
|
67 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/HTTPVerb.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Enum for HTTP Verb (mostly used by the /limits API call) |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public enum HTTPVerb implements Serializable { |
|
28 |
POST, PUT, GET, DELETE, HEAD |
|
29 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
|
|
23 |
/** |
|
24 |
* Enum for HTTP Verb (mostly used by the /limits API call) |
|
25 |
* @author Jerome Bernard |
|
26 |
*/ |
|
27 |
public enum HTTPVerb implements Serializable { |
|
28 |
POST, PUT, GET, DELETE, HEAD |
|
29 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/Image.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
import java.util.Date; |
|
23 |
|
|
24 |
/** |
|
25 |
* Image: collection of files used to create or rebuild a server. |
|
26 |
* |
|
27 |
* @author Jerome Bernard |
|
28 |
*/ |
|
29 |
public class Image implements Serializable { |
|
30 |
private final Integer id; |
|
31 |
private final String name; |
|
32 |
private final Integer serverId; |
|
33 |
private final Date updated; |
|
34 |
private final Date created; |
|
35 |
private final Integer progress; |
|
36 |
private final Status status; |
|
37 |
|
|
38 |
public Image(Integer id, String name, Integer serverId, Date updated, Date created, Integer progress, Status status) { |
|
39 |
this.id = id; |
|
40 |
this.name = name; |
|
41 |
this.serverId = serverId; |
|
42 |
this.updated = updated; |
|
43 |
this.created = created; |
|
44 |
this.progress = progress; |
|
45 |
this.status = status; |
|
46 |
} |
|
47 |
|
|
48 |
public Integer getId() { |
|
49 |
return id; |
|
50 |
} |
|
51 |
|
|
52 |
public String getName() { |
|
53 |
return name; |
|
54 |
} |
|
55 |
|
|
56 |
public Integer getServerId() { |
|
57 |
return serverId; |
|
58 |
} |
|
59 |
|
|
60 |
public Date getUpdated() { |
|
61 |
return updated; |
|
62 |
} |
|
63 |
|
|
64 |
public Date getCreated() { |
|
65 |
return created; |
|
66 |
} |
|
67 |
|
|
68 |
public Integer getProgress() { |
|
69 |
return progress; |
|
70 |
} |
|
71 |
|
|
72 |
public Status getStatus() { |
|
73 |
return status; |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public String toString() { |
|
78 |
final StringBuilder sb = new StringBuilder(); |
|
79 |
sb.append("Image"); |
|
80 |
sb.append("{id=").append(id); |
|
81 |
sb.append(", name='").append(name).append('\''); |
|
82 |
sb.append(", serverId=").append(serverId); |
|
83 |
sb.append(", updated=").append(updated); |
|
84 |
sb.append(", created=").append(created); |
|
85 |
sb.append(", progress=").append(progress); |
|
86 |
sb.append(", status=").append(status); |
|
87 |
sb.append('}'); |
|
88 |
return sb.toString(); |
|
89 |
} |
|
90 |
|
|
91 |
enum Status implements Serializable { |
|
92 |
UNKNOWN, ACTIVE, SAVING, PREPARING, QUEUED, FAILED |
|
93 |
} |
|
94 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.Serializable; |
|
22 |
import java.util.Date; |
|
23 |
|
|
24 |
/** |
|
25 |
* Image: collection of files used to create or rebuild a server. |
|
26 |
* |
|
27 |
* @author Jerome Bernard |
|
28 |
*/ |
|
29 |
public class Image implements Serializable { |
|
30 |
private final Integer id; |
|
31 |
private final String name; |
|
32 |
private final Integer serverId; |
|
33 |
private final Date updated; |
|
34 |
private final Date created; |
|
35 |
private final Integer progress; |
|
36 |
private final Status status; |
|
37 |
|
|
38 |
public Image(Integer id, String name, Integer serverId, Date updated, Date created, Integer progress, Status status) { |
|
39 |
this.id = id; |
|
40 |
this.name = name; |
|
41 |
this.serverId = serverId; |
|
42 |
this.updated = updated; |
|
43 |
this.created = created; |
|
44 |
this.progress = progress; |
|
45 |
this.status = status; |
|
46 |
} |
|
47 |
|
|
48 |
public Integer getId() { |
|
49 |
return id; |
|
50 |
} |
|
51 |
|
|
52 |
public String getName() { |
|
53 |
return name; |
|
54 |
} |
|
55 |
|
|
56 |
public Integer getServerId() { |
|
57 |
return serverId; |
|
58 |
} |
|
59 |
|
|
60 |
public Date getUpdated() { |
|
61 |
return updated; |
|
62 |
} |
|
63 |
|
|
64 |
public Date getCreated() { |
|
65 |
return created; |
|
66 |
} |
|
67 |
|
|
68 |
public Integer getProgress() { |
|
69 |
return progress; |
|
70 |
} |
|
71 |
|
|
72 |
public Status getStatus() { |
|
73 |
return status; |
|
74 |
} |
|
75 |
|
|
76 |
@Override |
|
77 |
public String toString() { |
|
78 |
final StringBuilder sb = new StringBuilder(); |
|
79 |
sb.append("Image"); |
|
80 |
sb.append("{id=").append(id); |
|
81 |
sb.append(", name='").append(name).append('\''); |
|
82 |
sb.append(", serverId=").append(serverId); |
|
83 |
sb.append(", updated=").append(updated); |
|
84 |
sb.append(", created=").append(created); |
|
85 |
sb.append(", progress=").append(progress); |
|
86 |
sb.append(", status=").append(status); |
|
87 |
sb.append('}'); |
|
88 |
return sb.toString(); |
|
89 |
} |
|
90 |
|
|
91 |
enum Status implements Serializable { |
|
92 |
UNKNOWN, ACTIVE, SAVING, PREPARING, QUEUED, FAILED |
|
93 |
} |
|
94 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/Limits.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.*; |
|
22 |
import java.util.*; |
|
23 |
|
|
24 |
/** |
|
25 |
* Rackspace API limits. |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class Limits implements Serializable { |
|
29 |
private final List<RateLimit> rateLimits; |
|
30 |
private final List<AbsoluteLimit> absoluteLimits; |
|
31 |
|
|
32 |
public Limits(List<RateLimit> rateLimits, List<AbsoluteLimit> absoluteLimits) { |
|
33 |
this.rateLimits = Collections.unmodifiableList(rateLimits); |
|
34 |
this.absoluteLimits = Collections.unmodifiableList(absoluteLimits); |
|
35 |
} |
|
36 |
|
|
37 |
public List<RateLimit> getRateLimits() { |
|
38 |
return rateLimits; |
|
39 |
} |
|
40 |
|
|
41 |
public List<AbsoluteLimit> getAbsoluteLimits() { |
|
42 |
return absoluteLimits; |
|
43 |
} |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
class RateLimit implements Serializable { |
|
48 |
private final HTTPVerb verb; |
|
49 |
private final String URI; |
|
50 |
private final String regex; |
|
51 |
private final int value; |
|
52 |
private final int remaining; |
|
53 |
private final RateLimit.Unit unit; |
|
54 |
private final long resetTime; |
|
55 |
|
|
56 |
RateLimit(HTTPVerb verb, String URI, String regex, int value, int remaining, RateLimit.Unit unit, long resetTime) { |
|
57 |
this.verb = verb; |
|
58 |
this.URI = URI; |
|
59 |
this.regex = regex; |
|
60 |
this.value = value; |
|
61 |
this.remaining = remaining; |
|
62 |
this.unit = unit; |
|
63 |
this.resetTime = resetTime; |
|
64 |
} |
|
65 |
|
|
66 |
public HTTPVerb getVerb() { |
|
67 |
return verb; |
|
68 |
} |
|
69 |
|
|
70 |
public String getURI() { |
|
71 |
return URI; |
|
72 |
} |
|
73 |
|
|
74 |
public String getRegex() { |
|
75 |
return regex; |
|
76 |
} |
|
77 |
|
|
78 |
public int getValue() { |
|
79 |
return value; |
|
80 |
} |
|
81 |
|
|
82 |
public int getRemaining() { |
|
83 |
return remaining; |
|
84 |
} |
|
85 |
|
|
86 |
public RateLimit.Unit getUnit() { |
|
87 |
return unit; |
|
88 |
} |
|
89 |
|
|
90 |
public long getResetTime() { |
|
91 |
return resetTime; |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public String toString() { |
|
96 |
final StringBuilder sb = new StringBuilder(); |
|
97 |
sb.append("RateLimit"); |
|
98 |
sb.append("{verb=").append(verb); |
|
99 |
sb.append(", URI='").append(URI).append('\''); |
|
100 |
sb.append(", regex='").append(regex).append('\''); |
|
101 |
sb.append(", value=").append(value); |
|
102 |
sb.append(", remaining=").append(remaining); |
|
103 |
sb.append(", unit=").append(unit); |
|
104 |
sb.append(", resetTime=").append(resetTime); |
|
105 |
sb.append('}'); |
|
106 |
return sb.toString(); |
|
107 |
} |
|
108 |
|
|
109 |
enum Unit implements Serializable { |
|
110 |
MINUTE, HOUR, DAY |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
class AbsoluteLimit implements Serializable { |
|
115 |
private final String name; |
|
116 |
private final int value; |
|
117 |
|
|
118 |
public AbsoluteLimit(String name, int value) { |
|
119 |
this.name = name; |
|
120 |
this.value = value; |
|
121 |
} |
|
122 |
|
|
123 |
public String getName() { |
|
124 |
return name; |
|
125 |
} |
|
126 |
|
|
127 |
public int getValue() { |
|
128 |
return value; |
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public String toString() { |
|
133 |
final StringBuilder sb = new StringBuilder(); |
|
134 |
sb.append("AbsoluteLimit"); |
|
135 |
sb.append("{name='").append(name).append('\''); |
|
136 |
sb.append(", value=").append(value); |
|
137 |
sb.append('}'); |
|
138 |
return sb.toString(); |
|
139 |
} |
|
140 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import java.io.*; |
|
22 |
import java.util.*; |
|
23 |
|
|
24 |
/** |
|
25 |
* Rackspace API limits. |
|
26 |
* @author Jerome Bernard |
|
27 |
*/ |
|
28 |
public class Limits implements Serializable { |
|
29 |
private final List<RateLimit> rateLimits; |
|
30 |
private final List<AbsoluteLimit> absoluteLimits; |
|
31 |
|
|
32 |
public Limits(List<RateLimit> rateLimits, List<AbsoluteLimit> absoluteLimits) { |
|
33 |
this.rateLimits = Collections.unmodifiableList(rateLimits); |
|
34 |
this.absoluteLimits = Collections.unmodifiableList(absoluteLimits); |
|
35 |
} |
|
36 |
|
|
37 |
public List<RateLimit> getRateLimits() { |
|
38 |
return rateLimits; |
|
39 |
} |
|
40 |
|
|
41 |
public List<AbsoluteLimit> getAbsoluteLimits() { |
|
42 |
return absoluteLimits; |
|
43 |
} |
|
44 |
|
|
45 |
} |
|
46 |
|
|
47 |
class RateLimit implements Serializable { |
|
48 |
private final HTTPVerb verb; |
|
49 |
private final String URI; |
|
50 |
private final String regex; |
|
51 |
private final int value; |
|
52 |
private final int remaining; |
|
53 |
private final RateLimit.Unit unit; |
|
54 |
private final long resetTime; |
|
55 |
|
|
56 |
RateLimit(HTTPVerb verb, String URI, String regex, int value, int remaining, RateLimit.Unit unit, long resetTime) { |
|
57 |
this.verb = verb; |
|
58 |
this.URI = URI; |
|
59 |
this.regex = regex; |
|
60 |
this.value = value; |
|
61 |
this.remaining = remaining; |
|
62 |
this.unit = unit; |
|
63 |
this.resetTime = resetTime; |
|
64 |
} |
|
65 |
|
|
66 |
public HTTPVerb getVerb() { |
|
67 |
return verb; |
|
68 |
} |
|
69 |
|
|
70 |
public String getURI() { |
|
71 |
return URI; |
|
72 |
} |
|
73 |
|
|
74 |
public String getRegex() { |
|
75 |
return regex; |
|
76 |
} |
|
77 |
|
|
78 |
public int getValue() { |
|
79 |
return value; |
|
80 |
} |
|
81 |
|
|
82 |
public int getRemaining() { |
|
83 |
return remaining; |
|
84 |
} |
|
85 |
|
|
86 |
public RateLimit.Unit getUnit() { |
|
87 |
return unit; |
|
88 |
} |
|
89 |
|
|
90 |
public long getResetTime() { |
|
91 |
return resetTime; |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
public String toString() { |
|
96 |
final StringBuilder sb = new StringBuilder(); |
|
97 |
sb.append("RateLimit"); |
|
98 |
sb.append("{verb=").append(verb); |
|
99 |
sb.append(", URI='").append(URI).append('\''); |
|
100 |
sb.append(", regex='").append(regex).append('\''); |
|
101 |
sb.append(", value=").append(value); |
|
102 |
sb.append(", remaining=").append(remaining); |
|
103 |
sb.append(", unit=").append(unit); |
|
104 |
sb.append(", resetTime=").append(resetTime); |
|
105 |
sb.append('}'); |
|
106 |
return sb.toString(); |
|
107 |
} |
|
108 |
|
|
109 |
enum Unit implements Serializable { |
|
110 |
MINUTE, HOUR, DAY |
|
111 |
} |
|
112 |
} |
|
113 |
|
|
114 |
class AbsoluteLimit implements Serializable { |
|
115 |
private final String name; |
|
116 |
private final int value; |
|
117 |
|
|
118 |
public AbsoluteLimit(String name, int value) { |
|
119 |
this.name = name; |
|
120 |
this.value = value; |
|
121 |
} |
|
122 |
|
|
123 |
public String getName() { |
|
124 |
return name; |
|
125 |
} |
|
126 |
|
|
127 |
public int getValue() { |
|
128 |
return value; |
|
129 |
} |
|
130 |
|
|
131 |
@Override |
|
132 |
public String toString() { |
|
133 |
final StringBuilder sb = new StringBuilder(); |
|
134 |
sb.append("AbsoluteLimit"); |
|
135 |
sb.append("{name='").append(name).append('\''); |
|
136 |
sb.append(", value=").append(value); |
|
137 |
sb.append('}'); |
|
138 |
return sb.toString(); |
|
139 |
} |
|
140 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/Personality.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.*; |
|
22 |
import java.io.Serializable; |
|
23 |
import java.util.List; |
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.Collections; |
|
26 |
|
|
27 |
/** |
|
28 |
* @author Jerome Bernard |
|
29 |
*/ |
|
30 |
public class Personality implements Serializable { |
|
31 |
private final List<File> files; |
|
32 |
|
|
33 |
public Personality(List<File> files) { |
|
34 |
this.files = files; |
|
35 |
} |
|
36 |
|
|
37 |
public Personality(final net.elasticgrid.rackspace.cloudservers.internal.Personality personality) { |
|
38 |
this(personalitiesAsFileList(personality)); |
|
39 |
} |
|
40 |
|
|
41 |
private static List<File> personalitiesAsFileList(final net.elasticgrid.rackspace.cloudservers.internal.Personality personality) { |
|
42 |
if (personality == null || personality.getPersonalities() == null) |
|
43 |
return Collections.emptyList(); |
|
44 |
List<File> files = new ArrayList<File>(personality.getPersonalities().size()); |
|
45 |
for (net.elasticgrid.rackspace.cloudservers.internal.File file : personality.getPersonalities()) { |
|
46 |
files.add(new File(file.getPath(), file.getBase64Binary())); |
|
47 |
} |
|
48 |
return files; |
|
49 |
} |
|
50 |
|
|
51 |
public List<File> getFiles() { |
|
52 |
return files; |
|
53 |
} |
|
54 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.*; |
|
22 |
import java.io.Serializable; |
|
23 |
import java.util.List; |
|
24 |
import java.util.ArrayList; |
|
25 |
import java.util.Collections; |
|
26 |
|
|
27 |
/** |
|
28 |
* @author Jerome Bernard |
|
29 |
*/ |
|
30 |
public class Personality implements Serializable { |
|
31 |
private final List<File> files; |
|
32 |
|
|
33 |
public Personality(List<File> files) { |
|
34 |
this.files = files; |
|
35 |
} |
|
36 |
|
|
37 |
public Personality(final net.elasticgrid.rackspace.cloudservers.internal.Personality personality) { |
|
38 |
this(personalitiesAsFileList(personality)); |
|
39 |
} |
|
40 |
|
|
41 |
private static List<File> personalitiesAsFileList(final net.elasticgrid.rackspace.cloudservers.internal.Personality personality) { |
|
42 |
if (personality == null || personality.getPersonalities() == null) |
|
43 |
return Collections.emptyList(); |
|
44 |
List<File> files = new ArrayList<File>(personality.getPersonalities().size()); |
|
45 |
for (net.elasticgrid.rackspace.cloudservers.internal.File file : personality.getPersonalities()) { |
|
46 |
files.add(new File(file.getPath(), file.getBase64Binary())); |
|
47 |
} |
|
48 |
return files; |
|
49 |
} |
|
50 |
|
|
51 |
public List<File> getFiles() { |
|
52 |
return files; |
|
53 |
} |
|
54 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/RebootType.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
/** |
|
22 |
* Reboot type enum. |
|
23 |
* @author Jerome Bernard |
|
24 |
*/ |
|
25 |
public enum RebootType { |
|
26 |
HARD, SOFT |
|
27 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
/** |
|
22 |
* Reboot type enum. |
|
23 |
* @author Jerome Bernard |
|
24 |
*/ |
|
25 |
public enum RebootType { |
|
26 |
HARD, SOFT |
|
27 |
} |
b/main/java/net/elasticgrid/rackspace/cloudservers/SharedIPGroup.java | ||
---|---|---|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.SharedIpGroup; |
|
22 |
import java.io.Serializable; |
|
23 |
import java.util.List; |
|
24 |
|
|
25 |
/** |
|
26 |
* Shared IP group information. |
|
27 |
* @author Jerome Bernard |
|
28 |
*/ |
|
29 |
public class SharedIPGroup implements Serializable { |
|
30 |
private final Integer id; |
|
31 |
private final String name; |
|
32 |
// private final Integer serverID; |
|
33 |
private final List<Integer> serverIDs; |
|
34 |
// private int choiceSelect = -1; |
|
35 |
// private final static int SERVER_CHOICE = 0; |
|
36 |
// private final static int SERVERS_CHOICE = 1; |
|
37 |
|
|
38 |
public SharedIPGroup(Integer id, String name, List<Integer> serverIDs) { |
|
39 |
this.id = id; |
|
40 |
this.name = name; |
|
41 |
this.serverIDs = serverIDs; |
|
42 |
} |
|
43 |
|
|
44 |
public Integer getId() { |
|
45 |
return id; |
|
46 |
} |
|
47 |
|
|
48 |
public String getName() { |
|
49 |
return name; |
|
50 |
} |
|
51 |
|
|
52 |
public List<Integer> getServerIDs() { |
|
53 |
return serverIDs; |
|
54 |
} |
|
55 |
|
|
56 |
/* |
|
57 |
public Integer getServerID() { |
|
58 |
return serverID; |
|
59 |
} |
|
60 |
|
|
61 |
public int getChoiceSelect() { |
|
62 |
return choiceSelect; |
|
63 |
} |
|
64 |
|
|
65 |
public static int getServerChoice() { |
|
66 |
return SERVER_CHOICE; |
|
67 |
} |
|
68 |
|
|
69 |
public static int getServersChoice() { |
|
70 |
return SERVERS_CHOICE; |
|
71 |
} |
|
72 |
*/ |
|
73 |
} |
|
1 |
/** |
|
2 |
* Licensed to the Apache Software Foundation (ASF) under one |
|
3 |
* or more contributor license agreements. See the NOTICE file |
|
4 |
* distributed with this work for additional information |
|
5 |
* regarding copyright ownership. The ASF licenses this file |
|
6 |
* to you under the Apache License, Version 2.0 (the |
|
7 |
* "License"); you may not use this file except in compliance |
|
8 |
* with the License. You may obtain a copy of the License at |
|
9 |
* |
|
10 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
11 |
* |
|
12 |
* Unless required by applicable law or agreed to in writing, |
|
13 |
* software distributed under the License is distributed on an |
|
14 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
15 |
* KIND, either express or implied. See the License for the |
|
16 |
* specific language governing permissions and limitations |
|
17 |
* under the License. |
|
18 |
*/ |
|
19 |
package net.elasticgrid.rackspace.cloudservers; |
|
20 |
|
|
21 |
import net.elasticgrid.rackspace.cloudservers.internal.SharedIpGroup; |
|
22 |
import java.io.Serializable; |
|
23 |
import java.util.List; |
|
24 |
|
|
25 |
/** |
|
26 |
* Shared IP group information. |
|
27 |
* @author Jerome Bernard |
|
28 |
*/ |
|
29 |
public class SharedIPGroup implements Serializable { |
|
30 |
private final Integer id; |
|
31 |
private final String name; |
|
32 |
// private final Integer serverID; |
|
33 |
private final List<Integer> serverIDs; |
|
34 |
// private int choiceSelect = -1; |
|
35 |
// private final static int SERVER_CHOICE = 0; |
|
36 |
// private final static int SERVERS_CHOICE = 1; |
|
37 |
|
|
38 |
public SharedIPGroup(Integer id, String name, List<Integer> serverIDs) { |
|
39 |
this.id = id; |
|
40 |
this.name = name; |
|
41 |
this.serverIDs = serverIDs; |
|
42 |
} |
|
43 |
|
|
44 |
public Integer getId() { |
|
45 |
return id; |
|
46 |
} |
|
47 |
|
|
48 |
public String getName() { |
|
49 |
return name; |
|
50 |
} |
|
51 |
|
|
52 |
public List<Integer> getServerIDs() { |
|
53 |
return serverIDs; |
|
54 |
} |
|
55 |
|
|
56 |
/* |
|
57 |
public Integer getServerID() { |
|
58 |
return serverID; |
|
59 |
} |
|
60 |
|
|
61 |
public int getChoiceSelect() { |
|
62 |
return choiceSelect; |
|
63 |
} |
|
64 |
|
|
65 |
public static int getServerChoice() { |
|
66 |
return SERVER_CHOICE; |
|
67 |
} |
|
68 |
|
|
69 |
public static int getServersChoice() { |
|
70 |
return SERVERS_CHOICE; |
|
71 |
} |
|
72 |
*/ |
|
73 |
} |
Also available in: Unified diff