You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2014/10/31 02:57:31 UTC
[6/6] git commit: initial commit to support GCE LB
initial commit to support GCE LB
add support targetPools, forwardingRules and httpHealthChecks API
add expectedTests and LiveTests for the above API
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/ed9fc5c5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/ed9fc5c5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/ed9fc5c5
Branch: refs/heads/master
Commit: ed9fc5c593d5fe0b80d3b85b5b2e4f0ff6bdf724
Parents: b8670b1
Author: Andrea Turli <an...@gmail.com>
Authored: Mon Jan 6 23:18:44 2014 +0100
Committer: Adrian Cole <ac...@twitter.com>
Committed: Thu Oct 30 18:54:43 2014 -0700
----------------------------------------------------------------------
.../GoogleComputeEngineApi.java | 70 +++--
.../compute/GoogleComputeEngineService.java | 6 +-
.../GoogleComputeEngineServiceAdapter.java | 37 +--
...GoogleComputeEngineServiceContextModule.java | 4 +-
...ogleComputeEngineSecurityGroupExtension.java | 34 +--
.../functions/NetworkToSecurityGroup.java | 2 +-
.../compute/loaders/FindNetworkOrCreate.java | 2 +-
...desWithGroupEncodedIntoNameThenAddToSet.java | 7 +-
...eNodeCredentialsButOverrideFromTemplate.java | 2 +-
.../config/GoogleComputeEngineParserModule.java | 47 ++--
.../domain/AbstractDisk.java | 2 -
.../googlecomputeengine/domain/Address.java | 11 +-
.../googlecomputeengine/domain/Disk.java | 2 -
.../googlecomputeengine/domain/Firewall.java | 3 -
.../domain/ForwardingRule.java | 198 ++++++++++++++
.../domain/HttpHealthCheck.java | 235 ++++++++++++++++
.../googlecomputeengine/domain/Image.java | 2 -
.../googlecomputeengine/domain/Instance.java | 2 -
.../googlecomputeengine/domain/MachineType.java | 2 -
.../googlecomputeengine/domain/Network.java | 2 -
.../googlecomputeengine/domain/Operation.java | 2 -
.../googlecomputeengine/domain/Project.java | 2 -
.../googlecomputeengine/domain/Quota.java | 2 -
.../googlecomputeengine/domain/Region.java | 2 -
.../googlecomputeengine/domain/Resource.java | 25 +-
.../googlecomputeengine/domain/Route.java | 2 -
.../googlecomputeengine/domain/Snapshot.java | 6 +-
.../googlecomputeengine/domain/TargetPool.java | 237 ++++++++++++++++
.../googlecomputeengine/domain/Zone.java | 2 -
.../features/AddressApi.java | 2 -
.../googlecomputeengine/features/DiskApi.java | 2 -
.../features/FirewallApi.java | 3 -
.../features/ForwardingRuleApi.java | 197 ++++++++++++++
.../features/GlobalOperationApi.java | 2 -
.../features/HttpHealthCheckApi.java | 160 +++++++++++
.../googlecomputeengine/features/ImageApi.java | 3 -
.../features/InstanceApi.java | 2 -
.../features/MachineTypeApi.java | 2 -
.../features/NetworkApi.java | 2 -
.../features/ProjectApi.java | 2 -
.../googlecomputeengine/features/RegionApi.java | 2 -
.../features/RegionOperationApi.java | 4 +-
.../googlecomputeengine/features/RouteApi.java | 2 -
.../features/SnapshotApi.java | 2 -
.../features/TargetPoolApi.java | 272 +++++++++++++++++++
.../googlecomputeengine/features/ZoneApi.java | 2 -
.../features/ZoneOperationApi.java | 2 -
.../functions/CreateNetworkIfNeeded.java | 12 +-
.../functions/internal/ParseAddresses.java | 2 +-
.../functions/internal/ParseDisks.java | 2 +-
.../functions/internal/ParseFirewalls.java | 2 +-
.../internal/ParseForwardingRules.java | 65 +++++
.../internal/ParseGlobalOperations.java | 2 +-
.../internal/ParseHttpHealthChecks.java | 64 +++++
.../functions/internal/ParseImages.java | 2 +-
.../functions/internal/ParseInstances.java | 2 +-
.../functions/internal/ParseMachineTypes.java | 2 +-
.../functions/internal/ParseNetworks.java | 2 +-
.../internal/ParseRegionOperations.java | 2 +-
.../functions/internal/ParseRegions.java | 2 +-
.../functions/internal/ParseRoutes.java | 2 +-
.../functions/internal/ParseSnapshots.java | 2 +-
.../functions/internal/ParseTargetPools.java | 66 +++++
.../functions/internal/ParseZoneOperations.java | 2 +-
.../functions/internal/ParseZones.java | 2 +-
.../options/FirewallOptions.java | 2 +-
.../options/ListOptions.java | 17 +-
.../options/RouteOptions.java | 2 +-
.../GlobalOperationDonePredicate.java | 2 +-
.../RegionOperationDonePredicate.java | 2 +-
.../predicates/ZoneOperationDonePredicate.java | 2 +-
.../PageSystemExpectTest.java | 4 +-
.../GoogleComputeEngineServiceLiveTest.java | 2 +-
.../functions/NetworkToSecurityGroupTest.java | 2 +-
.../loaders/FindNetworkOrCreateTest.java | 10 +-
.../features/AddressApiExpectTest.java | 14 +-
.../features/AddressApiLiveTest.java | 2 +-
.../features/DiskApiExpectTest.java | 22 +-
.../features/DiskApiLiveTest.java | 2 +-
.../features/FirewallApiExpectTest.java | 18 +-
.../features/FirewallApiLiveTest.java | 8 +-
.../features/ForwardingRuleApiExpectTest.java | 167 ++++++++++++
.../features/ForwardingRuleApiLiveTest.java | 85 ++++++
.../features/GlobalOperationApiExpectTest.java | 14 +-
.../features/GlobalOperationApiLiveTest.java | 4 +-
.../features/HttpHealthCheckApiExpectTest.java | 177 ++++++++++++
.../features/HttpHealthCheckApiLiveTest.java | 60 ++++
.../features/ImageApiExpectTest.java | 16 +-
.../features/ImageApiLiveTest.java | 6 +-
.../features/InstanceApiExpectTest.java | 38 +--
.../features/InstanceApiLiveTest.java | 24 +-
.../features/MachineTypeApiExpectTest.java | 8 +-
.../features/MachineTypeApiLiveTest.java | 2 +-
.../features/NetworkApiExpectTest.java | 14 +-
.../features/NetworkApiLiveTest.java | 2 +-
.../features/RegionApiExpectTest.java | 8 +-
.../features/RegionApiLiveTest.java | 2 +-
.../features/RegionOperationApiExpectTest.java | 14 +-
.../features/RegionOperationApiLiveTest.java | 6 +-
.../features/RouteApiExpectTest.java | 14 +-
.../features/RouteApiLiveTest.java | 6 +-
.../features/SnapshotApiExpectTest.java | 8 +-
.../features/SnapshotApiLiveTest.java | 4 +-
.../features/TargetPoolApiExpectTest.java | 198 ++++++++++++++
.../features/TargetPoolApiLiveTest.java | 61 +++++
.../features/ZoneApiExpectTest.java | 8 +-
.../features/ZoneApiLiveTest.java | 2 +-
.../features/ZoneOperationApiExpectTest.java | 14 +-
.../features/ZoneOperationApiLiveTest.java | 6 +-
.../functions/CreateNetworkIfNeededTest.java | 16 +-
.../BaseGoogleComputeEngineApiLiveTest.java | 9 +-
.../parse/ParseForwardingRuleListTest.java | 59 ++++
.../parse/ParseForwardingRuleTest.java | 51 ++++
.../parse/ParseHttpHealthCheckListTest.java | 82 ++++++
.../parse/ParseHttpHealthCheckTest.java | 53 ++++
.../parse/ParseRegionOperationTest.java | 55 ++++
.../parse/ParseTargetPoolListTest.java | 54 ++++
.../parse/ParseTargetPoolTest.java | 48 ++++
.../src/test/resources/forwardingrule_get.json | 12 +
.../test/resources/forwardingrule_insert.json | 4 +
.../src/test/resources/forwardingrule_list.json | 19 ++
.../src/test/resources/httphealthcheck_get.json | 7 +
.../test/resources/httphealthcheck_insert.json | 1 +
.../test/resources/httphealthcheck_list.json | 32 +++
.../test/resources/targetpool_addinstance.json | 1 +
.../src/test/resources/targetpool_get.json | 9 +
.../src/test/resources/targetpool_insert.json | 3 +
.../src/test/resources/targetpool_list.json | 17 ++
128 files changed, 3101 insertions(+), 358 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
index ab184a7..bbf2bda 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/GoogleComputeEngineApi.java
@@ -16,16 +16,14 @@
*/
package org.jclouds.googlecomputeengine;
-import java.io.Closeable;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-
+import com.google.common.annotations.Beta;
import org.jclouds.googlecomputeengine.features.AddressApi;
import org.jclouds.googlecomputeengine.features.DiskApi;
import org.jclouds.googlecomputeengine.features.DiskTypeApi;
import org.jclouds.googlecomputeengine.features.FirewallApi;
+import org.jclouds.googlecomputeengine.features.ForwardingRuleApi;
import org.jclouds.googlecomputeengine.features.GlobalOperationApi;
+import org.jclouds.googlecomputeengine.features.HttpHealthCheckApi;
import org.jclouds.googlecomputeengine.features.ImageApi;
import org.jclouds.googlecomputeengine.features.InstanceApi;
import org.jclouds.googlecomputeengine.features.MachineTypeApi;
@@ -35,11 +33,14 @@ import org.jclouds.googlecomputeengine.features.RegionApi;
import org.jclouds.googlecomputeengine.features.RegionOperationApi;
import org.jclouds.googlecomputeengine.features.RouteApi;
import org.jclouds.googlecomputeengine.features.SnapshotApi;
+import org.jclouds.googlecomputeengine.features.TargetPoolApi;
import org.jclouds.googlecomputeengine.features.ZoneApi;
import org.jclouds.googlecomputeengine.features.ZoneOperationApi;
import org.jclouds.rest.annotations.Delegate;
-import com.google.common.annotations.Beta;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import java.io.Closeable;
/**
@@ -58,7 +59,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- AddressApi getAddressApiForProject(@PathParam("project") String projectName);
+ AddressApi getAddressApi(@PathParam("project") String projectName);
/**
* Provides access to Disk features
@@ -67,7 +68,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- DiskApi getDiskApiForProject(@PathParam("project") String projectName);
+ DiskApi getDiskApi(@PathParam("project") String projectName);
/**
* Provides access to DiskType features
@@ -85,7 +86,17 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- FirewallApi getFirewallApiForProject(@PathParam("project") String projectName);
+ FirewallApi getFirewallApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to ForwardingRule features
+ *
+ * @param projectName the name of the project
+ * @param region the name of the region scoping this request.
+ */
+ @Delegate
+ @Path("/projects/{project}/regions/{region}")
+ ForwardingRuleApi getForwardingRuleApi(@PathParam("project") String projectName, @PathParam("region") String region);
/**
* Provides access to Global Operation features
@@ -94,7 +105,16 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- GlobalOperationApi getGlobalOperationApiForProject(@PathParam("project") String projectName);
+ GlobalOperationApi getGlobalOperationApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to HttpHealthCheck features
+ *
+ * @param projectName the name of the project
+ */
+ @Delegate
+ @Path("/projects/{project}/global/httpHealthChecks")
+ HttpHealthCheckApi getHttpHealthCheckApi(@PathParam("project") String projectName);
/**
* Provides access to Image features
@@ -103,7 +123,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ImageApi getImageApiForProject(@PathParam("project") String projectName);
+ ImageApi getImageApi(@PathParam("project") String projectName);
/**
* Provides access to Instance features
@@ -112,7 +132,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- InstanceApi getInstanceApiForProject(@PathParam("project") String projectName);
+ InstanceApi getInstanceApi(@PathParam("project") String projectName);
/**
* Provides access to MachineType features
@@ -121,7 +141,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- MachineTypeApi getMachineTypeApiForProject(@PathParam("project") String projectName);
+ MachineTypeApi getMachineTypeApi(@PathParam("project") String projectName);
/**
* Provides access to Network features
@@ -130,7 +150,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- NetworkApi getNetworkApiForProject(@PathParam("project") String projectName);
+ NetworkApi getNetworkApi(@PathParam("project") String projectName);
/**
* Provides access to Project features
@@ -145,7 +165,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RegionApi getRegionApiForProject(@PathParam("project") String projectName);
+ RegionApi getRegionApi(@PathParam("project") String projectName);
/**
* Provides access to Region Operation features
@@ -154,7 +174,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RegionOperationApi getRegionOperationApiForProject(@PathParam("project") String projectName);
+ RegionOperationApi getRegionOperationApi(@PathParam("project") String projectName);
/**
* Provides access to Route features
@@ -163,7 +183,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- RouteApi getRouteApiForProject(@PathParam("project") String projectName);
+ RouteApi getRouteApi(@PathParam("project") String projectName);
/**
* Provides access to Snapshot features
@@ -172,7 +192,17 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- SnapshotApi getSnapshotApiForProject(@PathParam("project") String projectName);
+ SnapshotApi getSnapshotApi(@PathParam("project") String projectName);
+
+ /**
+ * Provides access to TargetPool features
+ *
+ * @param projectName the name of the project
+ * @param region the name of the region scoping this request.
+ */
+ @Delegate
+ @Path("/projects/{project}/regions/{region}")
+ TargetPoolApi getTargetPoolApi(@PathParam("project") String projectName, @PathParam("region") String region);
/**
* Provides access to Zone features
@@ -181,7 +211,7 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ZoneApi getZoneApiForProject(@PathParam("project") String projectName);
+ ZoneApi getZoneApi(@PathParam("project") String projectName);
/**
* Provides access to Zone Operation features
@@ -190,6 +220,6 @@ public interface GoogleComputeEngineApi extends Closeable {
*/
@Delegate
@Path("/projects/{project}")
- ZoneOperationApi getZoneOperationApiForProject(@PathParam("project") String projectName);
+ ZoneOperationApi getZoneOperationApi(@PathParam("project") String projectName);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
index 6702e7c..da9bbb1 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java
@@ -152,8 +152,8 @@ public class GoogleComputeEngineService extends BaseComputeService {
protected void cleanUpNetworksAndFirewallsForGroup(final String groupName) {
String resourceName = namingConvention.create().sharedNameForGroup(groupName);
- final Network network = api.getNetworkApiForProject(project.get()).get(resourceName);
- FirewallApi firewallApi = api.getFirewallApiForProject(project.get());
+ final Network network = api.getNetworkApi(project.get()).get(resourceName);
+ FirewallApi firewallApi = api.getFirewallApi(project.get());
Predicate<Firewall> firewallBelongsToNetwork = new Predicate<Firewall>() {
@Override
public boolean apply(Firewall input) {
@@ -177,7 +177,7 @@ public class GoogleComputeEngineService extends BaseComputeService {
}
}
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(project.get()).delete(resourceName));
+ AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(project.get()).delete(resourceName));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
index 7abdb4f..58aa2f4 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java
@@ -179,7 +179,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
instanceTemplate.metadata(metadataBuilder.build());
instanceTemplate.serviceAccounts(options.getServiceAccounts());
- final InstanceApi instanceApi = api.getInstanceApiForProject(userProject.get());
+ final InstanceApi instanceApi = api.getInstanceApi(userProject.get());
final String zone = template.getLocation().getId();
Operation operation = instanceApi.createInZone(name, zone, instanceTemplate);
@@ -242,7 +242,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
String diskName = instanceName + "-" + GCE_BOOT_DISK_SUFFIX;
DiskCreationOptions diskCreationOptions = new DiskCreationOptions().sourceImage(imageUri);
- Operation diskOperation = api.getDiskApiForProject(userProject.get())
+ Operation diskOperation = api.getDiskApi(userProject.get())
.createInZone(diskName,
diskSize,
template.getLocation().getId(),
@@ -250,7 +250,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
waitOperationDone(diskOperation);
- return api.getDiskApiForProject(userProject.get()).getInZone(template.getLocation().getId(),
+ return api.getDiskApi(userProject.get()).getInZone(template.getLocation().getId(),
diskName);
}
@@ -259,7 +259,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
ImmutableSet.Builder<MachineTypeInZone> builder = ImmutableSet.builder();
for (final Location zone : zones.get().values()) {
- builder.addAll(api.getMachineTypeApiForProject(userProject.get())
+ builder.addAll(api.getMachineTypeApi(userProject.get())
.listInZone(zone.getId())
.concat()
.filter(new Predicate<MachineType>() {
@@ -283,30 +283,31 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
@Override
public Iterable<Image> listImages() {
return ImmutableSet.<Image>builder()
- .addAll(api.getImageApiForProject(userProject.get()).list().concat())
- .addAll(api.getImageApiForProject(DEBIAN_PROJECT).list().concat())
- .addAll(api.getImageApiForProject(CENTOS_PROJECT).list().concat())
+ .addAll(api.getImageApi(userProject.get()).list().concat())
+ .addAll(api.getImageApi(DEBIAN_PROJECT).list().concat())
+ .addAll(api.getImageApi(CENTOS_PROJECT).list().concat())
.build();
}
- @Override
+ @SuppressWarnings("deprecation")
+@Override
public Image getImage(String id) {
- return Objects.firstNonNull(api.getImageApiForProject(userProject.get()).get(id),
- Objects.firstNonNull(api.getImageApiForProject(DEBIAN_PROJECT).get(id),
- api.getImageApiForProject(CENTOS_PROJECT).get(id)));
+ return Objects.firstNonNull(api.getImageApi(userProject.get()).get(id),
+ Objects.firstNonNull(api.getImageApi(DEBIAN_PROJECT).get(id),
+ api.getImageApi(CENTOS_PROJECT).get(id)));
}
@Override
public Iterable<Zone> listLocations() {
- return api.getZoneApiForProject(userProject.get()).list().concat();
+ return api.getZoneApi(userProject.get()).list().concat();
}
@Override
public InstanceInZone getNode(String name) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
return instance == null ? null : new InstanceInZone(instance, slashEncodedIds.getFirstId());
@@ -317,7 +318,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
return FluentIterable.from(zones.get().values()).transformAndConcat(new Function<Location, ImmutableSet<InstanceInZone>>() {
@Override
public ImmutableSet<InstanceInZone> apply(final Location input) {
- return api.getInstanceApiForProject(userProject.get()).listInZone(input.getId()).concat()
+ return api.getInstanceApi(userProject.get()).listInZone(input.getId()).concat()
.transform(new Function<Instance, InstanceInZone>() {
@Override
@@ -345,7 +346,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
String diskName = null;
try {
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
if (instance.getMetadata().getItems().get(GCE_DELETE_BOOT_DISK_METADATA_KEY).equals("true")) {
Optional<AttachedDisk> disk = tryFind(instance.getDisks(), new Predicate<AttachedDisk>() {
@@ -362,11 +363,11 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
} catch (Exception e) {
// TODO: what exception actually gets thrown here if the instance doesn't really exist?
}
- waitOperationDone(api.getInstanceApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getInstanceApi(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId()));
if (diskName != null) {
- waitOperationDone(api.getDiskApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getDiskApi(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
diskName));
}
@@ -376,7 +377,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
public void rebootNode(final String name) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
- waitOperationDone(api.getInstanceApiForProject(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
+ waitOperationDone(api.getInstanceApi(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId()));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
index 730c515..c542b9a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java
@@ -212,7 +212,7 @@ public class GoogleComputeEngineServiceContextModule
new Supplier<Map<URI, ? extends Location>>() {
@Override
public Map<URI, ? extends Location> get() {
- return uniqueIndex(transform(api.getZoneApiForProject(userProject.get()).list().concat(), zoneToLocation),
+ return uniqueIndex(transform(api.getZoneApi(userProject.get()).list().concat(), zoneToLocation),
new Function<Location, URI>() {
@Override
public URI apply(Location input) {
@@ -236,7 +236,7 @@ public class GoogleComputeEngineServiceContextModule
new Supplier<Map<URI, Region>>() {
@Override
public Map<URI, Region> get() {
- return uniqueIndex(api.getRegionApiForProject(userProject.get()).list().concat(),
+ return uniqueIndex(api.getRegionApi(userProject.get()).list().concat(),
new Function<Region, URI>() {
@Override
public URI apply(Region input) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
index b986e37..2adb7c7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java
@@ -100,7 +100,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public Set<SecurityGroup> listSecurityGroups() {
- return api.getNetworkApiForProject(userProject.get()).list().concat().transform(groupConverter).toSet();
+ return api.getNetworkApi(userProject.get()).list().concat().transform(groupConverter).toSet();
}
@Override
@@ -112,7 +112,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(id);
- Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
+ Instance instance = api.getInstanceApi(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
slashEncodedIds.getSecondId());
if (instance == null) {
@@ -124,7 +124,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
for (NetworkInterface nwInterface : instance.getNetworkInterfaces()) {
String networkUrl = nwInterface.getNetwork().getPath();
- Network nw = api.getNetworkApiForProject(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));
+ Network nw = api.getNetworkApi(userProject.get()).get(networkUrl.substring(networkUrl.lastIndexOf('/') + 1));
SecurityGroup grp = groupForTagsInNetwork(nw, instance.getTags().getItems());
if (grp != null) {
@@ -138,7 +138,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public SecurityGroup getSecurityGroupById(String id) {
checkNotNull(id, "id");
- Network network = api.getNetworkApiForProject(userProject.get()).get(id);
+ Network network = api.getNetworkApi(userProject.get()).get(id);
if (network == null) {
return null;
@@ -165,16 +165,16 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
@Override
public boolean removeSecurityGroup(String id) {
checkNotNull(id, "id");
- if (api.getNetworkApiForProject(userProject.get()).get(id) == null) {
+ if (api.getNetworkApi(userProject.get()).get(id) == null) {
return false;
}
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + id);
- FluentIterable<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(options).concat();
+ FluentIterable<Firewall> fws = api.getFirewallApi(userProject.get()).list(options).concat();
for (Firewall fw : fws) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get())
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject.get())
.delete(fw.getName()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
@@ -184,12 +184,12 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
}
AtomicReference<Operation> operation = Atomics.newReference(
- api.getNetworkApiForProject(userProject.get()).delete(id));
+ api.getNetworkApi(userProject.get()).delete(id));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create network, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
return true;
}
@@ -199,11 +199,11 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
checkNotNull(group, "group");
checkNotNull(ipPermission, "ipPermission");
- checkNotNull(api.getNetworkApiForProject(userProject.get()).get(group.getId()) == null, "network for group is null");
+ checkNotNull(api.getNetworkApi(userProject.get()).get(group.getId()) == null, "network for group is null");
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + group.getName());
- if (api.getFirewallApiForProject(userProject.get()).list(options).concat().anyMatch(providesIpPermission(ipPermission))) {
+ if (api.getFirewallApi(userProject.get()).list(options).concat().anyMatch(providesIpPermission(ipPermission))) {
// Permission already exists.
return group;
}
@@ -229,7 +229,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
}
fwOptions.addAllowedRule(ruleBuilder.build());
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject
.get()).createInNetwork(
uniqueFwName,
group.getUri(),
@@ -238,7 +238,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
- checkState(!operation.get().getHttpError().isPresent(), "Could not create firewall, operation failed" + operation);
+ checkState(!operation.get().getHttpError().isPresent(), "Could not insert firewall, operation failed" + operation);
return getSecurityGroupById(group.getId());
}
@@ -264,15 +264,15 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
checkNotNull(group, "group");
checkNotNull(ipPermission, "ipPermission");
- checkNotNull(api.getNetworkApiForProject(userProject.get()).get(group.getId()) == null, "network for group is null");
+ checkNotNull(api.getNetworkApi(userProject.get()).get(group.getId()) == null, "network for group is null");
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + group.getName());
- FluentIterable<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(options).concat();
+ FluentIterable<Firewall> fws = api.getFirewallApi(userProject.get()).list(options).concat();
for (Firewall fw : fws) {
if (equalsIpPermission(ipPermission).apply(fw)) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get())
+ AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApi(userProject.get())
.delete(fw.getName()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
@@ -328,7 +328,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE
private SecurityGroup groupForTagsInNetwork(Network nw, final Set <String> tags) {
ListOptions opts = new Builder().filter("network eq .*/" + nw.getName());
- Set<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(opts).concat()
+ Set<Firewall> fws = api.getFirewallApi(userProject.get()).list(opts).concat()
.filter(new Predicate<Firewall>() {
@Override
public boolean apply(final Firewall input) {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
index 1a9be54..790f233 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/NetworkToSecurityGroup.java
@@ -70,7 +70,7 @@ public class NetworkToSecurityGroup implements Function<Network, SecurityGroup>
ListOptions options = new ListOptions.Builder().filter("network eq .*/" + network.getName());
- for (Firewall fw : api.getFirewallApiForProject(project.get()).list(options).concat()) {
+ for (Firewall fw : api.getFirewallApi(project.get()).list(options).concat()) {
permBuilder.addAll(firewallToPerms.apply(fw));
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
index 2c84787..a849178 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/loaders/FindNetworkOrCreate.java
@@ -52,7 +52,7 @@ public class FindNetworkOrCreate extends CacheLoader<NetworkAndAddressRange, Net
@Override
public Network load(NetworkAndAddressRange in) {
- Network network = api.getNetworkApiForProject(userProject.get()).get(in.getName());
+ Network network = api.getNetworkApi(userProject.get()).get(in.getName());
if (network != null) {
return network;
} else {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
index b653ac1..622bc84 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java
@@ -118,7 +118,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
.getOptions());
assert template.getOptions().equals(templateOptions) : "options didn't clone properly";
- // get or create the network and create a firewall with the users configuration
+ // get or insert the network and insert a firewall with the users configuration
Network network = getOrCreateNetwork(templateOptions, sharedResourceName);
getOrCreateFirewalls(templateOptions, network, firewallTagNamingConvention.get(group));
templateOptions.network(network.getSelfLink());
@@ -149,9 +149,10 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
FirewallTagNamingConvention naming) {
String projectName = userProject.get();
- FirewallApi firewallApi = api.getFirewallApiForProject(projectName);
+ FirewallApi firewallApi = api.getFirewallApi(projectName);
Set<AtomicReference<Operation>> operations = Sets.newLinkedHashSet();
+
for (Integer port : templateOptions.getInboundPorts()) {
String name = naming.name(port);
Firewall firewall = firewallApi.get(name);
@@ -176,7 +177,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);
checkState(!operation.get().getHttpError().isPresent(),
- "Could not create firewall, operation failed" + operation);
+ "Could not insert firewall, operation failed" + operation);
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
index ff75a03..a908910 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/UseNodeCredentialsButOverrideFromTemplate.java
@@ -28,7 +28,7 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
/**
- * GCE needs the credentials to create the node so the node credentials already take the Image credentials into account,
+ * GCE needs the credentials to insert the node so the node credentials already take the Image credentials into account,
* as such only overriding the TemplateOptions credentials is required.
*/
@Singleton
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
index 580c906..f92b3fa 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineParserModule.java
@@ -16,30 +16,6 @@
*/
package org.jclouds.googlecomputeengine.config;
-import static org.jclouds.googlecomputeengine.domain.Firewall.Rule;
-
-import java.beans.ConstructorProperties;
-import java.lang.reflect.Type;
-import java.net.URI;
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.inject.Singleton;
-
-import org.jclouds.googlecomputeengine.domain.Firewall;
-import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
-import org.jclouds.googlecomputeengine.domain.Metadata;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.Project;
-import org.jclouds.googlecomputeengine.domain.Quota;
-import org.jclouds.googlecomputeengine.options.FirewallOptions;
-import org.jclouds.googlecomputeengine.options.RouteOptions;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.net.domain.IpProtocol;
-import org.jclouds.oauth.v2.config.OAuthParserModule;
-
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Range;
import com.google.gson.JsonArray;
@@ -54,6 +30,29 @@ import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapterFactory;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
+import org.jclouds.googlecomputeengine.domain.Firewall;
+import org.jclouds.googlecomputeengine.domain.Instance;
+import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
+import org.jclouds.googlecomputeengine.domain.Metadata;
+import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.Project;
+import org.jclouds.googlecomputeengine.domain.Quota;
+import org.jclouds.googlecomputeengine.options.FirewallOptions;
+import org.jclouds.googlecomputeengine.options.RouteOptions;
+import org.jclouds.json.config.GsonModule;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.oauth.v2.config.OAuthParserModule;
+
+
+import javax.inject.Singleton;
+import java.beans.ConstructorProperties;
+import java.lang.reflect.Type;
+import java.net.URI;
+import java.util.Date;
+import java.util.Map;
+import java.util.Set;
+
+import static org.jclouds.googlecomputeengine.domain.Firewall.Rule;
public class GoogleComputeEngineParserModule extends AbstractModule {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
index 4bf6479..e4b7986 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/AbstractDisk.java
@@ -26,8 +26,6 @@ import com.google.common.base.Objects;
/**
* A persistent disk resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/disks"/>
*/
@Beta
public abstract class AbstractDisk extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
index 85fda1f..9b0d083 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Address.java
@@ -16,10 +16,6 @@
*/
package org.jclouds.googlecomputeengine.domain;
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Optional.fromNullable;
-import static com.google.common.base.Preconditions.checkNotNull;
-
import java.beans.ConstructorProperties;
import java.net.URI;
import java.util.Date;
@@ -28,10 +24,12 @@ import com.google.common.annotations.Beta;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
/**
* Represents an Address resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/addresses"/>
*/
@Beta
public final class Address extends Resource {
@@ -100,6 +98,7 @@ public final class Address extends Resource {
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("deprecation")
@Override
protected Objects.ToStringHelper string() {
return super.string()
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
index d3896c1..0494f43 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Disk.java
@@ -32,8 +32,6 @@ import com.google.common.base.Optional;
/**
* A persistent disk resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/disks"/>
*/
@Beta
public final class Disk extends AbstractDisk {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
index 545c206..6197ff7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Firewall.java
@@ -38,9 +38,6 @@ import com.google.common.collect.TreeRangeSet;
/**
* Represents a network firewall
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/firewalls"/>
- * @see <a href="https://developers.google.com/compute/docs/networking#firewalls"/>
*/
@Beta
public final class Firewall extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
new file mode 100644
index 0000000..6bafba8
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/ForwardingRule.java
@@ -0,0 +1,198 @@
+/*
+ * 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.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+@Beta
+public class ForwardingRule extends Resource {
+
+ private final URI region;
+ private final Optional<String> ipAddress;
+ private final Optional<String> ipProtocol;
+ private final Optional<String> portRange;
+ private final URI target;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "region", "IPAddress", "IPProtocol",
+ "portRange", "target"
+ })
+ private ForwardingRule(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ URI region, @Nullable String ipAddress, @Nullable String ipProtocol, @Nullable String portRange,
+ URI target) {
+ super(Kind.FORWARDING_RULE, id, creationTimestamp, selfLink, name, description);
+ this.region = checkNotNull(region, "region of %s", name);
+ this.ipAddress = fromNullable(ipAddress);
+ this.ipProtocol = fromNullable(ipProtocol);
+ this.portRange = fromNullable(portRange);
+ this.target = checkNotNull(target, "target of %s", name);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return URL of the region where the forwarding rule resides.
+ */
+ public URI getRegion() {
+ return region;
+ }
+
+ /**
+ * @return the external IP address that this forwarding rule is serving on behalf of. If this is a reserved
+ * address, the address must live in the same region as the forwarding rule. By default,
+ * this field is empty and an ephemeral IP is assigned to the ForwardingRule.
+ */
+ public Optional<String> getIpAddress() {
+ return ipAddress;
+ }
+
+ /**
+ * @return the IP protocol to which this rule applies. If left empty, the default value used is TCP.
+ */
+ public Optional<String> getIpProtocol() {
+ return ipProtocol;
+ }
+
+ /**
+ * @return If IPProtocol is TCP or UDP, packets addressed to ports in the specified range will be forwarded to
+ * backend. By default, this is empty and all ports are allowed.
+ */
+ public Optional<String> getPortRange() {
+ return portRange;
+ }
+
+ /**
+ * @return the URL of the target resource to receive the matched traffic. The target resource must live in the
+ * same region as this forwarding rule.
+ */
+ public URI getTarget() {
+ return target;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ForwardingRule that = ForwardingRule.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.region, that.region);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("region", region)
+ .add("ipAddress", ipAddress.orNull())
+ .add("ipProtocol", ipProtocol.orNull())
+ .add("portRange", portRange.orNull())
+ .add("target", target);
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromForwardingRule(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private URI region;
+ private String ipAddress;
+ private String ipProtocol;
+ private String portRange;
+ private URI target;
+
+ /**
+ * @see ForwardingRule#getRegion()
+ */
+ public Builder region(URI region) {
+ this.region = region;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpAddress()
+ */
+ public Builder ipAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpProtocol()
+ */
+ public Builder ipProtocol(String ipProtocol) {
+ this.ipProtocol = ipProtocol;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getPortRange()
+ */
+ public Builder portRange(String portRange) {
+ this.portRange = portRange;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getTarget()
+ */
+ public Builder target(URI target) {
+ this.target = target;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public ForwardingRule build() {
+ return new ForwardingRule(super.id, super.creationTimestamp, super.selfLink, super.name, super.description,
+ region, ipAddress, ipProtocol, portRange, target);
+ }
+
+ public Builder fromForwardingRule(ForwardingRule in) {
+ return super.fromResource(in)
+ .region(in.getRegion())
+ .ipAddress(in.getIpAddress().orNull())
+ .ipProtocol(in.getIpProtocol().orNull())
+ .portRange(in.getPortRange().orNull())
+ .target(in.getTarget());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
new file mode 100644
index 0000000..92d39b8
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/HttpHealthCheck.java
@@ -0,0 +1,235 @@
+/*
+ * 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.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+
+import org.jclouds.javax.annotation.Nullable;
+
+@Beta
+public class HttpHealthCheck extends Resource {
+ private final Optional<String> host;
+ private final Optional<String> requestPath;
+ private final Optional<Integer> port;
+ private final Optional<Integer> checkIntervalSec;
+ private final Optional<Integer> timeoutSec;
+ private final Optional<Integer> unhealthyThreshold;
+ private final Optional<Integer> healthyThreshold;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "host", "requestPath", "port",
+ "checkIntervalSec", "timeoutSec", "unhealthyThreshold", "healthyThreshold"
+ })
+ private HttpHealthCheck(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ @Nullable String host, @Nullable String requestPath, int port, int checkIntervalSec,
+ int timeoutSec, int unhealthyThreshold, int healthyThreshold) {
+ super(Kind.HTTP_HEALTH_CHECK, id, creationTimestamp, selfLink, name, description);
+ this.host = fromNullable(host);
+ this.requestPath = fromNullable(requestPath);
+ this.port = fromNullable(port);
+ this.checkIntervalSec = fromNullable(checkIntervalSec);
+ this.timeoutSec = fromNullable(timeoutSec);
+ this.unhealthyThreshold = fromNullable(unhealthyThreshold);
+ this.healthyThreshold = fromNullable(healthyThreshold);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return the value of the host header in the HTTP health check request. If left empty (default value),
+ * the public IP on behalf of which this health check is performed will be used.
+ */
+ public Optional<String> getHost() {
+ return host;
+ }
+
+ /**
+ * @return the request path of the HTTP health check request. The default value is /.
+ */
+ public Optional<String> getRequestPath() {
+ return requestPath;
+ }
+
+ /**
+ * @return the TCP port number for the HTTP health check request. The default value is 80.
+ */
+ public Optional<Integer> getPort() {
+ return port;
+ }
+
+ /**
+ * @return how often (in seconds) to send a health check. The default value is 5 seconds.
+ */
+ public Optional<Integer> getCheckIntervalSec() {
+ return checkIntervalSec;
+ }
+
+ /**
+ * @return how long (in seconds) to wait before claiming failure. The default value is 5 seconds.
+ */
+ public Optional<Integer> getTimeoutSec() {
+ return timeoutSec;
+ }
+
+ /**
+ * @return a so-far healthy VM will be marked unhealthy after this many consecutive failures.
+ * The default value is 2.
+ */
+ public Optional<Integer> getUnhealthyThreshold() {
+ return unhealthyThreshold;
+ }
+
+ /**
+ * @return an unhealthy VM will be marked healthy after this many consecutive successes. The default value is 2.
+ */
+ public Optional<Integer> getHealthyThreshold() {
+ return healthyThreshold;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ HttpHealthCheck that = HttpHealthCheck.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.host, that.host);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("host", host.orNull())
+ .add("requestPath", requestPath.orNull())
+ .add("port", port.orNull())
+ .add("checkIntervalSec", checkIntervalSec.orNull())
+ .add("timeoutSec", timeoutSec.orNull())
+ .add("unhealthyThreshold", unhealthyThreshold.orNull())
+ .add("healthyThreshold", healthyThreshold.orNull());
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromHttpHealthCheck(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private String host;
+ private String requestPath;
+ private int port;
+ private int checkIntervalSec;
+ private int timeoutSec;
+ private int unhealthyThreshold;
+ private int healthyThreshold;
+
+ /**
+ * @see HttpHealthCheck#getHost()
+ */
+ public Builder host(String host) {
+ this.host = host;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getRequestPath()
+ */
+ public Builder requestPath(String requestPath) {
+ this.requestPath = requestPath;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getPort()
+ */
+ public Builder port(int port) {
+ this.port = port;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getCheckIntervalSec()
+ */
+ public Builder checkIntervalSec(int checkIntervalSec) {
+ this.checkIntervalSec = checkIntervalSec;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.HttpHealthCheck#getTimeoutSec()
+ */
+ public Builder timeoutSec(int timeoutSec) {
+ this.timeoutSec = timeoutSec;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheck#getUnhealthyThreshold()
+ */
+ public Builder unhealthyThreshold(int unhealthyThreshold) {
+ this.unhealthyThreshold = unhealthyThreshold;
+ return this;
+ }
+
+ /**
+ * @see HttpHealthCheck#getHealthyThreshold()
+ */
+ public Builder healthyThreshold(int healthyThreshold) {
+ this.healthyThreshold = healthyThreshold;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public HttpHealthCheck build() {
+ return new HttpHealthCheck(super.id, super.creationTimestamp, super.selfLink, super.name,
+ super.description, host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold,
+ healthyThreshold);
+ }
+
+ public Builder fromHttpHealthCheck(HttpHealthCheck in) {
+ return super.fromResource(in)
+ .host(in.getHost().orNull())
+ .requestPath(in.getRequestPath().orNull())
+ .port(in.getPort().orNull())
+ .checkIntervalSec(in.getCheckIntervalSec().orNull())
+ .timeoutSec(in.getTimeoutSec().orNull())
+ .unhealthyThreshold(in.getUnhealthyThreshold().orNull())
+ .healthyThreshold(in.getHealthyThreshold().orNull());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
index 44fc552..ddd315a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Image.java
@@ -31,8 +31,6 @@ import com.google.common.base.Optional;
/**
* Represents a disk image to use on an instance.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/images"/>
*/
@Beta
public final class Image extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
index 4b219f5..1dc8cd7 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java
@@ -37,8 +37,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a virtual machine.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/instances"/>
*/
@Beta
public class Instance extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
index d847bcb..72b1340 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/MachineType.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableList;
/**
* Represents a machine type used to host an instance.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/machineTypes"/>
*/
@Beta
public final class MachineType extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
index a3c4bb0..e306e73 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Network.java
@@ -30,8 +30,6 @@ import com.google.common.base.Optional;
/**
* Represents a network used to enable instance communication.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/networks"/>
*/
@Beta
public final class Network extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
index f32c62d..3c9b685 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Operation.java
@@ -36,8 +36,6 @@ import com.google.common.collect.ImmutableList;
/**
* Describes an operation being executed on some Resource
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/operations"/>
*/
@Beta
public class Operation extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
index 2081e12..c0f4c8d 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Project.java
@@ -30,8 +30,6 @@ import com.google.common.collect.ImmutableSet;
/**
* A Project resource is the root collection and settings resource for all Google Compute Engine resources.
- *
- * @see <a href="https://developers.google.com/compute/docs/projects"/>
*/
@Beta
public class Project extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
index b1f4e04..08ce247 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java
@@ -26,8 +26,6 @@ import com.google.common.base.Objects.ToStringHelper;
/**
* Quotas assigned to a given project or region.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/projects#resource"/>
*/
@Beta
public class Quota {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
index bd55e41..60f055c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Region.java
@@ -31,8 +31,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a region resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/regions"/>
*/
@Beta
public final class Region extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
index e5c76cc..c321788 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Resource.java
@@ -16,18 +16,10 @@
*/
package org.jclouds.googlecomputeengine.domain;
-import static com.google.common.base.Objects.ToStringHelper;
import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Optional.fromNullable;
import static com.google.common.base.Preconditions.checkNotNull;
-import java.beans.ConstructorProperties;
-import java.net.URI;
-import java.util.Date;
-
-import org.jclouds.javax.annotation.Nullable;
-
import com.google.common.annotations.Beta;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner;
@@ -36,6 +28,12 @@ import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
+import org.jclouds.javax.annotation.Nullable;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+
/**
* Base class for Google Compute Engine resources.
*/
@@ -51,6 +49,10 @@ public class Resource {
DISK_TYPE_LIST,
FIREWALL,
FIREWALL_LIST,
+ FORWARDING_RULE,
+ FORWARDING_RULE_LIST,
+ HTTP_HEALTH_CHECK,
+ HTTP_HEALTH_CHECK_LIST,
IMAGE,
IMAGE_LIST,
OPERATION,
@@ -68,6 +70,8 @@ public class Resource {
ROUTE_LIST,
SNAPSHOT,
SNAPSHOT_LIST,
+ TARGET_POOL,
+ TARGET_POOL_LIST,
ZONE,
ZONE_LIST;
@@ -171,8 +175,9 @@ public class Resource {
&& equal(this.name, that.name);
}
- protected ToStringHelper string() {
- return toStringHelper(this)
+ @SuppressWarnings("deprecation")
+ protected Objects.ToStringHelper string() {
+ return Objects.toStringHelper(this)
.omitNullValues()
.add("kind", kind)
.add("id", id)
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
index 2176670..5143a5a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Route.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a route resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/routes"/>
*/
@Beta
public final class Route extends Resource {
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
index 71bebfe..0942c1e 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Snapshot.java
@@ -29,8 +29,6 @@ import com.google.common.base.Optional;
/**
* A Persistent Disk Snapshot resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/snapshots"/>
*/
@Beta
public final class Snapshot extends AbstractDisk {
@@ -50,7 +48,7 @@ public final class Snapshot extends AbstractDisk {
}
/**
- * @return The source disk used to create this snapshot. Once the source disk
+ * @return The source disk used to insert this snapshot. Once the source disk
* has been deleted from the system, this field will be cleared, and will
* not be set even if a disk with the same name has been re-created (output only).
*/
@@ -59,7 +57,7 @@ public final class Snapshot extends AbstractDisk {
}
/**
- * @return The ID value of the disk used to create this snapshot. This value
+ * @return The ID value of the disk used to insert this snapshot. This value
* may be used to determine whether the snapshot was taken from the current
* or a previous instance of a given disk name.
*/
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
new file mode 100644
index 0000000..ff0c770
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/TargetPool.java
@@ -0,0 +1,237 @@
+/*
+ * 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.domain;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableSet;
+
+import java.beans.ConstructorProperties;
+import java.net.URI;
+import java.util.Date;
+import java.util.Set;
+
+import static com.google.common.base.Objects.equal;
+import static com.google.common.base.Optional.fromNullable;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.javax.annotation.Nullable;
+
+/**
+ * Represents an TargetPool resource.
+ */
+@Beta
+public final class TargetPool extends Resource {
+
+ private final URI region;
+ private final Set<URI> healthChecks;
+ private final Set<URI> instances;
+ private final Optional<String> sessionAffinity;
+ private final float failoverRatio;
+ private final Optional<String> backupPool;
+
+ @ConstructorProperties({
+ "id", "creationTimestamp", "selfLink", "name", "description", "region", "healthChecks", "instances",
+ "sessionAffinity", "failoverRatio", "backupPool"
+ })
+ private TargetPool(String id, Date creationTimestamp, URI selfLink, String name, String description,
+ URI region, Set<URI> healthChecks, Set<URI> instances, @Nullable String sessionAffinity,
+ float failoverRatio, @Nullable String backupPool) {
+ super(Kind.TARGET_POOL, id, creationTimestamp, selfLink, name, description);
+ this.region = checkNotNull(region, "region of %s", name);
+ this.healthChecks = healthChecks == null ? ImmutableSet.<URI>of() : healthChecks;
+ this.instances = instances == null ? ImmutableSet.<URI>of() : instances;
+ this.sessionAffinity = fromNullable(sessionAffinity);
+ this.failoverRatio = failoverRatio;
+ this.backupPool = fromNullable(backupPool);
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * @return URL of the region where the forwarding pool resides.
+ */
+ public URI getRegion() {
+ return region;
+ }
+
+ /**
+ * @return The A URL to one HttpHealthCheck resource. A member VM in this pool is considered healthy if and only if
+ * the specified health checks pass. An empty list means all member virtual machines will be considered healthy at
+ * all times but the health status of this target pool will be marked as unhealthy to indicate that no health checks
+ * are being performed.
+ */
+ public Set<URI> getHealthChecks() {
+ return healthChecks;
+ }
+
+ /**
+ * @return A list of resource URLs to the member VMs serving this pool. They must live in zones contained in the same
+ * region as this pool.
+ */
+ public Set<URI> getInstances() {
+ return instances;
+ }
+
+ /**
+ * @return the session affinity option, determines the hash method that Google Compute Engine uses to
+ * distribute traffic.
+ */
+ public Optional<String> getSessionAffinity() {
+ return sessionAffinity;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool.
+ * The value of the a float between [0, 1]. If set, backupPool must also be set. Together,
+ * they define the fallback behavior of the primary target pool. If the ratio of the healthy VMs in the primary
+ * pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool.
+ * In case where failoverRatio is not set or all the VMs in the backup pool are unhealthy,
+ * the traffic will be directed back to the primary pool in the force mode, where traffic will be spread to the
+ * healthy VMs with the best effort, or to all VMs when no VM is healthy.
+ * @return the failover ratio
+ */
+ public float getFailoverRatio() {
+ return failoverRatio;
+ }
+
+ /**
+ * This field is applicable only when the target pool is serving a forwarding rule as the primary pool.
+ * Must be a fully-qualified URL to a target pool that is in the same region as the primary target pool.
+ * If set, failoverRatio must also be set. Together, they define the fallback behavior of the primary target pool.
+ * If the ratio of the healthy VMs in the primary pool is at or below this number,
+ * traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is
+ * not set or all the VMs in the backup pool are unhealthy, the traffic will be directed back to the primary pool
+ * in the force mode, where traffic will be spread to the healthy VMs with the best effort,
+ * or to all VMs when no VM is healthy.
+ * @return the backup pool
+ */
+ public Optional<String> getBackupPool() {
+ return backupPool;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ TargetPool that = TargetPool.class.cast(obj);
+ return equal(this.kind, that.kind)
+ && equal(this.name, that.name)
+ && equal(this.region, that.region);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected MoreObjects.ToStringHelper string() {
+ return super.string()
+ .omitNullValues()
+ .add("region", region)
+ .add("healthChecks", healthChecks)
+ .add("instances", instances)
+ .add("sessionAffinity", sessionAffinity.orNull())
+ .add("failoverRatio", failoverRatio)
+ .add("backupPool", backupPool.orNull());
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromTargetPool(this);
+ }
+
+ public static final class Builder extends Resource.Builder<Builder> {
+ private URI region;
+ private ImmutableSet.Builder<URI> healthChecks = ImmutableSet.builder();
+ private ImmutableSet.Builder<URI> instances = ImmutableSet.builder();
+ private String sessionAffinity;
+ private float failoverRatio;
+ private String backupPool;
+
+ /**
+ * @see TargetPool#getRegion()
+ */
+ public Builder region(URI region) {
+ this.region = region;
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getHealthChecks()
+ */
+ public Builder healthChecks(Set<URI> healthChecks) {
+ this.healthChecks.addAll(healthChecks);
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getInstances()
+ */
+ public Builder instances(Set<URI> instances) {
+ this.instances.addAll(instances);
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getSessionAffinity()
+ */
+ public Builder sessionAffinity(String sessionAffinity) {
+ this.sessionAffinity = sessionAffinity;
+ return this;
+ }
+
+ /**
+ * @see TargetPool#getFailoverRatio()
+ */
+ public Builder failoverRatio(float failoverRatio) {
+ this.failoverRatio = failoverRatio;
+ return this;
+ }
+
+ public Builder backupPool(String backupPool) {
+ this.backupPool = backupPool;
+ return this;
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+
+ public TargetPool build() {
+ return new TargetPool(super.id, super.creationTimestamp, super.selfLink, super.name,
+ super.description, region, healthChecks.build(), instances.build(),
+ sessionAffinity, failoverRatio, backupPool);
+ }
+
+ public Builder fromTargetPool(TargetPool in) {
+ return super.fromResource(in)
+ .region(in.getRegion())
+ .healthChecks(in.getHealthChecks())
+ .instances(in.getInstances())
+ .sessionAffinity(in.getSessionAffinity().orNull())
+ .failoverRatio(in.getFailoverRatio())
+ .backupPool(in.getBackupPool().orNull());
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/ed9fc5c5/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
index 0f43daf..0d03c80 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Zone.java
@@ -35,8 +35,6 @@ import com.google.common.collect.ImmutableSet;
/**
* Represents a zone resource.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/zones"/>
*/
@Beta
public final class Zone extends Resource {