Updates to Address, Disk, Image, Operations + others

This commit is contained in:
Daniel Broudy 2014-12-02 15:34:58 -08:00 committed by Ignasi Barrera
parent 1d3ad709d5
commit 6918ab1089
58 changed files with 783 additions and 255 deletions

View File

@ -37,11 +37,11 @@ public final class DiskCreationBinder implements MapBinder {
try { try {
json.beginObject(); json.beginObject();
json.name("name").value(postParams.get("name").toString()); 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("type").value(options.type() != null ? options.type().toString() : null);
json.name("sourceImage").value(options.sourceImage() != null ? options.sourceImage().toString() : null);
json.name("sourceSnapshot") json.name("sourceSnapshot")
.value(options.sourceSnapshot() != null ? options.sourceSnapshot().toString() : null); .value(options.sourceSnapshot() != null ? options.sourceSnapshot().toString() : null);
json.name("description").value(options.description());
json.endObject(); json.endObject();
json.close(); json.close();
} catch (IOException e) { } catch (IOException e) {

View File

@ -40,7 +40,7 @@ public final class AtomicOperationDone implements Predicate<AtomicReference<Oper
checkNotNull(input.get(), "operation"); checkNotNull(input.get(), "operation");
Operation current = resources.operation(input.get().selfLink()); Operation current = resources.operation(input.get().selfLink());
input.set(current); 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()) { switch (current.status()) {
case DONE: case DONE:
return true; return true;

View File

@ -17,6 +17,8 @@
package org.jclouds.googlecomputeengine.domain; package org.jclouds.googlecomputeengine.domain;
import java.net.URI; import java.net.URI;
import java.util.Date;
import java.util.List;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames; import org.jclouds.json.SerializedNames;
@ -26,12 +28,18 @@ import com.google.auto.value.AutoValue;
@AutoValue @AutoValue
public abstract class Address { public abstract class Address {
public enum Status{
RESERVED,
IN_USE;
}
public abstract String id(); public abstract String id();
public abstract URI selfLink(); public abstract URI selfLink();
public abstract String name(); public abstract String name();
public abstract Date creationTimestamp();
@Nullable public abstract String description(); @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 * 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. * 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. */ /** 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. */ /** URL of the region where the address resides. */
public abstract URI region(); public abstract URI region();
@ -50,10 +58,10 @@ public abstract class Address {
/** The IP address represented by this resource. */ /** The IP address represented by this resource. */
public abstract String address(); public abstract String address();
@SerializedNames({ "id", "selfLink", "name", "description", "status", "user", "region", "address" }) @SerializedNames({ "id", "selfLink", "name", "creationTimestamp", "description", "status", "users", "region", "address" })
public static Address create(String id, URI selfLink, String name, String description, String status, URI user, public static Address create(String id, URI selfLink, String name, Date creationTimestamp, String description, Status status, List<URI> users,
URI region, String address) { 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() { Address() {

View File

@ -76,6 +76,7 @@ public abstract class BackendService {
@Nullable public abstract int port(); @Nullable public abstract int port();
@Nullable public abstract String protocol(); @Nullable public abstract String protocol();
@Nullable public abstract String fingerprint(); @Nullable public abstract String fingerprint();
@Nullable public abstract String portName();
/** /**
* @param timeoutSec Defaults to 30 when null. * @param timeoutSec Defaults to 30 when null.
@ -83,18 +84,18 @@ public abstract class BackendService {
*/ */
@SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description", @SerializedNames({ "id", "creationTimestamp", "selfLink", "name", "description",
"backends", "healthChecks", "timeoutSec", "port", "protocol", "backends", "healthChecks", "timeoutSec", "port", "protocol",
"fingerprint"}) "fingerprint", "portName"})
public static BackendService create(String id, Date creationTimestamp, URI selfLink, public static BackendService create(String id, Date creationTimestamp, URI selfLink,
String name, @Nullable String description, String name, @Nullable String description,
@Nullable List<Backend> backends, List<URI> healthChecks, @Nullable List<Backend> backends, List<URI> healthChecks,
@Nullable Integer timeoutSec, @Nullable Integer port, @Nullable Integer timeoutSec, @Nullable Integer port,
@Nullable String protocol, @Nullable String protocol,
@Nullable String fingerprint){ @Nullable String fingerprint, String portName){
return new AutoValue_BackendService(id, creationTimestamp, selfLink, name, description, return new AutoValue_BackendService(id, creationTimestamp, selfLink, name, description,
backends, healthChecks, backends, healthChecks,
timeoutSec != null ? timeoutSec : 30, timeoutSec != null ? timeoutSec : 30,
port != null ? port : 80, port != null ? port : 80,
protocol, fingerprint); protocol, fingerprint, portName);
} }
BackendService(){ BackendService(){

View File

@ -17,6 +17,8 @@
package org.jclouds.googlecomputeengine.domain; package org.jclouds.googlecomputeengine.domain;
import java.net.URI; import java.net.URI;
import java.util.Date;
import java.util.List;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames; import org.jclouds.json.SerializedNames;
@ -25,11 +27,21 @@ import com.google.auto.value.AutoValue;
@AutoValue @AutoValue
public abstract class Disk { public abstract class Disk {
public enum Status {
CREATING,
FAILED,
READY,
RESTORING;
}
public abstract String id(); public abstract String id();
public abstract Date creationTimestamp();
public abstract URI zone(); public abstract URI zone();
public abstract String status(); // TODO: enum public abstract Status status();
public abstract String name(); public abstract String name();
@ -37,15 +49,27 @@ public abstract class Disk {
public abstract int sizeGb(); public abstract int sizeGb();
@Nullable public abstract String sourceSnapshot();
@Nullable public abstract String sourceSnapshotId();
public abstract URI selfLink(); public abstract URI selfLink();
@Nullable public abstract String sourceImage();
@Nullable public abstract String sourceImageId();
/** URL of the corresponding disk type resource. */ /** URL of the corresponding disk type resource. */
@Nullable public abstract URI type(); @Nullable public abstract URI type();
@SerializedNames({ "id", "zone", "status", "name", "description", "sizeGb", "selfLink", "type" }) @Nullable public abstract List<String> licenses();
public static Disk create(String id, URI zone, String status, String name, String description, int sizeGb,
URI selfLink, URI type) { @SerializedNames({ "id", "creationTimestamp", "zone", "status", "name", "description", "sizeGb", "sourceSnapshot",
return new AutoValue_Disk(id, zone, status, name, description, sizeGb, selfLink, type); "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(){ Disk(){

View File

@ -17,6 +17,7 @@
package org.jclouds.googlecomputeengine.domain; package org.jclouds.googlecomputeengine.domain;
import java.net.URI; import java.net.URI;
import java.util.Date;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames; import org.jclouds.json.SerializedNames;
@ -26,6 +27,8 @@ import com.google.auto.value.AutoValue;
@AutoValue @AutoValue
public abstract class DiskType { public abstract class DiskType {
public abstract Date creationTimestamp();
public abstract String name(); public abstract String name();
@Nullable public abstract String description(); @Nullable public abstract String description();
@ -42,10 +45,10 @@ public abstract class DiskType {
/** Server defined default disk size in GB. */ /** Server defined default disk size in GB. */
public abstract long defaultDiskSizeGb(); public abstract long defaultDiskSizeGb();
@SerializedNames({ "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" }) @SerializedNames({ "creationTimestamp", "name", "description", "validDiskSize", "deprecated", "zone", "selfLink", "defaultDiskSizeGb" })
public static DiskType create(String name, String description, String validDiskSize, Deprecated deprecated, URI zone, public static DiskType create(Date creationTimestamp, String name, String description, String validDiskSize, Deprecated deprecated, URI zone,
URI selfLink, long defaultDiskSizeGb) { 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() { DiskType() {

View File

@ -19,6 +19,7 @@ package org.jclouds.googlecomputeengine.domain;
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf; import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
import java.net.URI; import java.net.URI;
import java.util.Date;
import java.util.List; import java.util.List;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
@ -55,6 +56,8 @@ public abstract class Firewall {
public abstract URI selfLink(); public abstract URI selfLink();
public abstract Date creationTimestamp();
public abstract String name(); public abstract String name();
@Nullable public abstract String description(); @Nullable public abstract String description();
@ -94,10 +97,10 @@ public abstract class Firewall {
public abstract List<Rule> allowed(); public abstract List<Rule> allowed();
@SerializedNames( @SerializedNames(
{ "id", "selfLink", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" }) { "id", "selfLink", "creationTimestamp", "name", "description", "network", "sourceRanges", "sourceTags", "targetTags", "allowed" })
public static Firewall create(String id, URI selfLink, String name, String description, URI network, 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) { 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)); copyOf(targetTags), copyOf(allowed));
} }

View File

@ -17,6 +17,8 @@
package org.jclouds.googlecomputeengine.domain; package org.jclouds.googlecomputeengine.domain;
import java.net.URI; import java.net.URI;
import java.util.Date;
import java.util.List;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames; import org.jclouds.json.SerializedNames;
@ -26,6 +28,12 @@ import com.google.auto.value.AutoValue;
@AutoValue @AutoValue
public abstract class Image { public abstract class Image {
public enum Status {
FAILED,
PENDING,
READY;
}
@AutoValue @AutoValue
public abstract static class RawDisk { public abstract static class RawDisk {
/** /**
@ -58,22 +66,39 @@ public abstract class Image {
public abstract URI selfLink(); public abstract URI selfLink();
public abstract Date creationTimestamp();
public abstract String name(); public abstract String name();
@Nullable public abstract String description(); @Nullable public abstract String description();
/** Must be RAW; provided by the client when the disk image is created. */ /** Must be RAW; provided by the client when the disk image is created. */
// TODO: if this is true, why bother listing it? // 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 RawDisk rawDisk();
@Nullable public abstract Deprecated deprecated(); @Nullable public abstract Deprecated deprecated();
@SerializedNames({ "id", "selfLink", "name", "description", "sourceType", "rawDisk", "deprecated" }) public abstract Status status();
public static Image create(String id, URI selfLink, String name, String description, String sourceType,
RawDisk rawDisk, Deprecated deprecated) { public abstract Long archiveSizeBytes();
return new AutoValue_Image(id, selfLink, name, description, sourceType, rawDisk, deprecated);
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() { Image() {

View File

@ -16,12 +16,12 @@
*/ */
package org.jclouds.googlecomputeengine.domain; package org.jclouds.googlecomputeengine.domain;
import static org.jclouds.googlecloud.internal.NullSafeCopies.copyOf;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.jclouds.googlecomputeengine.domain.Metadata.Entry;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames; import org.jclouds.json.SerializedNames;
@ -32,20 +32,71 @@ public abstract class Operation {
@AutoValue @AutoValue
public abstract static class Error { 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. */ @AutoValue
@Nullable public abstract String location(); 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" }) /** The field in the request which caused the error. */
public static Error create(String code, String location, String message) { @Nullable public abstract String location();
return new AutoValue_Operation_Error(code, location, message);
@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(); public abstract String id();
@Nullable public abstract Date creationTimestamp();
public abstract URI selfLink(); public abstract URI selfLink();
public abstract String name(); public abstract String name();
@ -103,22 +156,24 @@ public abstract class Operation {
/** Examples include insert, update, and delete. */ /** Examples include insert, update, and delete. */
public abstract String operationType(); // TODO: enum 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 region();
@Nullable public abstract URI zone(); @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", "statusMessage", "user", "progress", "insertTime", "startTime", "endTime", "httpErrorStatusCode",
"httpErrorMessage", "operationType", "errors", "region", "zone" }) "httpErrorMessage", "operationType", "error", "warnings", "region", "zone" })
public static Operation create(String id, URI selfLink, String name, String description, URI targetLink, 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, String targetId, String clientOperationId, Status status, String statusMessage, String user, Integer progress,
Date insertTime, Date startTime, Date endTime, Integer httpErrorStatusCode, String httpErrorMessage, Date insertTime, Date startTime, Date endTime, Integer httpErrorStatusCode, String httpErrorMessage,
String operationType, List<Error> errors, URI region, URI zone) { String operationType, Error error, List<Warning> warnings, URI region, URI zone) {
return new AutoValue_Operation(id, selfLink, name, description, targetLink, targetId, clientOperationId, status, return new AutoValue_Operation(id, creationTimestamp, selfLink, name, description, targetLink, targetId, clientOperationId, status,
statusMessage, user, progress, insertTime, startTime, endTime, httpErrorStatusCode, httpErrorMessage, statusMessage, user, progress, insertTime, startTime, endTime, httpErrorStatusCode, httpErrorMessage,
operationType, copyOf(errors), region, zone); operationType, error != null ? error : Error.empty(), warnings, region, zone);
} }
Operation() { Operation() {

View File

@ -37,9 +37,11 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
import org.jclouds.googlecomputeengine.domain.Address; import org.jclouds.googlecomputeengine.domain.Address;
import org.jclouds.googlecomputeengine.domain.Operation; import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage; import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions; import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.filters.OAuthFilter; import org.jclouds.oauth.v2.filters.OAuthFilter;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder; import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.PayloadParam;
@ -77,6 +79,12 @@ public interface AddressApi {
@MapBinder(BindToJsonPayload.class) @MapBinder(BindToJsonPayload.class)
Operation create(@PayloadParam("name") String address); 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. */ /** Deletes an address by name and returns the operation in progress, or null if not found. */
@Named("Addresses:delete") @Named("Addresses:delete")
@DELETE @DELETE

View File

@ -66,20 +66,6 @@ public interface DiskApi {
@Nullable @Nullable
Disk get(@PathParam("disk") String disk); 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. * 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) @Produces(APPLICATION_JSON)
@MapBinder(DiskCreationBinder.class) @MapBinder(DiskCreationBinder.class)
Operation create(@PayloadParam("name") String diskName, 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); @PayloadParam("options") DiskCreationOptions options);
/** Deletes a persistent disk by name and returns the operation in progress, or null if not found. */ /** 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) @MapBinder(BindToJsonPayload.class)
Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName); 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. * 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 * By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not

View File

@ -41,6 +41,7 @@ import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage; import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage; import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.DeprecateOptions; import org.jclouds.googlecomputeengine.options.DeprecateOptions;
import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions; import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.filters.OAuthFilter; import org.jclouds.oauth.v2.filters.OAuthFilter;
@ -103,6 +104,13 @@ public interface ImageApi {
@MapBinder(BindToJsonPayload.class) @MapBinder(BindToJsonPayload.class)
Operation createFromDisk(@PayloadParam("name") String image, @PayloadParam("sourceDisk") String sourceDisk); 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. * Sets the deprecation status of an image. If no message body is given, clears the deprecation status instead.
* *

View File

@ -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);
}
}
}

View File

@ -32,6 +32,7 @@ public class BackendServiceOptions {
private Integer port; private Integer port;
private String protocol; private String protocol;
private String fingerprint; private String fingerprint;
private String portName;
/** /**
* Name of the BackendService resource. * Name of the BackendService resource.
@ -161,4 +162,13 @@ public class BackendServiceOptions {
this.fingerprint = fingerprint; this.fingerprint = fingerprint;
return this; return this;
} }
public String getPortName() {
return portName;
}
public BackendServiceOptions portName(String portName) {
this.portName = portName;
return this;
}
} }

View File

@ -21,25 +21,27 @@ import java.net.URI;
public final class DiskCreationOptions { public final class DiskCreationOptions {
private URI type; private URI type;
private URI sourceImage; private Integer sizeGb;
private URI sourceSnapshot; private URI sourceSnapshot;
private String description;
/** /**
* The disk type, fully qualified URL for the disk type. * The disk type, fully qualified URL for the disk type.
* *
* @return the disk type * @return the disk type
*/ */
public URI type(){ public URI type() {
return type; return type;
} }
/** /**
* The source image * Size of the persistent disk, specified in GB.
* * You can also specify this when creating a persistent disk
* @return sourceImage, fully qualified URL for the image to be copied. * using the sourceImage or sourceSnapshot parameter.
*/ */
public URI sourceImage(){ public Integer sizeGb() {
return sourceImage; return sizeGb;
} }
/** /**
@ -47,31 +49,48 @@ public final class DiskCreationOptions {
* *
* @return sourceSnapshot, fully qualified URL for the snapshot to be copied. * @return sourceSnapshot, fully qualified URL for the snapshot to be copied.
*/ */
public URI sourceSnapshot(){ public URI sourceSnapshot() {
return sourceSnapshot; return sourceSnapshot;
} }
/**
* The description
*
* @return description, An optional textual description of the resource.
*/
public String description() {
return description;
}
/** /**
* @see DiskCreationOptions#type() * @see DiskCreationOptions#type()
*/ */
public DiskCreationOptions type(URI type){ public DiskCreationOptions type(URI type) {
this.type = type; this.type = type;
return this; return this;
} }
/** /**
* @see DiskCreationOptions#sourceImage() * @see DiskCreationOptions#sizeGb()
*/ */
public DiskCreationOptions sourceImage(URI sourceImage){ public DiskCreationOptions sizeGb(Integer sizeGb) {
this.sourceImage = sourceImage; this.sizeGb = sizeGb;
return this; return this;
} }
/** /**
* @see DiskCreationOptions#sourceSnapshot() * @see DiskCreationOptions#sourceSnapshot()
*/ */
public DiskCreationOptions sourceSnapshot(URI sourceSnapshot){ public DiskCreationOptions sourceSnapshot(URI sourceSnapshot) {
this.sourceSnapshot = sourceSnapshot; this.sourceSnapshot = sourceSnapshot;
return this; return this;
} }
/**
* @see DiskCreationOptions#description()
*/
public DiskCreationOptions description(String description) {
this.description = description;
return this;
}
} }

View File

@ -32,6 +32,7 @@ public class FirewallOptions {
private String name; private String name;
private URI network; private URI network;
private String description;
private ImmutableList.Builder<String> sourceRanges = ImmutableList.builder(); private ImmutableList.Builder<String> sourceRanges = ImmutableList.builder();
private ImmutableList.Builder<String> sourceTags = ImmutableList.builder(); private ImmutableList.Builder<String> sourceTags = ImmutableList.builder();
private ImmutableList.Builder<String> targetTags = ImmutableList.builder(); private ImmutableList.Builder<String> targetTags = ImmutableList.builder();
@ -76,6 +77,21 @@ public class FirewallOptions {
return name; 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() * @see org.jclouds.googlecomputeengine.domain.Firewall#network()
*/ */

View File

@ -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);
}
}
}

View File

@ -31,22 +31,23 @@ import com.google.common.collect.ImmutableMap;
@Test(groups = "unit", testName = "DiskCreationBinderTest") @Test(groups = "unit", testName = "DiskCreationBinderTest")
public class DiskCreationBinderTest extends BaseGoogleComputeEngineExpectTest<Object>{ 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"; "debian-cloud/global/images/backports-debian-7-wheezy-v20141017";
DiskCreationBinder binder = new DiskCreationBinder(); DiskCreationBinder binder = new DiskCreationBinder();
@Test @Test
public void testMap() throws SecurityException, NoSuchMethodException { 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(); 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); request = binder.bindToRequest(request, postParams);
assertEquals(request.getPayload().getRawContent(), 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"); assertEquals(request.getPayload().getContentMetadata().getContentType(), "application/json");
} }
} }

View File

@ -21,6 +21,7 @@ import static org.testng.Assert.assertTrue;
import java.net.URI; import java.net.URI;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Firewall; import org.jclouds.googlecomputeengine.domain.Firewall;
import org.jclouds.net.domain.IpPermission; import org.jclouds.net.domain.IpPermission;
import org.jclouds.net.domain.IpProtocol; import org.jclouds.net.domain.IpProtocol;
@ -56,6 +57,7 @@ public class FirewallToIpPermissionTest {
return Firewall.create( // return Firewall.create( //
"abcd", // id "abcd", // id
URI.create(baseUrl + "/jclouds/global/firewalls/jclouds-test"), // selfLink URI.create(baseUrl + "/jclouds/global/firewalls/jclouds-test"), // selfLink
new SimpleDateFormatDateService().iso8601DateParse("2012-04-13T03:05:04.365"), // creationTimestamp
"jclouds-test", // name "jclouds-test", // name
null, // description null, // description
URI.create(baseUrl + "/jclouds/global/networks/jclouds-test"), // network URI.create(baseUrl + "/jclouds/global/networks/jclouds-test"), // network

View File

@ -23,11 +23,14 @@ import java.net.URI;
import org.jclouds.compute.domain.Image.Status; import org.jclouds.compute.domain.Image.Status;
import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.OsFamily;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Deprecated; import org.jclouds.googlecomputeengine.domain.Deprecated;
import org.jclouds.googlecomputeengine.domain.Deprecated.State; import org.jclouds.googlecomputeengine.domain.Deprecated.State;
import org.jclouds.googlecomputeengine.domain.Image; import org.jclouds.googlecomputeengine.domain.Image;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "GoogleComputeEngineImageToImageTest") @Test(groups = "unit", testName = "GoogleComputeEngineImageToImageTest")
public class GoogleComputeEngineImageToImageTest { public class GoogleComputeEngineImageToImageTest {
public void testArbitraryImageName() { public void testArbitraryImageName() {
@ -86,11 +89,18 @@ public class GoogleComputeEngineImageToImageTest {
return Image.create( // return Image.create( //
"1234", // id "1234", // id
URI.create("http://test.com/1234"), // selfLink URI.create("http://test.com/1234"), // selfLink
new SimpleDateFormatDateService().iso8601DateParse("2012-07-16T22:16:13.468"), // creationTimestamp
name, // name name, // name
"", // description "", // description
"RAW", // sourceType "RAW", // sourceType
Image.RawDisk.create(URI.create("foo"), "TAR", null), // rawDisk 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
); );
} }
} }

View File

@ -21,6 +21,7 @@ import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull; import static org.testng.AssertJUnit.assertNull;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
import org.jclouds.googlecomputeengine.options.AddressCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseAddressListTest; import org.jclouds.googlecomputeengine.parse.ParseAddressListTest;
import org.jclouds.googlecomputeengine.parse.ParseAddressTest; import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest; import org.jclouds.googlecomputeengine.parse.ParseRegionOperationTest;
@ -52,6 +53,18 @@ public class AddressApiMockTest extends BaseGoogleComputeEngineApiMockTest {
stringFromResource("/address_insert.json")); 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 { public void delete() throws Exception {
server.enqueue(jsonResponse("/region_operation.json")); server.enqueue(jsonResponse("/region_operation.json"));

View File

@ -34,7 +34,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
public static final String DISK_NAME = "disk-api-live-test-disk"; 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 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() { private DiskApi api() {
return api.disksInZone(DEFAULT_ZONE_NAME); return api.disksInZone(DEFAULT_ZONE_NAME);
@ -42,7 +42,8 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live") @Test(groups = "live")
public void testInsertDisk() { 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") @Test(groups = "live", dependsOnMethods = "testInsertDisk")
@ -70,15 +71,15 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private void assertDiskEquals(Disk result) { private void assertDiskEquals(Disk result) {
assertEquals(result.name(), DISK_NAME); assertEquals(result.name(), DISK_NAME);
assertEquals(result.sizeGb(), sizeGb); assertEquals(result.sizeGb(), SIZE_GB);
assertEquals(result.zone(), getDefaultZoneUrl()); assertEquals(result.zone(), getDefaultZoneUrl());
} }
@Test(groups = "live") @Test(groups = "live")
public void testInsertSSDDisk() { public void testInsertSSDDisk() {
URI diskType = getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd"); URI diskType = getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd");
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType); DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(diskType).sizeGb(SIZE_GB);
assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, sizeGb, diskCreationOptions)); assertOperationDoneSuccessfully(api().create(SSD_DISK_NAME, diskCreationOptions));
} }
@Test(groups = "live", dependsOnMethods = "testInsertSSDDisk") @Test(groups = "live", dependsOnMethods = "testInsertSSDDisk")
@ -95,7 +96,7 @@ public class DiskApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
private void assertSSDDiskEquals(Disk result) { private void assertSSDDiskEquals(Disk result) {
assertEquals(result.name(), SSD_DISK_NAME); assertEquals(result.name(), SSD_DISK_NAME);
assertEquals(result.sizeGb(), sizeGb); assertEquals(result.sizeGb(), SIZE_GB);
assertEquals(result.zone(), getDefaultZoneUrl()); assertEquals(result.zone(), getDefaultZoneUrl());
assertEquals(result.type(), getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd")); assertEquals(result.type(), getDiskTypeUrl(DEFAULT_ZONE_NAME, "pd-ssd"));
} }

View File

@ -52,7 +52,8 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
public void insert() throws Exception { public void insert() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json")); 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"))); new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks", assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
@ -62,20 +63,23 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
public void insertFromImage() throws Exception { public void insertFromImage() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json")); server.enqueue(jsonResponse("/zone_operation.json"));
DiskCreationOptions diskCreationOptions = new DiskCreationOptions() DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sizeGb(1).description("testing 123");
.sourceImage(URI.create(url(IMAGE_URL)));
assertEquals(diskApi().create("testimage1", 1, diskCreationOptions), assertEquals(diskApi().create("testimage1", url(IMAGE_URL), diskCreationOptions),
new ParseZoneOperationTest().expected(url("/projects"))); new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks", assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks?sourceImage="
stringFromResource("/disk_insert_sourceImage.json")); + 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 { public void insertFromSSD() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json")); server.enqueue(jsonResponse("/zone_operation.json"));
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().type(URI.create(url(SSD_URL))); DiskCreationOptions diskCreationOptions = new DiskCreationOptions()
assertEquals(diskApi().create("testimage1", 1, diskCreationOptions), .type(URI.create(url(SSD_URL))).sizeGb(1);
assertEquals(diskApi().create("testimage1", diskCreationOptions),
new ParseZoneOperationTest().expected(url("/projects"))); new ParseZoneOperationTest().expected(url("/projects")));
assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks", assertSent(server, "POST", "/projects/party/zones/us-central1-a/disks",
@ -92,6 +96,16 @@ public class DiskApiMockTest extends BaseGoogleComputeEngineApiMockTest {
stringFromResource("/disk_create_snapshot.json")); 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 { public void delete() throws Exception {
server.enqueue(jsonResponse("/zone_operation.json")); server.enqueue(jsonResponse("/zone_operation.json"));

View File

@ -83,6 +83,7 @@ public class FirewallApiExpectTest extends BaseGoogleComputeEngineExpectTest<Goo
return payload; return payload;
} }
//TODO (broudy): convert to mock test and add description to test.
public void testInsertFirewallResponseIs2xx() throws IOException { public void testInsertFirewallResponseIs2xx() throws IOException {
HttpRequest request = HttpRequest HttpRequest request = HttpRequest

View File

@ -31,6 +31,7 @@ import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.Deprecated.State; import org.jclouds.googlecomputeengine.domain.Deprecated.State;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
import org.jclouds.googlecomputeengine.options.DeprecateOptions; import org.jclouds.googlecomputeengine.options.DeprecateOptions;
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
import org.testng.annotations.Test; import org.testng.annotations.Test;
public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@ -68,7 +69,8 @@ public class ImageApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live") @Test(groups = "live")
public void testInsertDisk() { public void testInsertDisk() {
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, sizeGb)); assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
new DiskCreationOptions().sizeGb(sizeGb)));
Disk disk = diskApi().get(DISK_NAME); Disk disk = diskApi().get(DISK_NAME);
diskURI = disk.selfLink(); diskURI = disk.selfLink();
} }

View File

@ -23,9 +23,11 @@ import static org.testng.Assert.assertNull;
import java.net.URI; import java.net.URI;
import org.jclouds.date.internal.SimpleDateFormatDateService; import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Deprecated;
import org.jclouds.googlecomputeengine.domain.Deprecated.State; import org.jclouds.googlecomputeengine.domain.Deprecated.State;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiMockTest;
import org.jclouds.googlecomputeengine.options.DeprecateOptions; import org.jclouds.googlecomputeengine.options.DeprecateOptions;
import org.jclouds.googlecomputeengine.options.ImageCreationOptions;
import org.jclouds.googlecomputeengine.parse.ParseImageListTest; import org.jclouds.googlecomputeengine.parse.ParseImageListTest;
import org.jclouds.googlecomputeengine.parse.ParseImageTest; import org.jclouds.googlecomputeengine.parse.ParseImageTest;
import org.jclouds.googlecomputeengine.parse.ParseOperationTest; import org.jclouds.googlecomputeengine.parse.ParseOperationTest;
@ -106,7 +108,7 @@ public class ImageApiMockTest extends BaseGoogleComputeEngineApiMockTest {
assertSent(server, "GET", "/projects/centos-cloud/global/images"); 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")); server.enqueue(jsonResponse("/operation.json"));
assertEquals(imageApi().createFromDisk("my-image", url("/projects/party/zones/us-central1-a/disks/mydisk")), 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")); 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{ public void deprecateImage_2xx() throws Exception{
String imageName = "test-image"; String imageName = "test-image";
server.enqueue(jsonResponse("/operation.json")); server.enqueue(jsonResponse("/operation.json"));

View File

@ -38,6 +38,7 @@ import org.jclouds.googlecomputeengine.domain.NewInstance;
import org.jclouds.googlecomputeengine.domain.AttachDisk; import org.jclouds.googlecomputeengine.domain.AttachDisk;
import org.jclouds.googlecomputeengine.domain.Operation; import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -108,7 +109,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
assertOperationDoneSuccessfully(api.networks().createInIPv4Range assertOperationDoneSuccessfully(api.networks().createInIPv4Range
(INSTANCE_NETWORK_NAME, IPV4_RANGE)); (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)); assertOperationDoneSuccessfully(api().create(instance));
} }
@ -189,7 +191,8 @@ public class InstanceApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance") @Test(groups = "live", dependsOnMethods = "testSetMetadataForInstance")
public void testAttachDiskToInstance() { 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); Instance originalInstance = api().get(INSTANCE_NAME);
assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME, assertOperationDoneSuccessfully(api().attachDisk(INSTANCE_NAME,

View File

@ -26,6 +26,7 @@ import org.jclouds.googlecloud.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Disk; import org.jclouds.googlecomputeengine.domain.Disk;
import org.jclouds.googlecomputeengine.domain.Snapshot; import org.jclouds.googlecomputeengine.domain.Snapshot;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineApiLiveTest;
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
import org.testng.annotations.Test; import org.testng.annotations.Test;
public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest { public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@ -44,7 +45,8 @@ public class SnapshotApiLiveTest extends BaseGoogleComputeEngineApiLiveTest {
@Test(groups = "live") @Test(groups = "live")
public void testCreateSnapshot() { public void testCreateSnapshot() {
assertOperationDoneSuccessfully(diskApi().create(DISK_NAME, 1)); assertOperationDoneSuccessfully(diskApi().create(DISK_NAME,
new DiskCreationOptions().sizeGb(1)));
disk = diskApi().get(DISK_NAME); disk = diskApi().get(DISK_NAME);
assertOperationDoneSuccessfully(diskApi().createSnapshot(DISK_NAME, SNAPSHOT_NAME)); assertOperationDoneSuccessfully(diskApi().createSnapshot(DISK_NAME, SNAPSHOT_NAME));

View File

@ -89,7 +89,7 @@ public class BaseGoogleComputeEngineApiLiveTest extends BaseApiLiveTest<GoogleCo
AtomicReference<Operation> ref = Atomics.newReference(checkNotNull(operation, "operation")); AtomicReference<Operation> ref = Atomics.newReference(checkNotNull(operation, "operation"));
checkState(operationDone.apply(ref), "Timeout waiting for operation: %s", operation); checkState(operationDone.apply(ref), "Timeout waiting for operation: %s", operation);
assertEquals(ref.get().status(), Operation.Status.DONE); assertEquals(ref.get().status(), Operation.Status.DONE);
assertTrue(ref.get().errors().isEmpty()); assertTrue(ref.get().error().errors().isEmpty());
} }
protected void waitOperationDone(@Nullable Operation operation) { protected void waitOperationDone(@Nullable Operation operation) {

View File

@ -25,6 +25,7 @@ import javax.ws.rs.Consumes;
import org.jclouds.googlecloud.domain.ForwardingListPage; import org.jclouds.googlecloud.domain.ForwardingListPage;
import org.jclouds.googlecloud.domain.ListPage; import org.jclouds.googlecloud.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Address; import org.jclouds.googlecomputeengine.domain.Address;
import org.jclouds.googlecomputeengine.domain.Address.Status;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -50,9 +51,10 @@ public class ParseAddressListTest extends BaseGoogleComputeEngineParseTest<ListP
"4881363978908129158", // id "4881363978908129158", // id
URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip2"), // selfLink URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip2"), // selfLink
"test-ip2", // name "test-ip2", // name
parse("2013-07-26T14:08:21.552-07:00"), //creationTimestamp
"", // description "", // description
"RESERVED", // status Status.RESERVED, // status
null, // user null, // users
URI.create(baseUrl + "/party/regions/us-central1"), // region URI.create(baseUrl + "/party/regions/us-central1"), // region
"173.255.118.115" // address "173.255.118.115" // address
); );

View File

@ -23,9 +23,12 @@ import java.net.URI;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.domain.Address; import org.jclouds.googlecomputeengine.domain.Address;
import org.jclouds.googlecomputeengine.domain.Address.Status;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "ParseAddressTest") @Test(groups = "unit", testName = "ParseAddressTest")
public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> { public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address> {
@ -45,9 +48,10 @@ public class ParseAddressTest extends BaseGoogleComputeEngineParseTest<Address>
"4439373783165447583", // id "4439373783165447583", // id
URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip1"), // selfLink URI.create(baseUrl + "/party/regions/us-central1/addresses/test-ip1"), // selfLink
"test-ip1", // name "test-ip1", // name
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
"", // description "", // description
"RESERVED", // status Status.IN_USE, // status
null, // user ImmutableList.of(URI.create(baseUrl + "/party/regions/us-central1-a/forwardingRules/test-forwarding-rule")), // users
URI.create(baseUrl + "/party/regions/us-central1"), // region URI.create(baseUrl + "/party/regions/us-central1"), // region
"173.255.115.190" // address "173.255.115.190" // address
); );

View File

@ -60,7 +60,8 @@ public class ParseBackendServiceListTest extends BaseGoogleComputeEngineParseTes
45, //timeoutSec, 45, //timeoutSec,
80, //port, 80, //port,
"HTTP", //protocol, "HTTP", //protocol,
null) //fingerprint null, //fingerprint
null) // portName
), ),
null null
); );

View File

@ -67,7 +67,8 @@ public class ParseBackendServiceTest extends BaseGoogleComputeEngineParseTest<Ba
30, //timeoutSec 30, //timeoutSec
80, //port 80, //port
"HTTP", //protocol "HTTP", //protocol
"I6n5NPSXn8g=" //fingerprint "I6n5NPSXn8g=", //fingerprint
null // portName
); );
} }
} }

View File

@ -23,6 +23,7 @@ import java.net.URI;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.domain.Disk; import org.jclouds.googlecomputeengine.domain.Disk;
import org.jclouds.googlecomputeengine.domain.Disk.Status;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -43,13 +44,19 @@ public class ParseDiskTest extends BaseGoogleComputeEngineParseTest<Disk> {
public Disk expected(String baseUrl){ public Disk expected(String baseUrl){
return Disk.create( // return Disk.create( //
"13050421646334304115", // id "13050421646334304115", // id
parse("2012-11-25T01:38:48.306"), // creationTimestamp
URI.create(baseUrl + "/party/zones/us-central1-a"), // zone URI.create(baseUrl + "/party/zones/us-central1-a"), // zone
"READY", // status Status.READY, // status
"testimage1", // name "testimage1", // name
null, // description null, // description
1, // sizeGb 1, // sizeGb
null, // sourceSnapshot
null, // sourceSnapshotId
URI.create(baseUrl + "/party/zones/us-central1-a/disks/testimage1"), // selfLink 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
); );
} }
} }

View File

@ -41,7 +41,8 @@ public class ParseDiskTypeListTest extends BaseGoogleComputeEngineParseTest<List
@Override @Consumes(APPLICATION_JSON) @Override @Consumes(APPLICATION_JSON)
public ListPage<DiskType> expected() { public ListPage<DiskType> expected() {
String contentBaseUrl = BASE_URL.replace("www", "content"); 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 "pd-standard", // name
"Standard Persistent Disk", // description "Standard Persistent Disk", // description
"10GB-10TB", // validDiskSize "10GB-10TB", // validDiskSize

View File

@ -37,7 +37,8 @@ public class ParseDiskTypeTest extends BaseGoogleComputeEngineParseTest<DiskType
@Override @Consumes(APPLICATION_JSON) @Override @Consumes(APPLICATION_JSON)
public DiskType expected() { public DiskType expected() {
String contentBaseUrl = BASE_URL.replace("www", "content"); 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 "pd-ssd", // name
"SSD Persistent Disk", // description "SSD Persistent Disk", // description
"10GB-1TB", // validDiskSize "10GB-1TB", // validDiskSize

View File

@ -49,6 +49,7 @@ public class ParseFirewallListTest extends BaseGoogleComputeEngineParseTest<List
Firewall firewall2 = Firewall.create( // Firewall firewall2 = Firewall.create( //
"12862241067393040785", // id "12862241067393040785", // id
URI.create(baseUrl + "/google/global/firewalls/default-ssh"), // selfLink URI.create(baseUrl + "/google/global/firewalls/default-ssh"), // selfLink
parse("2012-04-13T03:05:04.365"), // creationTimestamp
"default-ssh", // name "default-ssh", // name
"SSH allowed from anywhere", // description "SSH allowed from anywhere", // description
URI.create(baseUrl + "/google/global/networks/default"), // network URI.create(baseUrl + "/google/global/networks/default"), // network

View File

@ -47,6 +47,7 @@ public class ParseFirewallTest extends BaseGoogleComputeEngineParseTest<Firewall
return Firewall.create( // return Firewall.create( //
"12862241031274216284", // id "12862241031274216284", // id
URI.create(base_url + "/party/global/firewalls/jclouds-test"), // selfLink URI.create(base_url + "/party/global/firewalls/jclouds-test"), // selfLink
parse("2012-04-13T03:05:02.855"), // creationTimestamp
"jclouds-test", // name "jclouds-test", // name
"Internal traffic from default allowed", // description "Internal traffic from default allowed", // description
URI.create(base_url + "/party/global/networks/jclouds-test"), // network URI.create(base_url + "/party/global/networks/jclouds-test"), // network

View File

@ -43,6 +43,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
public Operation expected(String baseUrl) { public Operation expected(String baseUrl) {
return Operation.create( // return Operation.create( //
"13053095055850848306", // id "13053095055850848306", // id
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
URI.create(baseUrl + "/party/global/operations/operation-1354084865060"), URI.create(baseUrl + "/party/global/operations/operation-1354084865060"),
"operation-1354084865060", // name "operation-1354084865060", // name
null, // description null, // description
@ -60,6 +61,7 @@ public class ParseGlobalOperationTest extends BaseGoogleComputeEngineParseTest<O
null, // httpErrorMessage null, // httpErrorMessage
"insert", // operationType "insert", // operationType
null, // errors null, // errors
null, // warnings
null, // region null, // region
null // zone null // zone
); );

View File

@ -26,9 +26,12 @@ import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.domain.Deprecated; import org.jclouds.googlecomputeengine.domain.Deprecated;
import org.jclouds.googlecomputeengine.domain.Deprecated.State; import org.jclouds.googlecomputeengine.domain.Deprecated.State;
import org.jclouds.googlecomputeengine.domain.Image; import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.Image.Status;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "ParseImageTest") @Test(groups = "unit", testName = "ParseImageTest")
public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> { public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
@ -47,6 +50,7 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
return Image.create( // return Image.create( //
"12941197498378735318", // id "12941197498378735318", // id
URI.create(baseUrl + "/centos-cloud/global/images/centos-6-2-v20120326"), // selfLink 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 "centos-6-2-v20120326", // name
"DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", // description "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", // description
"RAW", // sourceType "RAW", // sourceType
@ -57,6 +61,14 @@ public class ParseImageTest extends BaseGoogleComputeEngineParseTest<Image> {
null, // deprecated null, // deprecated
null, // obsolete null, // obsolete
null // deleted 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
);
} }
} }

View File

@ -23,9 +23,12 @@ import java.net.URI;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import org.jclouds.googlecomputeengine.domain.Operation; import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Operation.Warning;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest; import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineParseTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList;
@Test(groups = "unit", testName = "ParseOperationTest") @Test(groups = "unit", testName = "ParseOperationTest")
public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operation> { public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operation> {
@ -43,6 +46,7 @@ public class ParseOperationTest extends BaseGoogleComputeEngineParseTest<Operati
public Operation expected(String baseUrl) { public Operation expected(String baseUrl) {
return Operation.create( // return Operation.create( //
"13053095055850848306", // id "13053095055850848306", // id
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"), URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
"operation-1354084865060", // name "operation-1354084865060", // name
null, // description 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.060"), // insertTime
parse("2012-11-28T06:41:05.142"), // startTime parse("2012-11-28T06:41:05.142"), // startTime
parse("2012-11-28T06:41:06.142"), // endTime parse("2012-11-28T06:41:06.142"), // endTime
null, // httpErrorStatusCode 400, // httpErrorStatusCode
null, // httpErrorMessage "BAD REQUEST", // httpErrorMessage
"insert", // operationType "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/regions/us-central1"), // region
URI.create(baseUrl + "/party/zones/us-central1-a") // zone URI.create(baseUrl + "/party/zones/us-central1-a") // zone
); );

View File

@ -43,6 +43,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
public Operation expected(String baseUrl) { public Operation expected(String baseUrl) {
return Operation.create( // return Operation.create( //
"13053095055850848306", // id "13053095055850848306", // id
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
URI.create(baseUrl + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink URI.create(baseUrl + "/party/regions/us-central1/operations/operation-1354084865060"), // selfLink
"operation-1354084865060", // name "operation-1354084865060", // name
null, // description null, // description
@ -60,6 +61,7 @@ public class ParseRegionOperationTest extends BaseGoogleComputeEngineParseTest<O
null, // httpErrorMessage null, // httpErrorMessage
"insert", // operationType "insert", // operationType
null, // errors null, // errors
null, // warnings
URI.create(baseUrl + "/party/regions/us-central1"), // region URI.create(baseUrl + "/party/regions/us-central1"), // region
null // zone null // zone
); );

View File

@ -43,6 +43,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
public Operation expected(String baseUrl) { public Operation expected(String baseUrl) {
return Operation.create( // return Operation.create( //
"13053095055850848306", // id "13053095055850848306", // id
parse("2013-07-26T13:57:20.204-07:00"), // creationTimestamp
URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"), URI.create(baseUrl + "/party/zones/us-central1-a/operations/operation-1354084865060"),
"operation-1354084865060", // name "operation-1354084865060", // name
null, // description null, // description
@ -60,6 +61,7 @@ public class ParseZoneOperationTest extends BaseGoogleComputeEngineParseTest<Ope
null, // httpErrorMessage null, // httpErrorMessage
"insert", // operationType "insert", // operationType
null, // errors null, // errors
null, // warnings
null, // region null, // region
URI.create(baseUrl + "/party/zones/us-central1-a") // zone URI.create(baseUrl + "/party/zones/us-central1-a") // zone
); );

View File

@ -27,6 +27,7 @@ import static org.testng.Assert.assertTrue;
import java.net.URI; import java.net.URI;
import org.jclouds.date.internal.SimpleDateFormatDateService;
import org.jclouds.googlecomputeengine.domain.Firewall; import org.jclouds.googlecomputeengine.domain.Firewall;
import org.jclouds.net.domain.IpPermission; import org.jclouds.net.domain.IpPermission;
import org.jclouds.net.domain.IpProtocol; import org.jclouds.net.domain.IpProtocol;
@ -42,6 +43,7 @@ public class NetworkFirewallPredicatesTest {
return Firewall.create( // return Firewall.create( //
"abcd", // id "abcd", // id
URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink 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 "jclouds-test", // name
null, // description null, // description
URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network
@ -58,6 +60,7 @@ public class NetworkFirewallPredicatesTest {
return Firewall.create( // return Firewall.create( //
"abcd", // id "abcd", // id
URI.create(BASE_URL + "/party/global/firewalls/jclouds-test"), // selfLink 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 "jclouds-test", // name
null, // description null, // description
URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network URI.create(BASE_URL + "/party/global/networks/jclouds-test"), // network

View File

@ -1,11 +1,14 @@
{ {
"kind": "compute#address", "kind": "compute#address",
"id": "4439373783165447583", "id": "4439373783165447583",
"creationTimestamp": "2013-07-26T13:57:20.204-07:00", "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"status": "RESERVED", "status": "IN_USE",
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1", "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
"name": "test-ip1", "name": "test-ip1",
"description": "", "description": "",
"address": "173.255.115.190", "address": "173.255.115.190",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1" "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"
]
} }

View File

@ -1,31 +1,32 @@
{ {
"kind": "compute#addressList", "kind": "compute#addressList",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses",
"id": "projects/party/regions/us-central1/addresses", "id": "projects/party/regions/us-central1/addresses",
"items": [ "items": [
{ {
"kind": "compute#address",
"kind": "compute#address", "id": "4439373783165447583",
"id": "4439373783165447583", "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"creationTimestamp": "2013-07-26T13:57:20.204-07:00", "status": "IN_USE",
"status": "RESERVED", "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1", "name": "test-ip1",
"name": "test-ip1", "description": "",
"description": "", "address": "173.255.115.190",
"address": "173.255.115.190", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip1",
"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", "kind": "compute#address",
"creationTimestamp": "2013-07-26T14:08:21.552-07:00", "id": "4881363978908129158",
"status": "RESERVED", "creationTimestamp": "2013-07-26T14:08:21.552-07:00",
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1", "status": "RESERVED",
"name": "test-ip2", "region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1",
"description": "", "name": "test-ip2",
"address": "173.255.118.115", "description": "",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2" "address": "173.255.118.115",
} "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-ip2"
] }
]
} }

View File

@ -80,6 +80,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "id": "13053095055850848306",
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

View File

@ -1 +0,0 @@
{"name":"testimage1","sizeGb":1,"sourceImage":"https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/images/foo"}

View File

@ -1,6 +1,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "id": "13053095055850848306",
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

View File

@ -6,6 +6,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "id": "13053095055850848306",
"creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/global/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/global/firewalls/jclouds-test-delete",

View File

@ -1,17 +1,25 @@
{ {
"kind": "compute#image", "kind": "compute#image",
"id": "12941197498378735318", "id": "12941197498378735318",
"creationTimestamp": "2012-07-16T22:16:13.468", "creationTimestamp": "2012-07-16T22:16:13.468",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326", "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
"name": "centos-6-2-v20120326", "name": "centos-6-2-v20120326",
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
"sourceType": "RAW", "sourceType": "RAW",
"deprecated": { "deprecated": {
"state": "DEPRECATED", "state": "DEPRECATED",
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104" "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
}, },
"rawDisk": { "rawDisk": {
"source": "", "source": "",
"containerType": "TAR" "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"
]
}

View File

@ -1,24 +1,32 @@
{ {
"kind": "compute#imageList", "kind": "compute#imageList",
"id": "projects/centos-cloud/global/images", "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images", "id": "projects/centos-cloud/global/images",
"items": [ "items": [
{ {
"kind": "compute#image", "kind": "compute#image",
"id": "12941197498378735318", "id": "12941197498378735318",
"creationTimestamp": "2012-07-16T22:16:13.468", "creationTimestamp": "2012-07-16T22:16:13.468",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326", "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-2-v20120326",
"name": "centos-6-2-v20120326", "name": "centos-6-2-v20120326",
"description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000", "description": "DEPRECATED. CentOS 6.2 image; Created Mon, 26 Mar 2012 21:19:09 +0000",
"sourceType": "RAW", "sourceType": "RAW",
"deprecated": { "deprecated": {
"state": "DEPRECATED", "state": "DEPRECATED",
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104" "replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20130104"
}, },
"rawDisk": { "rawDisk": {
"source": "", "source": "",
"containerType": "TAR" "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"
]
}
]
}

View File

@ -1,50 +1,71 @@
{ {
"kind": "compute#imageList", "kind": "compute#imageList",
"id": "projects/centos-cloud/global/images", "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images", "id": "projects/centos-cloud/global/images",
"items": [ "items": [
{ {
"kind": "compute#image",
"id": "13037722963789596520", "kind": "compute#image",
"creationTimestamp": "2012-11-09T11:43:28.749-08:00", "selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20131120",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20121106", "id": "11748647391859510935",
"name": "gcel-10-04-v20121106", "creationTimestamp": "2013-11-25T15:13:50.611-08:00",
"description": "SCSI-enabled GCEL 10.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000", "name": "centos-6-v20131120",
"sourceType": "RAW", "description": "SCSI-enabled CentOS 6 built on 2013-11-20",
"rawDisk": { "sourceType": "RAW",
"source": "", "rawDisk": {
"containerType": "TAR" "source": "",
} "containerType": "TAR"
}, },
{ "deprecated": {
"kind": "compute#image", "state": "DEPRECATED",
"id": "13037721421359523565", "replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140318"
"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", "status": "READY",
"name": "debian-7-wheezy-v20140718", "archiveSizeBytes": "269993565",
"description": "SCSI-enabled GCEL 12.04 LTS; Created Tue, 06 Nov 2012 00:00:00 +0000", "diskSizeGb": "10"
"sourceType": "RAW", },
"rawDisk": { {
"source": "",
"containerType": "TAR" "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",
"kind": "compute#image", "name": "centos-6-v20140318",
"id": "12941198995845323366", "description": "CentOS 6.5 x86_64 built on 2014-03-18",
"creationTimestamp": "2012-07-16T15:18:50.405-07:00", "sourceType": "RAW",
"selfLink": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/ubuntu-10-04-v20110728", "rawDisk": {
"name": "ubuntu-10-04-v20110728", "source": "",
"description": "DEPRECATED. GCEL 10.04 LTS; Created Thu, 28 Jul 2011 16:45:51 +0000", "containerType": "TAR"
"sourceType": "RAW", },
"deprecated": { "deprecated": {
"state": "DELETED", "state": "DEPRECATED",
"replacement": "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/gcel-10-04-v20130104" "replacement": "https://content.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-6-v20140408"
}, },
"rawDisk": { "status": "READY",
"source": "", "archiveSizeBytes": "341230444",
"containerType": "TAR" "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=="
}

View File

@ -1,17 +1,40 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "id": "13053095055850848306",
"selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060", "creationTimestamp": "2013-07-26T13:57:20.204-07:00",
"name": "operation-1354084865060", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1", "name": "operation-1354084865060",
"targetId": "13053094017547040099", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",
"status": "DONE", "targetId": "13053094017547040099",
"user": "user@developer.gserviceaccount.com", "status": "DONE",
"progress": 100, "user": "user@developer.gserviceaccount.com",
"insertTime": "2012-11-28T06:41:05.060", "progress": 100,
"startTime": "2012-11-28T06:41:05.142", "insertTime": "2012-11-28T06:41:05.060",
"endTime": "2012-11-28T06:41:06.142", "startTime": "2012-11-28T06:41:05.142",
"operationType": "insert", "endTime": "2012-11-28T06:41:06.142",
"region": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1", "operationType": "insert",
"zone": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a" "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"
} }

View File

@ -1,6 +1,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "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", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",

View File

@ -6,6 +6,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "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", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/regions/us-central1/addresses/test-address",

View File

@ -1,6 +1,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "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", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",

View File

@ -6,6 +6,7 @@
{ {
"kind": "compute#operation", "kind": "compute#operation",
"id": "13053095055850848306", "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", "selfLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/operations/operation-1354084865060",
"name": "operation-1354084865060", "name": "operation-1354084865060",
"targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1", "targetLink": "https://www.googleapis.com/compute/v1/projects/party/zones/us-central1-a/instances/test-1",