mirror of
https://github.com/apache/jclouds.git
synced 2025-02-06 10:09:35 +00:00
Updates to Address, Disk, Image, Operations + others
This commit is contained in:
parent
1d3ad709d5
commit
6918ab1089
@ -37,11 +37,11 @@ public final class DiskCreationBinder implements MapBinder {
|
||||
try {
|
||||
json.beginObject();
|
||||
json.name("name").value(postParams.get("name").toString());
|
||||
json.name("sizeGb").value((Integer) postParams.get("sizeGb"));
|
||||
json.name("sizeGb").value(options.sizeGb());
|
||||
json.name("type").value(options.type() != null ? options.type().toString() : null);
|
||||
json.name("sourceImage").value(options.sourceImage() != null ? options.sourceImage().toString() : null);
|
||||
json.name("sourceSnapshot")
|
||||
.value(options.sourceSnapshot() != null ? options.sourceSnapshot().toString() : null);
|
||||
json.name("description").value(options.description());
|
||||
json.endObject();
|
||||
json.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -40,7 +40,7 @@ public final class AtomicOperationDone implements Predicate<AtomicReference<Oper
|
||||
checkNotNull(input.get(), "operation");
|
||||
Operation current = resources.operation(input.get().selfLink());
|
||||
input.set(current);
|
||||
checkState(current.errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop.
|
||||
checkState(current.error().errors().isEmpty(), "Task ended in error %s", current); // ISE will break the loop.
|
||||
switch (current.status()) {
|
||||
case DONE:
|
||||
return true;
|
||||
|
@ -17,6 +17,8 @@
|
||||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
@ -26,12 +28,18 @@ import com.google.auto.value.AutoValue;
|
||||
@AutoValue
|
||||
public abstract class Address {
|
||||
|
||||
public enum Status{
|
||||
RESERVED,
|
||||
IN_USE;
|
||||
}
|
||||
public abstract String id();
|
||||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
|
||||
/**
|
||||
@ -39,10 +47,10 @@ public abstract class Address {
|
||||
* A reserved address is currently available to the project and can be
|
||||
* used by a resource. An in-use address is currently being used by a resource.
|
||||
*/
|
||||
public abstract String status(); // TODO: enum
|
||||
public abstract Status status();
|
||||
|
||||
/** URL of the resource currently using this address. */
|
||||
@Nullable public abstract URI user();
|
||||
@Nullable public abstract List<URI> users();
|
||||
|
||||
/** URL of the region where the address resides. */
|
||||
public abstract URI region();
|
||||
@ -50,10 +58,10 @@ public abstract class Address {
|
||||
/** The IP address represented by this resource. */
|
||||
public abstract String address();
|
||||
|
||||
@SerializedNames({ "id", "selfLink", "name", "description", "status", "user", "region", "address" })
|
||||
public static Address create(String id, URI selfLink, String name, String description, String status, URI user,
|
||||
@SerializedNames({ "id", "selfLink", "name", "creationTimestamp", "description", "status", "users", "region", "address" })
|
||||
public static Address create(String id, URI selfLink, String name, Date creationTimestamp, String description, Status status, List<URI> users,
|
||||
URI region, String address) {
|
||||
return new AutoValue_Address(id, selfLink, name, description, status, user, region, address);
|
||||
return new AutoValue_Address(id, selfLink, name, creationTimestamp, description, status, users, region, address);
|
||||
}
|
||||
|
||||
Address() {
|
||||
|
@ -76,6 +76,7 @@ public abstract class BackendService {
|
||||
@Nullable public abstract int port();
|
||||
@Nullable public abstract String protocol();
|
||||
@Nullable public abstract String fingerprint();
|
||||
@Nullable public abstract String portName();
|
||||
|
||||
/**
|
||||
* @param timeoutSec Defaults to 30 when null.
|
||||
@ -83,18 +84,18 @@ public abstract class BackendService {
|
||||
*/
|
||||
@SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description",
|
||||
"backends", "healthChecks", "timeoutSec", "port", "protocol",
|
||||
"fingerprint"})
|
||||
"fingerprint", "portName"})
|
||||
public static BackendService create(String id, Date creationTimestamp, URI selfLink,
|
||||
String name, @Nullable String description,
|
||||
@Nullable List<Backend> backends, List<URI> healthChecks,
|
||||
@Nullable Integer timeoutSec, @Nullable Integer port,
|
||||
@Nullable String protocol,
|
||||
@Nullable String fingerprint){
|
||||
@Nullable String fingerprint, String portName){
|
||||
return new AutoValue_BackendService(id, creationTimestamp, selfLink, name, description,
|
||||
backends, healthChecks,
|
||||
timeoutSec != null ? timeoutSec : 30,
|
||||
port != null ? port : 80,
|
||||
protocol, fingerprint);
|
||||
protocol, fingerprint, portName);
|
||||
}
|
||||
|
||||
BackendService(){
|
||||
|
@ -17,6 +17,8 @@
|
||||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
@ -25,11 +27,21 @@ import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue
|
||||
public abstract class Disk {
|
||||
|
||||
public enum Status {
|
||||
CREATING,
|
||||
FAILED,
|
||||
READY,
|
||||
RESTORING;
|
||||
}
|
||||
|
||||
public abstract String id();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract URI zone();
|
||||
|
||||
public abstract String status(); // TODO: enum
|
||||
public abstract Status status();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@ -37,15 +49,27 @@ public abstract class Disk {
|
||||
|
||||
public abstract int sizeGb();
|
||||
|
||||
@Nullable public abstract String sourceSnapshot();
|
||||
|
||||
@Nullable public abstract String sourceSnapshotId();
|
||||
|
||||
public abstract URI selfLink();
|
||||
|
||||
@Nullable public abstract String sourceImage();
|
||||
|
||||
@Nullable public abstract String sourceImageId();
|
||||
|
||||
/** URL of the corresponding disk type resource. */
|
||||
@Nullable public abstract URI type();
|
||||
|
||||
@SerializedNames({ "id", "zone", "status", "name", "description", "sizeGb", "selfLink", "type" })
|
||||
public static Disk create(String id, URI zone, String status, String name, String description, int sizeGb,
|
||||
URI selfLink, URI type) {
|
||||
return new AutoValue_Disk(id, zone, status, name, description, sizeGb, selfLink, type);
|
||||
@Nullable public abstract List<String> licenses();
|
||||
|
||||
@SerializedNames({ "id", "creationTimestamp", "zone", "status", "name", "description", "sizeGb", "sourceSnapshot",
|
||||
"sourceSnapshotId", "selfLink", "sourceImage", "sourceImageId", "type", "licenses" })
|
||||
public static Disk create(String id, Date creationTimestamp, URI zone, Status status, String name, String description, int sizeGb,
|
||||
String sourceSnapshot, String sourceSnapshotId, URI selfLink, String sourceImage, String sourceImageId, URI type, List<String> licenses) {
|
||||
return new AutoValue_Disk(id, creationTimestamp, zone, status, name, description, sizeGb,
|
||||
sourceSnapshot, sourceSnapshotId, selfLink, sourceImage, sourceImageId, type, licenses);
|
||||
}
|
||||
|
||||
Disk(){
|
||||
|
@ -17,6 +17,7 @@
|
||||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
@ -26,6 +27,8 @@ import com.google.auto.value.AutoValue;
|
||||
@AutoValue
|
||||
public abstract class DiskType {
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
@ -42,10 +45,10 @@ public abstract class DiskType {
|
||||
/** Server defined default disk size in GB. */
|
||||
public abstract long defaultDiskSizeGb();
|
||||
|
||||
@SerializedNames({ "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" })
|
||||
public static DiskType create(String name, String description, String validDiskSize, Deprecated deprecated, URI zone,
|
||||
@SerializedNames({ "creationTimestamp", "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" })
|
||||
public static DiskType create(Date creationTimestamp, String name, String description, String validDiskSize, Deprecated deprecated, URI zone,
|
||||
URI selfLink, long defaultDiskSizeGb) {
|
||||
return new AutoValue_DiskType(name, description, validDiskSize, deprecated, zone, selfLink, defaultDiskSizeGb);
|
||||
return new AutoValue_DiskType(creationTimestamp, name, description, validDiskSize, deprecated, zone, selfLink, defaultDiskSizeGb);
|
||||
}
|
||||
|
||||
DiskType() {
|
||||
|
@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
|
||||
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
@ -55,6 +56,8 @@ public abstract class Firewall {
|
||||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
@ -94,10 +97,10 @@ public abstract class Firewall {
|
||||
public abstract List<Rule> allowed();
|
||||
|
||||
@SerializedNames(
|
||||
{ "id", "selfLink", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" })
|
||||
public static Firewall create(String id, URI selfLink, String name, String description, URI network,
|
||||
{ "id", "selfLink", "creationTimestamp", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" })
|
||||
public static Firewall create(String id, URI selfLink, Date creationTimestamp, String name, String description, URI network,
|
||||
List<String> sourceRanges, List<String> sourceTags, List<String> targetTags, List<Rule> allowed) {
|
||||
return new AutoValue_Firewall(id, selfLink, name, description, network, copyOf(sourceRanges), copyOf(sourceTags),
|
||||
return new AutoValue_Firewall(id, selfLink, creationTimestamp, name, description, network, copyOf(sourceRanges), copyOf(sourceTags),
|
||||
copyOf(targetTags), copyOf(allowed));
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
@ -26,6 +28,12 @@ import com.google.auto.value.AutoValue;
|
||||
@AutoValue
|
||||
public abstract class Image {
|
||||
|
||||
public enum Status {
|
||||
FAILED,
|
||||
PENDING,
|
||||
READY;
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
public abstract static class RawDisk {
|
||||
/**
|
||||
@ -58,22 +66,39 @@ public abstract class Image {
|
||||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract Date creationTimestamp();
|
||||
|
||||
public abstract String name();
|
||||
|
||||
@Nullable public abstract String description();
|
||||
|
||||
/** Must be RAW; provided by the client when the disk image is created. */
|
||||
// TODO: if this is true, why bother listing it?
|
||||
public abstract String sourceType();
|
||||
@Nullable public abstract String sourceType();
|
||||
|
||||
@Nullable public abstract RawDisk rawDisk();
|
||||
|
||||
@Nullable public abstract Deprecated deprecated();
|
||||
|
||||
@SerializedNames({ "id", "selfLink", "name", "description", "sourceType", "rawDisk", "deprecated" })
|
||||
public static Image create(String id, URI selfLink, String name, String description, String sourceType,
|
||||
RawDisk rawDisk, Deprecated deprecated) {
|
||||
return new AutoValue_Image(id, selfLink, name, description, sourceType, rawDisk, deprecated);
|
||||
public abstract Status status();
|
||||
|
||||
public abstract Long archiveSizeBytes();
|
||||
|
||||
public abstract Long diskSizeGb();
|
||||
|
||||
@Nullable public abstract String sourceDisk();
|
||||
|
||||
@Nullable public abstract String sourceDiskId();
|
||||
|
||||
@Nullable public abstract List<String> licenses();
|
||||
|
||||
@SerializedNames({ "id", "selfLink", "creationTimestamp", "name", "description", "sourceType", "rawDisk", "deprecated",
|
||||
"status", "archiveSizeBytes", "diskSizeGb", "sourceDisk", "sourceDiskId", "licenses"})
|
||||
public static Image create(String id, URI selfLink, Date creationTimestamp, String name, String description, String sourceType,
|
||||
RawDisk rawDisk, Deprecated deprecated, Status status, Long archiveSizeBytes, Long diskSizeGb,
|
||||
String sourceDisk, String sourceDiskId, List<String> licenses) {
|
||||
return new AutoValue_Image(id, selfLink, creationTimestamp, name, description, sourceType, rawDisk, deprecated, status,
|
||||
archiveSizeBytes, diskSizeGb, sourceDisk, sourceDiskId, licenses);
|
||||
}
|
||||
|
||||
Image() {
|
||||
|
@ -16,12 +16,12 @@
|
||||
*/
|
||||
package org.jclouds.googlecomputeengine.domain;
|
||||
|
||||
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
|
||||
@ -32,20 +32,71 @@ public abstract class Operation {
|
||||
|
||||
@AutoValue
|
||||
public abstract static class Error {
|
||||
/** The error type identifier for this error. */
|
||||
public abstract String code(); // TODO: enum?
|
||||
|
||||
/** The field in the request which caused the error. */
|
||||
@Nullable public abstract String location();
|
||||
@AutoValue
|
||||
public abstract static class Entry {
|
||||
|
||||
@Nullable public abstract String message();
|
||||
/** The error type identifier for this error. */
|
||||
public abstract String code(); // TODO: enum?
|
||||
|
||||
@SerializedNames({ "code", "location", "message" })
|
||||
public static Error create(String code, String location, String message) {
|
||||
return new AutoValue_Operation_Error(code, location, message);
|
||||
/** The field in the request which caused the error. */
|
||||
@Nullable public abstract String location();
|
||||
|
||||
@Nullable public abstract String message();
|
||||
|
||||
@SerializedNames({ "code", "location", "message" })
|
||||
public static Entry create(String code, String location, String message) {
|
||||
return new AutoValue_Operation_Error_Entry(code, location, message);
|
||||
}
|
||||
|
||||
Entry() {
|
||||
}
|
||||
}
|
||||
|
||||
Error() {
|
||||
public abstract List<Entry> errors();
|
||||
|
||||
@SerializedNames({ "errors" })
|
||||
public static Error create(List<Entry> errors) {
|
||||
return new AutoValue_Operation_Error(errors != null ? errors : new ArrayList<Entry>());
|
||||
}
|
||||
|
||||
public static Error empty(){
|
||||
return create(null);
|
||||
}
|
||||
|
||||
Error(){
|
||||
}
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
public abstract static class Warning {
|
||||
|
||||
// TODO: combine this with Metadata.Entry
|
||||
@AutoValue
|
||||
public abstract static class Entry {
|
||||
abstract String key();
|
||||
|
||||
abstract String value();
|
||||
|
||||
@SerializedNames({ "key", "value" })
|
||||
public static Entry create(String key, String value) {
|
||||
return new AutoValue_Operation_Warning_Entry(key, value);
|
||||
}
|
||||
|
||||
Entry(){
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String code();
|
||||
@Nullable public abstract String message();
|
||||
public abstract List<Entry> data();
|
||||
|
||||
@SerializedNames({"code", "message", "data"})
|
||||
public static Warning create(String code, String message, List<Entry> data){
|
||||
return new AutoValue_Operation_Warning(code, message, data);
|
||||
}
|
||||
|
||||
Warning() {
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +108,8 @@ public abstract class Operation {
|
||||
|
||||
public abstract String id();
|
||||
|
||||
@Nullable public abstract Date creationTimestamp();
|
||||
|
||||
public abstract URI selfLink();
|
||||
|
||||
public abstract String name();
|
||||
@ -103,22 +156,24 @@ public abstract class Operation {
|
||||
/** Examples include insert, update, and delete. */
|
||||
public abstract String operationType(); // TODO: enum
|
||||
|
||||
public abstract List<Error> errors();
|
||||
public abstract Error error();
|
||||
|
||||
@Nullable public abstract List<Warning> warnings();
|
||||
|
||||
@Nullable public abstract URI region();
|
||||
|
||||
@Nullable public abstract URI zone();
|
||||
|
||||
@SerializedNames({ "id", "selfLink", "name", "description", "targetLink", "targetId", "clientOperationId", "status",
|
||||
@SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", "targetLink", "targetId", "clientOperationId", "status",
|
||||
"statusMessage", "user", "progress", "insertTime", "startTime", "endTime", "httpErrorStatusCode",
|
||||
"httpErrorMessage", "operationType", "errors", "region", "zone" })
|
||||
public static Operation create(String id, URI selfLink, String name, String description, URI targetLink,
|
||||
"httpErrorMessage", "operationType", "error", "warnings", "region", "zone" })
|
||||
public static Operation create(String id, Date creationTimestamp, URI selfLink, String name, String description, URI targetLink,
|
||||
String targetId, String clientOperationId, Status status, String statusMessage, String user, Integer progress,
|
||||
Date insertTime, Date startTime, Date endTime, Integer httpErrorStatusCode, String httpErrorMessage,
|
||||
String operationType, List<Error> errors, URI region, URI zone) {
|
||||
return new AutoValue_Operation(id, selfLink, name, description, targetLink, targetId, clientOperationId, status,
|
||||
String operationType, Error error, List<Warning> warnings, URI region, URI zone) {
|
||||
return new AutoValue_Operation(id, creationTimestamp, selfLink, name, description, targetLink, targetId, clientOperationId, status,
|
||||
statusMessage, user, progress, insertTime, startTime, endTime, httpErrorStatusCode, httpErrorMessage,
|
||||
operationType, copyOf(errors), region, zone);
|
||||
operationType, error != null ? error : Error.empty(), warnings, region, zone);
|
||||
}
|
||||
|
||||
Operation() {
|
||||
|
@ -37,9 +37,11 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
|
||||
import org.jclouds.googlecomputeengine.domain.Address;
|
||||
import org.jclouds.googlecomputeengine.domain.Operation;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
|
||||
import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
|
||||
import org.jclouds.googlecomputeengine.options.ListOptions;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.oauth.v2.filters.OAuthFilter;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.MapBinder;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
@ -77,6 +79,12 @@ public interface AddressApi {
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Operation create(@PayloadParam("name") String address);
|
||||
|
||||
/** @see #create(String) */
|
||||
@Named("Addresses:insert")
|
||||
@POST
|
||||
@Produces(APPLICATION_JSON)
|
||||
Operation create(@BinderParam(BindToJsonPayload.class) AddressCreationOptions options);
|
||||
|
||||
/** Deletes an address by name and returns the operation in progress, or null if not found. */
|
||||
@Named("Addresses:delete")
|
||||
@DELETE
|
||||
|
@ -66,20 +66,6 @@ public interface DiskApi {
|
||||
@Nullable
|
||||
Disk get(@PathParam("disk") String disk);
|
||||
|
||||
/**
|
||||
* Creates a persistent disk resource in the specified project specifying the size of the disk.
|
||||
*
|
||||
* @param diskName the name of disk.
|
||||
* @param sizeGb the size of the disk
|
||||
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
|
||||
* you, and look for the status field.
|
||||
*/
|
||||
@Named("Disks:insert")
|
||||
@POST
|
||||
@Produces(APPLICATION_JSON)
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Operation create(@PayloadParam("name") String diskName, @PayloadParam("sizeGb") int sizeGb);
|
||||
|
||||
/**
|
||||
* Creates a persistent disk resource, in the specified project, specifying the size of the disk and other options.
|
||||
*
|
||||
@ -94,7 +80,23 @@ public interface DiskApi {
|
||||
@Produces(APPLICATION_JSON)
|
||||
@MapBinder(DiskCreationBinder.class)
|
||||
Operation create(@PayloadParam("name") String diskName,
|
||||
@PayloadParam("sizeGb") int sizeGb,
|
||||
@PayloadParam("options") DiskCreationOptions options);
|
||||
|
||||
/**
|
||||
* Creates a persistent disk resource, in the specified project, specifying the size of the disk and other options.
|
||||
*
|
||||
* @param diskName the name of disk.
|
||||
* @param sourceImage Fully-qualified URL of the source image to apply to the disk.
|
||||
* @param options the options of the disk to create.
|
||||
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
|
||||
* you, and look for the status field.
|
||||
*/
|
||||
@Named("Disks:insert")
|
||||
@POST
|
||||
@Produces(APPLICATION_JSON)
|
||||
@MapBinder(DiskCreationBinder.class)
|
||||
Operation create(@PayloadParam("name") String diskName,
|
||||
@QueryParam("sourceImage") String sourceImage,
|
||||
@PayloadParam("options") DiskCreationOptions options);
|
||||
|
||||
/** Deletes a persistent disk by name and returns the operation in progress, or null if not found. */
|
||||
@ -120,6 +122,14 @@ public interface DiskApi {
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName);
|
||||
|
||||
/** @see #createSnapshot(String, String) */
|
||||
@Named("Disks:createSnapshot")
|
||||
@POST
|
||||
@Path("/{disk}/createSnapshot")
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName,
|
||||
@PayloadParam("description") String description);
|
||||
|
||||
/**
|
||||
* Retrieves the list of persistent disk resources available to the specified project.
|
||||
* By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
|
||||
|
@ -41,6 +41,7 @@ import org.jclouds.googlecomputeengine.domain.Operation;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
|
||||
import org.jclouds.googlecomputeengine.options.DeprecateOptions;
|
||||
import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
|
||||
import org.jclouds.googlecomputeengine.options.ListOptions;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.oauth.v2.filters.OAuthFilter;
|
||||
@ -103,6 +104,13 @@ public interface ImageApi {
|
||||
@MapBinder(BindToJsonPayload.class)
|
||||
Operation createFromDisk(@PayloadParam("name") String image, @PayloadParam("sourceDisk") String sourceDisk);
|
||||
|
||||
@Named("Images:insert")
|
||||
@POST
|
||||
@Endpoint(CurrentProject.class)
|
||||
@Path("/global/images")
|
||||
@Produces(APPLICATION_JSON)
|
||||
Operation create(@BinderParam(BindToJsonPayload.class) ImageCreationOptions options);
|
||||
|
||||
/**
|
||||
* Sets the deprecation status of an image. If no message body is given, clears the deprecation status instead.
|
||||
*
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.jclouds.googlecomputeengine.options;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue
|
||||
public abstract class AddressCreationOptions {
|
||||
|
||||
public abstract String name();
|
||||
@Nullable public abstract String address();
|
||||
@Nullable public abstract String description();
|
||||
|
||||
@SerializedNames({"name", "address", "description"})
|
||||
static AddressCreationOptions create(String name, String address, String description){
|
||||
return new AutoValue_AddressCreationOptions(name, address, description);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String name;
|
||||
private String address;
|
||||
private String description;
|
||||
|
||||
public Builder(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Builder address(String address) {
|
||||
this.address = address;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AddressCreationOptions build() {
|
||||
checkNotNull(name, "AddressCreationOptions name cannot be null");
|
||||
return create(name, address, description);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ public class BackendServiceOptions {
|
||||
private Integer port;
|
||||
private String protocol;
|
||||
private String fingerprint;
|
||||
private String portName;
|
||||
|
||||
/**
|
||||
* Name of the BackendService resource.
|
||||
@ -161,4 +162,13 @@ public class BackendServiceOptions {
|
||||
this.fingerprint = fingerprint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPortName() {
|
||||
return portName;
|
||||
}
|
||||
|
||||
public BackendServiceOptions portName(String portName) {
|
||||
this.portName = portName;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -21,25 +21,27 @@ import java.net.URI;
|
||||
public final class DiskCreationOptions {
|
||||
|
||||
private URI type;
|
||||
private URI sourceImage;
|
||||
private Integer sizeGb;
|
||||
private URI sourceSnapshot;
|
||||
private String description;
|
||||
|
||||
|
||||
/**
|
||||
* The disk type, fully qualified URL for the disk type.
|
||||
*
|
||||
* @return the disk type
|
||||
*/
|
||||
public URI type(){
|
||||
public URI type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The source image
|
||||
*
|
||||
* @return sourceImage, fully qualified URL for the image to be copied.
|
||||
* Size of the persistent disk, specified in GB.
|
||||
* You can also specify this when creating a persistent disk
|
||||
* using the sourceImage or sourceSnapshot parameter.
|
||||
*/
|
||||
public URI sourceImage(){
|
||||
return sourceImage;
|
||||
public Integer sizeGb() {
|
||||
return sizeGb;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -47,31 +49,48 @@ public final class DiskCreationOptions {
|
||||
*
|
||||
* @return sourceSnapshot, fully qualified URL for the snapshot to be copied.
|
||||
*/
|
||||
public URI sourceSnapshot(){
|
||||
public URI sourceSnapshot() {
|
||||
return sourceSnapshot;
|
||||
}
|
||||
|
||||
/**
|
||||
* The description
|
||||
*
|
||||
* @return description, An optional textual description of the resource.
|
||||
*/
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DiskCreationOptions#type()
|
||||
*/
|
||||
public DiskCreationOptions type(URI type){
|
||||
public DiskCreationOptions type(URI type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DiskCreationOptions#sourceImage()
|
||||
* @see DiskCreationOptions#sizeGb()
|
||||
*/
|
||||
public DiskCreationOptions sourceImage(URI sourceImage){
|
||||
this.sourceImage = sourceImage;
|
||||
public DiskCreationOptions sizeGb(Integer sizeGb) {
|
||||
this.sizeGb = sizeGb;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DiskCreationOptions#sourceSnapshot()
|
||||
*/
|
||||
public DiskCreationOptions sourceSnapshot(URI sourceSnapshot){
|
||||
public DiskCreationOptions sourceSnapshot(URI sourceSnapshot) {
|
||||
this.sourceSnapshot = sourceSnapshot;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DiskCreationOptions#description()
|
||||
*/
|
||||
public DiskCreationOptions description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ public class FirewallOptions {
|
||||
|
||||
private String name;
|
||||
private URI network;
|
||||
private String description;
|
||||
private ImmutableList.Builder<String> sourceRanges = ImmutableList.builder();
|
||||
private ImmutableList.Builder<String> sourceTags = ImmutableList.builder();
|
||||
private ImmutableList.Builder<String> targetTags = ImmutableList.builder();
|
||||
@ -76,6 +77,21 @@ public class FirewallOptions {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Firewall#description()
|
||||
*/
|
||||
public FirewallOptions description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Firewall#description()
|
||||
*/
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jclouds.googlecomputeengine.domain.Firewall#network()
|
||||
*/
|
||||
|
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* 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.jclouds.googlecomputeengine.options;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Image.RawDisk;
|
||||
import org.jclouds.googlecomputeengine.domain.NewTargetInstance.Builder;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.json.SerializedNames;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
|
||||
@AutoValue
|
||||
public abstract class ImageCreationOptions {
|
||||
|
||||
public abstract String name();
|
||||
@Nullable public abstract String description();
|
||||
@Nullable public abstract String sourceType();
|
||||
@Nullable public abstract RawDisk rawDisk();
|
||||
@Nullable public abstract Deprecated deprecated();
|
||||
@Nullable public abstract String sourceDisk();
|
||||
|
||||
@SerializedNames({"name", "description", "sourceType", "rawDisk", "deprecated", "sourceDisk"})
|
||||
static ImageCreationOptions create(String name, String description, String sourceType,
|
||||
RawDisk rawDisk, Deprecated deprecated, String sourceDisk){
|
||||
return new AutoValue_ImageCreationOptions(name, description, sourceType, rawDisk, deprecated, sourceDisk);
|
||||
}
|
||||
|
||||
public static class Builder{
|
||||
public String name;
|
||||
public String description;
|
||||
public String sourceType;
|
||||
public RawDisk rawDisk;
|
||||
public Deprecated deprecated;
|
||||
public String sourceDisk;
|
||||
|
||||
public Builder(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Builder description(String description) {
|
||||
this.description = description;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sourceType(String sourceType) {
|
||||
this.sourceType = sourceType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder rawDisk(RawDisk rawDisk) {
|
||||
this.rawDisk = rawDisk;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deprecated(Deprecated deprecated) {
|
||||
this.deprecated = deprecated;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sourceDisk(String sourceDisk) {
|
||||
this.sourceDisk = sourceDisk;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ImageCreationOptions build() {
|
||||
checkNotNull(name, "ImageCreationOptions: name cannot be null");
|
||||
return create(name, description, sourceType, rawDisk, deprecated, sourceDisk);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,22 +31,23 @@ import com.google.common.collect.ImmutableMap;
|
||||
@Test(groups = "unit", testName = "DiskCreationBinderTest")
|
||||
public class DiskCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{
|
||||
|
||||
private static final String FAKE_SOURCE_IMAGE = "https://www.googleapis.com/compute/v1/projects/" +
|
||||
private static final String FAKE_SOURCE_SNAPSHOT = "https://www.googleapis.com/compute/v1/projects/" +
|
||||
"debian-cloud/global/images/backports-debian-7-wheezy-v20141017";
|
||||
|
||||
DiskCreationBinder binder = new DiskCreationBinder();
|
||||
|
||||
|
||||
@Test
|
||||
public void testMap() throws SecurityException, NoSuchMethodException {
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(URI.create(FAKE_SOURCE_IMAGE));
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
|
||||
.sourceSnapshot(URI.create(FAKE_SOURCE_SNAPSHOT)).sizeGb(15).description(null);
|
||||
|
||||
HttpRequest request = HttpRequest.builder().method("GET").endpoint("http://momma").build();
|
||||
Map<String, Object> postParams = ImmutableMap.of("name", "testName", "sizeGb", 15, "options", diskCreationOptions);
|
||||
Map<String, Object> postParams = ImmutableMap.of("name", "testName", "options", diskCreationOptions);
|
||||
|
||||
request = binder.bindToRequest(request, postParams);
|
||||
|
||||
assertEquals(request.getPayload().getRawContent(),
|
||||
"{\"name\":\"testName\",\"sizeGb\":15,\"sourceImage\":\"" + FAKE_SOURCE_IMAGE + "\"}");
|
||||
"{\"name\":\"testName\",\"sizeGb\":15,\"sourceSnapshot\":\"" + FAKE_SOURCE_SNAPSHOT + "\"}");
|
||||
assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.googlecomputeengine.domain.Firewall;
|
||||
import org.jclouds.net.domain.IpPermission;
|
||||
import org.jclouds.net.domain.IpProtocol;
|
||||
@ -56,6 +57,7 @@ public class FirewallToIpPermissionTest {
|
||||
return Firewall.create( //
|
||||
"abcd", // id
|
||||
URI.create(baseUrl + "/jclouds/global/firewalls/jclouds-test"), // selfLink
|
||||
new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"), // creationTimestamp
|
||||
"jclouds-test", // name
|
||||
null, // description
|
||||
URI.create(baseUrl + "/jclouds/global/networks/jclouds-test"), // network
|
||||
|
@ -23,11 +23,14 @@ import java.net.URI;
|
||||
|
||||
import org.jclouds.compute.domain.Image.Status;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated.State;
|
||||
import org.jclouds.googlecomputeengine.domain.Image;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@Test(groups = "unit", testName = "GoogleComputeEngineImageToImageTest")
|
||||
public class GoogleComputeEngineImageToImageTest {
|
||||
public void testArbitraryImageName() {
|
||||
@ -86,11 +89,18 @@ public class GoogleComputeEngineImageToImageTest {
|
||||
return Image.create( //
|
||||
"1234", // id
|
||||
URI.create("http://test.com/1234"), // selfLink
|
||||
new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468"), // creationTimestamp
|
||||
name, // name
|
||||
"", // description
|
||||
"RAW", // sourceType
|
||||
Image.RawDisk.create(URI.create("foo"), "TAR", null), // rawDisk
|
||||
deprecated // deprecated
|
||||
deprecated, // deprecated
|
||||
Image.Status.READY, // status
|
||||
Long.parseLong("881210631", 10), // archivedSizeBytes
|
||||
Long.parseLong("8", 10), // diskSizeGb
|
||||
"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk", // sourceDisk
|
||||
"9598530021316715047", // sourceDiskId
|
||||
ImmutableList.of("https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12") // license
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.AssertJUnit.assertNull;
|
||||
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
|
||||
import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseAddressListTest;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
|
||||
@ -52,6 +53,18 @@ public class AddressApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
stringFromResource("/address_insert.json"));
|
||||
}
|
||||
|
||||
public void insert_options() throws Exception {
|
||||
server.enqueue(jsonResponse("/region_operation.json"));
|
||||
|
||||
AddressCreationOptions options = new AddressCreationOptions.Builder("address-with-options")
|
||||
.description("This is a test").address("1.1.1.1").build();
|
||||
assertEquals(addressApi().create(options),
|
||||
new ParseRegionOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/regions/us-central1/addresses",
|
||||
"{\"name\": \"address-with-options\",\"description\":\"This is a test\",\"address\":\"1.1.1.1\"}");
|
||||
}
|
||||
|
||||
public void delete() throws Exception {
|
||||
server.enqueue(jsonResponse("/region_operation.json"));
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
public static final String DISK_NAME = "disk-api-live-test-disk";
|
||||
public static final String SSD_DISK_NAME = "disk-api-live-test-disk-ssd";
|
||||
public static final int sizeGb = 1;
|
||||
public static final int SIZE_GB = 1;
|
||||
|
||||
private DiskApi api() {
|
||||
return api.disksInZone(DEFAULT_ZONE_NAME);
|
||||
@ -42,7 +42,8 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
@Test(groups = "live")
|
||||
public void testInsertDisk() {
|
||||
assertOperationDoneSuccessfully(api().create(DISK_NAME, sizeGb));
|
||||
DiskCreationOptions options = new DiskCreationOptions().sizeGb( SIZE_GB);
|
||||
assertOperationDoneSuccessfully(api().create(DISK_NAME, options));
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testInsertDisk")
|
||||
@ -70,15 +71,15 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
private void assertDiskEquals(Disk result) {
|
||||
assertEquals(result.name(), DISK_NAME);
|
||||
assertEquals(result.sizeGb(), sizeGb);
|
||||
assertEquals(result.sizeGb(), SIZE_GB);
|
||||
assertEquals(result.zone(), getDefaultZoneUrl());
|
||||
}
|
||||
|
||||
@Test(groups = "live")
|
||||
public void testInsertSSDDisk() {
|
||||
URI diskType = getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd");
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType);
|
||||
assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, sizeGb, diskCreationOptions));
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType).sizeGb(SIZE_GB);
|
||||
assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, diskCreationOptions));
|
||||
}
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testInsertSSDDisk")
|
||||
@ -95,7 +96,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
private void assertSSDDiskEquals(Disk result) {
|
||||
assertEquals(result.name(), SSD_DISK_NAME);
|
||||
assertEquals(result.sizeGb(), sizeGb);
|
||||
assertEquals(result.sizeGb(), SIZE_GB);
|
||||
assertEquals(result.zone(), getDefaultZoneUrl());
|
||||
assertEquals(result.type(), getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd"));
|
||||
}
|
||||
|
@ -52,7 +52,8 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
public void insert() throws Exception {
|
||||
server.enqueue(jsonResponse("/zone_operation.json"));
|
||||
|
||||
assertEquals(diskApi().create("testimage1", 1),
|
||||
DiskCreationOptions options = new DiskCreationOptions().sizeGb(1);
|
||||
assertEquals(diskApi().create("testimage1", options),
|
||||
new ParseZoneOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
|
||||
@ -62,20 +63,23 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
public void insertFromImage() throws Exception {
|
||||
server.enqueue(jsonResponse("/zone_operation.json"));
|
||||
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
|
||||
.sourceImage(URI.create(url(IMAGE_URL)));
|
||||
assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sizeGb(1).description("testing 123");
|
||||
|
||||
assertEquals(diskApi().create("testimage1", url(IMAGE_URL), diskCreationOptions),
|
||||
new ParseZoneOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
|
||||
stringFromResource("/disk_insert_sourceImage.json"));
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks?sourceImage="
|
||||
+ url("/projects/party/zones/us-central1-a/images/foo").replace(":", "%3A"), //TODO (broudy) clean this up.
|
||||
"{\"name\":\"testimage1\",\"sizeGb\":1,\"description\":\"testing 123\"}");
|
||||
}
|
||||
|
||||
public void insertFromSSD() throws Exception {
|
||||
server.enqueue(jsonResponse("/zone_operation.json"));
|
||||
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(url(SSD_URL)));
|
||||
assertEquals(diskApi().create("testimage1", 1, diskCreationOptions),
|
||||
DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
|
||||
.type(URI.create(url(SSD_URL))).sizeGb(1);
|
||||
|
||||
assertEquals(diskApi().create("testimage1", diskCreationOptions),
|
||||
new ParseZoneOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
|
||||
@ -92,6 +96,16 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
stringFromResource("/disk_create_snapshot.json"));
|
||||
}
|
||||
|
||||
public void creatSnapshot_description() throws Exception {
|
||||
server.enqueue(jsonResponse("/zone_operation.json"));
|
||||
|
||||
assertEquals(diskApi().createSnapshot("testimage1", "test-snap", "This is a test"),
|
||||
new ParseZoneOperationTest().expected(url("/projects")));
|
||||
|
||||
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks/testimage1/createSnapshot",
|
||||
"{\"name\":\"test-snap\",\"description\":\"This is a test\"}");
|
||||
}
|
||||
|
||||
public void delete() throws Exception {
|
||||
server.enqueue(jsonResponse("/zone_operation.json"));
|
||||
|
||||
|
@ -83,6 +83,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
|
||||
return payload;
|
||||
}
|
||||
|
||||
//TODO (broudy): convert to mock test and add description to test.
|
||||
public void testInsertFirewallResponseIs2xx() throws IOException {
|
||||
|
||||
HttpRequest request = HttpRequest
|
||||
|
@ -31,6 +31,7 @@ import org.jclouds.googlecomputeengine.domain.Image;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated.State;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
|
||||
import org.jclouds.googlecomputeengine.options.DeprecateOptions;
|
||||
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
@ -68,7 +69,8 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
@Test(groups = "live")
|
||||
public void testInsertDisk() {
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, sizeGb));
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
|
||||
new DiskCreationOptions().sizeGb(sizeGb)));
|
||||
Disk disk = diskApi().get(DISK_NAME);
|
||||
diskURI = disk.selfLink();
|
||||
}
|
||||
|
@ -23,9 +23,11 @@ import static org.testng.Assert.assertNull;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated.State;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
|
||||
import org.jclouds.googlecomputeengine.options.DeprecateOptions;
|
||||
import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseImageListTest;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseImageTest;
|
||||
import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
|
||||
@ -106,7 +108,7 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
assertSent(server, "GET", "/projects/centos-cloud/global/images");
|
||||
}
|
||||
|
||||
public void createImageFromPd_2xx() throws Exception{
|
||||
public void createImageFromPd_2xx() throws Exception {
|
||||
server.enqueue(jsonResponse("/operation.json"));
|
||||
|
||||
assertEquals(imageApi().createFromDisk("my-image", url("/projects/party/zones/us-central1-a/disks/mydisk")),
|
||||
@ -114,6 +116,22 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
|
||||
assertSent(server, "POST", "/projects/party/global/images", stringFromResource("/image_insert_from_pd.json"));
|
||||
}
|
||||
|
||||
public void createImage_options() throws Exception {
|
||||
server.enqueue(jsonResponse("/operation.json"));
|
||||
|
||||
ImageCreationOptions options = new ImageCreationOptions.Builder("name")
|
||||
.description("this is a test")
|
||||
.sourceDisk("projects/project/zones/zone/disks/disks")
|
||||
.deprecated(Deprecated.create(State.DEPRECATED, null, null, null, null)).build();
|
||||
assertEquals(imageApi().create(options),
|
||||
new ParseOperationTest().expected(url("/projects")));
|
||||
assertSent(server, "POST", "/projects/party/global/images",
|
||||
"{\"name\":\"name\",\"description\":\"this is a test\",\""
|
||||
+ "deprecated\":{\"state\":\"DEPRECATED\"},\"sourceDisk\":"
|
||||
+ "\"projects/project/zones/zone/disks/disks\"}");
|
||||
|
||||
}
|
||||
|
||||
public void deprecateImage_2xx() throws Exception{
|
||||
String imageName = "test-image";
|
||||
server.enqueue(jsonResponse("/operation.json"));
|
||||
|
@ -38,6 +38,7 @@ import org.jclouds.googlecomputeengine.domain.NewInstance;
|
||||
import org.jclouds.googlecomputeengine.domain.AttachDisk;
|
||||
import org.jclouds.googlecomputeengine.domain.Operation;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
|
||||
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -108,7 +109,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
assertOperationDoneSuccessfully(api.networks().createInIPv4Range
|
||||
(INSTANCE_NETWORK_NAME, IPV4_RANGE));
|
||||
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, DEFAULT_DISK_SIZE_GB));
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
|
||||
new DiskCreationOptions().sizeGb(DEFAULT_DISK_SIZE_GB)));
|
||||
assertOperationDoneSuccessfully(api().create(instance));
|
||||
}
|
||||
|
||||
@ -189,7 +191,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
@Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance")
|
||||
public void testAttachDiskToInstance() {
|
||||
assertOperationDoneSuccessfully(diskApi().create(ATTACH_DISK_NAME, 1));
|
||||
assertOperationDoneSuccessfully(diskApi().create(ATTACH_DISK_NAME,
|
||||
new DiskCreationOptions().sizeGb(1)));
|
||||
|
||||
Instance originalInstance = api().get(INSTANCE_NAME);
|
||||
assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,
|
||||
|
@ -26,6 +26,7 @@ import org.jclouds.googlecloud.domain.ListPage;
|
||||
import org.jclouds.googlecomputeengine.domain.Disk;
|
||||
import org.jclouds.googlecomputeengine.domain.Snapshot;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
|
||||
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
@ -44,7 +45,8 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
|
||||
|
||||
@Test(groups = "live")
|
||||
public void testCreateSnapshot() {
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, 1));
|
||||
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
|
||||
new DiskCreationOptions().sizeGb(1)));
|
||||
disk = diskApi().get(DISK_NAME);
|
||||
|
||||
assertOperationDoneSuccessfully(diskApi().createSnapshot(DISK_NAME, SNAPSHOT_NAME));
|
||||
|
@ -89,7 +89,7 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
|
||||
AtomicReference<Operation> ref = Atomics.newReference(checkNotNull(operation, "operation"));
|
||||
checkState(operationDone.apply(ref), "Timeout waiting for operation: %s", operation);
|
||||
assertEquals(ref.get().status(), Operation.Status.DONE);
|
||||
assertTrue(ref.get().errors().isEmpty());
|
||||
assertTrue(ref.get().error().errors().isEmpty());
|
||||
}
|
||||
|
||||
protected void waitOperationDone(@Nullable Operation operation) {
|
||||
|
@ -25,6 +25,7 @@ import javax.ws.rs.Consumes;
|
||||
import org.jclouds.googlecloud.domain.ForwardingListPage;
|
||||
import org.jclouds.googlecloud.domain.ListPage;
|
||||
import org.jclouds.googlecomputeengine.domain.Address;
|
||||
import org.jclouds.googlecomputeengine.domain.Address.Status;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -50,9 +51,10 @@ public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListP
|
||||
"4881363978908129158", // id
|
||||
URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip2"), // selfLink
|
||||
"test-ip2", // name
|
||||
parse("2013-07-26T14:08:21.552-07:00"), //creationTimestamp
|
||||
"", // description
|
||||
"RESERVED", // status
|
||||
null, // user
|
||||
Status.RESERVED, // status
|
||||
null, // users
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
"173.255.118.115" // address
|
||||
);
|
||||
|
@ -23,9 +23,12 @@ import java.net.URI;
|
||||
import javax.ws.rs.Consumes;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Address;
|
||||
import org.jclouds.googlecomputeengine.domain.Address.Status;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@Test(groups = "unit", testName = "ParseAddressTest")
|
||||
public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> {
|
||||
|
||||
@ -45,9 +48,10 @@ public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address>
|
||||
"4439373783165447583", // id
|
||||
URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip1"), // selfLink
|
||||
"test-ip1", // name
|
||||
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
|
||||
"", // description
|
||||
"RESERVED", // status
|
||||
null, // user
|
||||
Status.IN_USE, // status
|
||||
ImmutableList.of(URI.create(baseUrl + "/party/regions/us-central1-a/forwardingRules/test-forwarding-rule")), // users
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
"173.255.115.190" // address
|
||||
);
|
||||
|
@ -60,7 +60,8 @@ public class ParseBackendServiceListTest extends BaseGoogleComputeEngineParseTes
|
||||
45, //timeoutSec,
|
||||
80, //port,
|
||||
"HTTP", //protocol,
|
||||
null) //fingerprint
|
||||
null, //fingerprint
|
||||
null) // portName
|
||||
),
|
||||
null
|
||||
);
|
||||
|
@ -67,7 +67,8 @@ public class ParseBackendServiceTest extends BaseGoogleComputeEngineParseTest<Ba
|
||||
30, //timeoutSec
|
||||
80, //port
|
||||
"HTTP", //protocol
|
||||
"I6n5NPSXn8g=" //fingerprint
|
||||
"I6n5NPSXn8g=", //fingerprint
|
||||
null // portName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import java.net.URI;
|
||||
import javax.ws.rs.Consumes;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Disk;
|
||||
import org.jclouds.googlecomputeengine.domain.Disk.Status;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -43,13 +44,19 @@ public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> {
|
||||
public Disk expected(String baseUrl){
|
||||
return Disk.create( //
|
||||
"13050421646334304115", // id
|
||||
parse("2012-11-25T01:38:48.306"), // creationTimestamp
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
|
||||
"READY", // status
|
||||
Status.READY, // status
|
||||
"testimage1", // name
|
||||
null, // description
|
||||
1, // sizeGb
|
||||
null, // sourceSnapshot
|
||||
null, // sourceSnapshotId
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // selfLink
|
||||
URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard") // type
|
||||
null, // sourceImage
|
||||
null, // sourceImageId
|
||||
URI.create(baseUrl + "/studied-point-720/zones/us-central1-a/diskTypes/pd-standard"), // type
|
||||
null // license
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ public class ParseDiskTypeListTest extends BaseGoogleComputeEngineParseTest<List
|
||||
@Override @Consumes(APPLICATION_JSON)
|
||||
public ListPage<DiskType> expected() {
|
||||
String contentBaseUrl = BASE_URL.replace("www", "content");
|
||||
DiskType diskType1 = DiskType.create( //
|
||||
DiskType diskType1 = DiskType.create(
|
||||
parse("2014-06-02T11:07:28.530-07:00"), // creationTimestamp
|
||||
"pd-standard", // name
|
||||
"Standard Persistent Disk", // description
|
||||
"10GB-10TB", // validDiskSize
|
||||
|
@ -37,7 +37,8 @@ public class ParseDiskTypeTest extends BaseGoogleComputeEngineParseTest<DiskType
|
||||
@Override @Consumes(APPLICATION_JSON)
|
||||
public DiskType expected() {
|
||||
String contentBaseUrl = BASE_URL.replace("www", "content");
|
||||
return DiskType.create( //
|
||||
return DiskType.create(
|
||||
parse("2014-06-02T11:07:28.529-07:00"), // creationTimestamp
|
||||
"pd-ssd", // name
|
||||
"SSD Persistent Disk", // description
|
||||
"10GB-1TB", // validDiskSize
|
||||
|
@ -49,6 +49,7 @@ public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<List
|
||||
Firewall firewall2 = Firewall.create( //
|
||||
"12862241067393040785", // id
|
||||
URI.create(baseUrl + "/google/global/firewalls/default-ssh"), // selfLink
|
||||
parse("2012-04-13T03:05:04.365"), // creationTimestamp
|
||||
"default-ssh", // name
|
||||
"SSH allowed from anywhere", // description
|
||||
URI.create(baseUrl + "/google/global/networks/default"), // network
|
||||
|
@ -47,6 +47,7 @@ public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall
|
||||
return Firewall.create( //
|
||||
"12862241031274216284", // id
|
||||
URI.create(base_url + "/party/global/firewalls/jclouds-test"), // selfLink
|
||||
parse("2012-04-13T03:05:02.855"), // creationTimestamp
|
||||
"jclouds-test", // name
|
||||
"Internal traffic from default allowed", // description
|
||||
URI.create(base_url + "/party/global/networks/jclouds-test"), // network
|
||||
|
@ -43,6 +43,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
|
||||
public Operation expected(String baseUrl) {
|
||||
return Operation.create( //
|
||||
"13053095055850848306", // id
|
||||
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
|
||||
URI.create(baseUrl + "/party/global/operations/operation-1354084865060"),
|
||||
"operation-1354084865060", // name
|
||||
null, // description
|
||||
@ -60,6 +61,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
|
||||
null, // httpErrorMessage
|
||||
"insert", // operationType
|
||||
null, // errors
|
||||
null, // warnings
|
||||
null, // region
|
||||
null // zone
|
||||
);
|
||||
|
@ -26,9 +26,12 @@ import javax.ws.rs.Consumes;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated;
|
||||
import org.jclouds.googlecomputeengine.domain.Deprecated.State;
|
||||
import org.jclouds.googlecomputeengine.domain.Image;
|
||||
import org.jclouds.googlecomputeengine.domain.Image.Status;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@Test(groups = "unit", testName = "ParseImageTest")
|
||||
public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
|
||||
|
||||
@ -47,6 +50,7 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
|
||||
return Image.create( //
|
||||
"12941197498378735318", // id
|
||||
URI.create(baseUrl + "/centos-cloud/global/images/centos-6-2-v20120326"), // selfLink
|
||||
parse("2012-07-16T22:16:13.468"), // creationTimestamp
|
||||
"centos-6-2-v20120326", // name
|
||||
"DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", // description
|
||||
"RAW", // sourceType
|
||||
@ -57,6 +61,14 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
|
||||
null, // deprecated
|
||||
null, // obsolete
|
||||
null // deleted
|
||||
));
|
||||
),
|
||||
Status.READY, // status
|
||||
Long.parseLong("881210631", 10), // archivedSizeBytes
|
||||
Long.parseLong("8", 10), // diskSizeGb
|
||||
baseUrl + "/party/zones/us-central1-a/disk/disk", // sourceDisk
|
||||
"9598530021316715047", // sourceDiskId
|
||||
ImmutableList.of(baseUrl + "/suse-cloud/global/licenses/sles-12") // license
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,12 @@ import java.net.URI;
|
||||
import javax.ws.rs.Consumes;
|
||||
|
||||
import org.jclouds.googlecomputeengine.domain.Operation;
|
||||
import org.jclouds.googlecomputeengine.domain.Operation.Warning;
|
||||
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@Test(groups = "unit", testName = "ParseOperationTest")
|
||||
public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operation> {
|
||||
|
||||
@ -43,6 +46,7 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
|
||||
public Operation expected(String baseUrl) {
|
||||
return Operation.create( //
|
||||
"13053095055850848306", // id
|
||||
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
|
||||
"operation-1354084865060", // name
|
||||
null, // description
|
||||
@ -56,10 +60,18 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
|
||||
parse("2012-11-28T06:41:05.060"), // insertTime
|
||||
parse("2012-11-28T06:41:05.142"), // startTime
|
||||
parse("2012-11-28T06:41:06.142"), // endTime
|
||||
null, // httpErrorStatusCode
|
||||
null, // httpErrorMessage
|
||||
400, // httpErrorStatusCode
|
||||
"BAD REQUEST", // httpErrorMessage
|
||||
"insert", // operationType
|
||||
null, // errors
|
||||
Operation.Error.create(ImmutableList.of(Operation.Error.Entry
|
||||
.create("INVALID_FIELD_VALUE", null,
|
||||
"Invalid value for field 'resource.urlMaps': "
|
||||
+ "'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'."
|
||||
+ " Resource was not found."))), // errors
|
||||
ImmutableList.of(Warning
|
||||
.create("NO_RESULTS_ON_PAGE", "This is an example warning",
|
||||
ImmutableList.of(Warning.Entry
|
||||
.create("scope", "There are no results for scope 'zones/asia-east1-b' on this page.")))), // warnings
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a") // zone
|
||||
);
|
||||
|
@ -43,6 +43,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
|
||||
public Operation expected(String baseUrl) {
|
||||
return Operation.create( //
|
||||
"13053095055850848306", // id
|
||||
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
|
||||
URI.create(baseUrl + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink
|
||||
"operation-1354084865060", // name
|
||||
null, // description
|
||||
@ -60,6 +61,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
|
||||
null, // httpErrorMessage
|
||||
"insert", // operationType
|
||||
null, // errors
|
||||
null, // warnings
|
||||
URI.create(baseUrl + "/party/regions/us-central1"), // region
|
||||
null // zone
|
||||
);
|
||||
|
@ -43,6 +43,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
|
||||
public Operation expected(String baseUrl) {
|
||||
return Operation.create( //
|
||||
"13053095055850848306", // id
|
||||
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
|
||||
"operation-1354084865060", // name
|
||||
null, // description
|
||||
@ -60,6 +61,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
|
||||
null, // httpErrorMessage
|
||||
"insert", // operationType
|
||||
null, // errors
|
||||
null, // warnings
|
||||
null, // region
|
||||
URI.create(baseUrl + "/party/zones/us-central1-a") // zone
|
||||
);
|
||||
|
@ -27,6 +27,7 @@ import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.date.internal.SimpleDateFormatDateService;
|
||||
import org.jclouds.googlecomputeengine.domain.Firewall;
|
||||
import org.jclouds.net.domain.IpPermission;
|
||||
import org.jclouds.net.domain.IpProtocol;
|
||||
@ -42,6 +43,7 @@ public class NetworkFirewallPredicatesTest {
|
||||
return Firewall.create( //
|
||||
"abcd", // id
|
||||
URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
|
||||
new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
|
||||
"jclouds-test", // name
|
||||
null, // description
|
||||
URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
|
||||
@ -58,6 +60,7 @@ public class NetworkFirewallPredicatesTest {
|
||||
return Firewall.create( //
|
||||
"abcd", // id
|
||||
URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink
|
||||
new SimpleDateFormatDateService().iso8601DateParse("2014-07-18T09:47:30.826-07:00"), // creationTimestamp
|
||||
"jclouds-test", // name
|
||||
null, // description
|
||||
URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
|
||||
|
@ -1,11 +1,14 @@
|
||||
{
|
||||
"kind": "compute#address",
|
||||
"id": "4439373783165447583",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"status": "RESERVED",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip1",
|
||||
"description": "",
|
||||
"address": "173.255.115.190",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1"
|
||||
"kind": "compute#address",
|
||||
"id": "4439373783165447583",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"status": "IN_USE",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip1",
|
||||
"description": "",
|
||||
"address": "173.255.115.190",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1",
|
||||
"users": [
|
||||
"https://www.googleapis.com/compute/v1/projects/party/regions/us-central1-a/forwardingRules/test-forwarding-rule"
|
||||
]
|
||||
}
|
@ -1,31 +1,32 @@
|
||||
{
|
||||
"kind": "compute#addressList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses",
|
||||
"id": "projects/party/regions/us-central1/addresses",
|
||||
"items": [
|
||||
{
|
||||
|
||||
"kind": "compute#address",
|
||||
"id": "4439373783165447583",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"status": "RESERVED",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip1",
|
||||
"description": "",
|
||||
"address": "173.255.115.190",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1"
|
||||
},
|
||||
{
|
||||
|
||||
"kind": "compute#address",
|
||||
"id": "4881363978908129158",
|
||||
"creationTimestamp": "2013-07-26T14:08:21.552-07:00",
|
||||
"status": "RESERVED",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip2",
|
||||
"description": "",
|
||||
"address": "173.255.118.115",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2"
|
||||
}
|
||||
]
|
||||
"kind": "compute#addressList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses",
|
||||
"id": "projects/party/regions/us-central1/addresses",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#address",
|
||||
"id": "4439373783165447583",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"status": "IN_USE",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip1",
|
||||
"description": "",
|
||||
"address": "173.255.115.190",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1",
|
||||
"users": [
|
||||
"https://www.googleapis.com/compute/v1/projects/party/regions/us-central1-a/forwardingRules/test-forwarding-rule"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "compute#address",
|
||||
"id": "4881363978908129158",
|
||||
"creationTimestamp": "2013-07-26T14:08:21.552-07:00",
|
||||
"status": "RESERVED",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"name": "test-ip2",
|
||||
"description": "",
|
||||
"address": "173.255.118.115",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2"
|
||||
}
|
||||
]
|
||||
}
|
@ -80,6 +80,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
|
||||
|
@ -1 +0,0 @@
|
||||
{"name":"testimage1","sizeGb":1,"sourceImage":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/images/foo"}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
|
||||
|
@ -6,6 +6,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",
|
||||
|
@ -1,17 +1,25 @@
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "12941197498378735318",
|
||||
"creationTimestamp": "2012-07-16T22:16:13.468",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
|
||||
"name": "centos-6-2-v20120326",
|
||||
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
|
||||
"sourceType": "RAW",
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
|
||||
},
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
}
|
||||
}
|
||||
"kind": "compute#image",
|
||||
"id": "12941197498378735318",
|
||||
"creationTimestamp": "2012-07-16T22:16:13.468",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
|
||||
"name": "centos-6-2-v20120326",
|
||||
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
|
||||
"sourceType": "RAW",
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
|
||||
},
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
},
|
||||
"status": "READY",
|
||||
"archiveSizeBytes": "881210631",
|
||||
"diskSizeGb": "8",
|
||||
"sourceDisk": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk",
|
||||
"sourceDiskId": "9598530021316715047",
|
||||
"licenses": [
|
||||
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
|
||||
]
|
||||
}
|
@ -1,24 +1,32 @@
|
||||
{
|
||||
"kind": "compute#imageList",
|
||||
"id": "projects/centos-cloud/global/images",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "12941197498378735318",
|
||||
"creationTimestamp": "2012-07-16T22:16:13.468",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
|
||||
"name": "centos-6-2-v20120326",
|
||||
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
|
||||
"sourceType": "RAW",
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
|
||||
},
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"kind": "compute#imageList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
|
||||
"id": "projects/centos-cloud/global/images",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "12941197498378735318",
|
||||
"creationTimestamp": "2012-07-16T22:16:13.468",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
|
||||
"name": "centos-6-2-v20120326",
|
||||
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
|
||||
"sourceType": "RAW",
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
|
||||
},
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
},
|
||||
"status": "READY",
|
||||
"archiveSizeBytes": "881210631",
|
||||
"diskSizeGb": "8",
|
||||
"sourceDisk": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/disk/disk",
|
||||
"sourceDiskId": "9598530021316715047",
|
||||
"licenses": [
|
||||
"https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,50 +1,71 @@
|
||||
{
|
||||
"kind": "compute#imageList",
|
||||
"id": "projects/centos-cloud/global/images",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
|
||||
"items": [
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "13037722963789596520",
|
||||
"creationTimestamp": "2012-11-09T11:43:28.749-08:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20121106",
|
||||
"name": "gcel-10-04-v20121106",
|
||||
"description": "SCSI-enabled GCEL 10.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000",
|
||||
"sourceType": "RAW",
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "13037721421359523565",
|
||||
"creationTimestamp": "2012-11-09T11:40:51.994-08:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-7-wheezy-v20140718",
|
||||
"name": "debian-7-wheezy-v20140718",
|
||||
"description": "SCSI-enabled GCEL 12.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000",
|
||||
"sourceType": "RAW",
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "compute#image",
|
||||
"id": "12941198995845323366",
|
||||
"creationTimestamp": "2012-07-16T15:18:50.405-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/ubuntu-10-04-v20110728",
|
||||
"name": "ubuntu-10-04-v20110728",
|
||||
"description": "DEPRECATED. GCEL 10.04 LTS; Created Thu, 28 Jul 2011 16:45:51 +0000",
|
||||
"sourceType": "RAW",
|
||||
"deprecated": {
|
||||
"state": "DELETED",
|
||||
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20130104"
|
||||
},
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"kind": "compute#imageList",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
|
||||
"id": "projects/centos-cloud/global/images",
|
||||
"items": [
|
||||
{
|
||||
|
||||
"kind": "compute#image",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20131120",
|
||||
"id": "11748647391859510935",
|
||||
"creationTimestamp": "2013-11-25T15:13:50.611-08:00",
|
||||
"name": "centos-6-v20131120",
|
||||
"description": "SCSI-enabled CentOS 6 built on 2013-11-20",
|
||||
"sourceType": "RAW",
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
},
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318"
|
||||
},
|
||||
"status": "READY",
|
||||
"archiveSizeBytes": "269993565",
|
||||
"diskSizeGb": "10"
|
||||
},
|
||||
{
|
||||
|
||||
"kind": "compute#image",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318",
|
||||
"id": "11743140967858608122",
|
||||
"creationTimestamp": "2014-03-19T15:01:13.388-07:00",
|
||||
"name": "centos-6-v20140318",
|
||||
"description": "CentOS 6.5 x86_64 built on 2014-03-18",
|
||||
"sourceType": "RAW",
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
},
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408"
|
||||
},
|
||||
"status": "READY",
|
||||
"archiveSizeBytes": "341230444",
|
||||
"diskSizeGb": "10"
|
||||
},
|
||||
{
|
||||
|
||||
"kind": "compute#image",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408",
|
||||
"id": "18033188469723077298",
|
||||
"creationTimestamp": "2014-04-09T10:31:57.518-07:00",
|
||||
"name": "centos-6-v20140408",
|
||||
"description": "CentOS 6.5 x86_64 built on 2014-04-08",
|
||||
"sourceType": "RAW",
|
||||
"rawDisk": {
|
||||
"source": "",
|
||||
"containerType": "TAR"
|
||||
},
|
||||
"deprecated": {
|
||||
"state": "DEPRECATED",
|
||||
"replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140415"
|
||||
},
|
||||
"status": "READY",
|
||||
"archiveSizeBytes": "342252847",
|
||||
"diskSizeGb": "10"
|
||||
}
|
||||
],
|
||||
"nextPageToken": "CkcIjf6H7sqqwgI6PAoCGAEKAiAACgIYAgoHIJT6lOrjDQoCGAYKFCoSY2VudG9zLTYtdjIwMTQwNDA4CgsgsrWOzOirsKH6AQ=="
|
||||
}
|
@ -1,17 +1,40 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
|
||||
"targetId": "13053094017547040099",
|
||||
"status": "DONE",
|
||||
"user": "user@developer.gserviceaccount.com",
|
||||
"progress": 100,
|
||||
"insertTime": "2012-11-28T06:41:05.060",
|
||||
"startTime": "2012-11-28T06:41:05.142",
|
||||
"endTime": "2012-11-28T06:41:06.142",
|
||||
"operationType": "insert",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a"
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
|
||||
"targetId": "13053094017547040099",
|
||||
"status": "DONE",
|
||||
"user": "user@developer.gserviceaccount.com",
|
||||
"progress": 100,
|
||||
"insertTime": "2012-11-28T06:41:05.060",
|
||||
"startTime": "2012-11-28T06:41:05.142",
|
||||
"endTime": "2012-11-28T06:41:06.142",
|
||||
"operationType": "insert",
|
||||
"error": {
|
||||
"errors": [
|
||||
{
|
||||
"code": "INVALID_FIELD_VALUE",
|
||||
"message": "Invalid value for field 'resource.urlMaps': 'projects/party/global/urlMaps/target-http-proxy-api-live-test-url-map-2'. Resource was not found."
|
||||
}
|
||||
]
|
||||
},
|
||||
"warnings": [
|
||||
{
|
||||
"code": "NO_RESULTS_ON_PAGE",
|
||||
"message": "This is an example warning",
|
||||
"data": [
|
||||
{
|
||||
"key": "scope",
|
||||
"value": "There are no results for scope 'zones/asia-east1-b' on this page."
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"httpErrorStatusCode": 400,
|
||||
"httpErrorMessage": "BAD REQUEST",
|
||||
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
|
||||
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a"
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",
|
||||
|
@ -6,6 +6,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
|
||||
|
@ -6,6 +6,7 @@
|
||||
{
|
||||
"kind": "compute#operation",
|
||||
"id": "13053095055850848306",
|
||||
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
|
||||
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
|
||||
"name": "operation-1354084865060",
|
||||
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user