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/11/04 00:21:30 UTC
[09/14] JCLOUDS-750 Convert GoogleComputeEngine to AutoValue +
general cleanup.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/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 0d03c80..fd8877e 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
@@ -16,315 +16,76 @@
*/
package org.jclouds.googlecomputeengine.domain;
-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 static org.jclouds.googlecomputeengine.internal.NullSafeCopies.copyOf;
-import java.beans.ConstructorProperties;
import java.net.URI;
import java.util.Date;
-import java.util.Set;
+import java.util.List;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.json.SerializedNames;
-import com.google.common.annotations.Beta;
-import com.google.common.base.Objects;
-import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableSet;
+import com.google.auto.value.AutoValue;
-/**
- * Represents a zone resource.
- */
-@Beta
-public final class Zone extends Resource {
-
- public enum Status {
- UP,
- DOWN
- }
-
- private final Status status;
- private final Set<MaintenanceWindow> maintenanceWindows;
- private final Set<String> availableMachineTypes;
-
- @ConstructorProperties({
- "id", "creationTimestamp", "selfLink", "name", "description", "status", "maintenanceWindows",
- "availableMachineTypes"
- })
- private Zone(String id, Date creationTimestamp, URI selfLink, String name, String description,
- Status status, Set<MaintenanceWindow> maintenanceWindows, Set<String> availableMachineTypes) {
- super(Kind.ZONE, id, creationTimestamp, selfLink, name, description);
- this.status = checkNotNull(status, "status of %name", name);
- this.maintenanceWindows = maintenanceWindows == null ? ImmutableSet.<MaintenanceWindow>of() : ImmutableSet
- .copyOf(maintenanceWindows);
- this.availableMachineTypes = availableMachineTypes == null ? ImmutableSet.<String>of() : ImmutableSet
- .copyOf(availableMachineTypes);
- }
+@AutoValue
+public abstract class Zone {
/**
- * @return Status of the zone. "UP" or "DOWN".
- */
- public Status getStatus() {
- return status;
- }
-
- /**
- * @return scheduled maintenance windows for the zone. When the zone is in a maintenance window,
- * all resources which reside in the zone will be unavailable.
- */
- public Set<MaintenanceWindow> getMaintenanceWindows() {
- return maintenanceWindows;
- }
-
- /**
- * @return the machine types that can be used in this zone.
- */
- @Nullable
- public Set<String> getAvailableMachineTypes() {
- return availableMachineTypes;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Objects.ToStringHelper string() {
- return super.string()
- .add("status", status)
- .add("maintenanceWindows", maintenanceWindows)
- .add("availableMachineTypes", availableMachineTypes);
- }
-
- /**
- * {@inheritDoc}
+ * Scheduled maintenance windows for the zone. When the zone is in a maintenance window,
+ * all resources which reside in the zone will be unavailable.
*/
- @Override
- public String toString() {
- return string().toString();
- }
+ @AutoValue
+ public abstract static class MaintenanceWindow {
- public static Builder builder() {
- return new Builder();
- }
+ public abstract String name();
- public Builder toBuilder() {
- return new Builder().fromZone(this);
- }
+ @Nullable public abstract String description();
- public static final class Builder extends Resource.Builder<Builder> {
+ public abstract Date beginTime();
- private Status status;
- private ImmutableSet.Builder<MaintenanceWindow> maintenanceWindows = ImmutableSet.builder();
- private ImmutableSet.Builder<String> availableMachineTypes = ImmutableSet.builder();
+ public abstract Date endTime();
- /**
- * @see Zone#getStatus()
- */
- public Builder status(Status status) {
- this.status = status;
- return this;
+ @SerializedNames({ "name", "description", "beginTime", "endTime" })
+ public static MaintenanceWindow create(String name, String description, Date beginTime, Date endTime) {
+ return new AutoValue_Zone_MaintenanceWindow(name, description, beginTime, endTime);
}
- /**
- * @see Zone#getMaintenanceWindows()
- */
- public Builder addMaintenanceWindow(MaintenanceWindow maintenanceWindow) {
- this.maintenanceWindows.add(checkNotNull(maintenanceWindow, "maintenanceWindow"));
- return this;
+ MaintenanceWindow() {
}
+ }
- /**
- * @see Zone#getMaintenanceWindows()
- */
- public Builder maintenanceWindows(Set<MaintenanceWindow> maintenanceWindows) {
- this.maintenanceWindows.addAll(checkNotNull(maintenanceWindows, "maintenanceWindows"));
- return this;
- }
+ public enum Status {
+ UP,
+ DOWN
+ }
- /**
- * @see Zone#getAvailableMachineTypes()
- */
- public Builder addAvailableMachineType(String availableMachineType) {
- this.availableMachineTypes.add(checkNotNull(availableMachineType, "availableMachineType"));
- return this;
- }
+ public abstract String id();
- /**
- * @see Zone#getAvailableMachineTypes()
- */
- public Builder availableMachineTypes(Set<String> availableMachineTypes) {
- this.availableMachineTypes.addAll(checkNotNull(availableMachineTypes, "availableMachineTypes"));
- return this;
- }
+ public abstract URI selfLink();
- @Override
- protected Builder self() {
- return this;
- }
+ public abstract String name();
- public Zone build() {
- return new Zone(super.id, super.creationTimestamp, super.selfLink, super.name,
- super.description, status, maintenanceWindows.build(), availableMachineTypes.build());
- }
+ @Nullable public abstract String description();
- public Builder fromZone(Zone in) {
- return super.fromResource(in)
- .status(in.getStatus())
- .maintenanceWindows(in.getMaintenanceWindows())
- .availableMachineTypes(in.getAvailableMachineTypes());
- }
- }
+ public abstract Status status();
/**
* Scheduled maintenance windows for the zone. When the zone is in a maintenance window,
* all resources which reside in the zone will be unavailable.
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/v1/zones"/>
*/
- public static final class MaintenanceWindow {
+ public abstract List<MaintenanceWindow> maintenanceWindows();
- private final String name;
- private final Optional<String> description;
- private final Date beginTime;
- private final Date endTime;
+ /** The machine types that can be used in this zone. */
+ public abstract List<String> availableMachineTypes();
- @ConstructorProperties({
- "name", "description", "beginTime", "endTime"
- })
- private MaintenanceWindow(String name, String description, Date beginTime, Date endTime) {
- this.name = checkNotNull(name, "name");
- this.description = fromNullable(description);
- this.beginTime = checkNotNull(beginTime, "beginTime of %name", name);
- this.endTime = checkNotNull(endTime, "endTime of %name", name);
- }
-
- /**
- * @return name of the maintenance window.
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return textual description of the maintenance window.
- */
- public Optional<String> getDescription() {
- return description;
- }
-
- /**
- * @return begin time of the maintenance window.
- */
- public Date getBeginTime() {
- return beginTime;
- }
-
- /**
- * @return end time of the maintenance window.
- */
- public Date getEndTime() {
- return endTime;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return Objects.hashCode(name, description, beginTime, endTime);
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- MaintenanceWindow that = MaintenanceWindow.class.cast(obj);
- return equal(this.name, that.name)
- && equal(this.beginTime, that.beginTime)
- && equal(this.endTime, that.endTime);
- }
-
- protected Objects.ToStringHelper string() {
- return toStringHelper(this)
- .omitNullValues()
- .add("name", name)
- .add("description", description.orNull())
- .add("beginTime", beginTime)
- .add("endTime", endTime);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().fromZoneMaintenanceWindow(this);
- }
-
- public static final class Builder {
-
- private String name;
- private String description;
- private Date beginTime;
- private Date endTime;
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Zone.MaintenanceWindow#getName()
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Zone.MaintenanceWindow#getDescription()
- */
- public Builder description(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Zone.MaintenanceWindow#getBeginTime()
- */
- public Builder beginTime(Date beginTime) {
- this.beginTime = beginTime;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Zone.MaintenanceWindow#getEndTime()
- */
- public Builder endTime(Date endTime) {
- this.endTime = endTime;
- return this;
- }
-
-
- public MaintenanceWindow build() {
- return new MaintenanceWindow(name, description, beginTime, endTime);
- }
+ @SerializedNames(
+ { "id", "selfLink", "name", "description", "status", "maintenanceWindows", "availableMachineTypes" })
+ public static Zone create(String id, URI selfLink, String name, String description, Status status,
+ List<MaintenanceWindow> maintenanceWindows, List<String> availableMachineTypes) {
+ return new AutoValue_Zone(id, selfLink, name, description, status, copyOf(maintenanceWindows),
+ copyOf(availableMachineTypes));
+ }
- public Builder fromZoneMaintenanceWindow(MaintenanceWindow in) {
- return new Builder()
- .name(in.getName())
- .description(in.getDescription().orNull())
- .beginTime(in.getBeginTime())
- .endTime(in.getEndTime());
- }
- }
+ Zone() {
}
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/internal/NetworkAndAddressRange.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/internal/NetworkAndAddressRange.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/internal/NetworkAndAddressRange.java
deleted file mode 100644
index 66fbd66..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/internal/NetworkAndAddressRange.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.internal;
-
-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 org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Objects;
-import com.google.common.base.Objects.ToStringHelper;
-import com.google.common.base.Optional;
-
-/**
- * Container for network, IPv4 range and optional gateway, for creation caching
- */
-public class NetworkAndAddressRange {
- protected final String name;
- protected final String ipV4Range;
- protected final Optional<String> gateway;
-
- @ConstructorProperties({
- "name", "ipV4Range", "gateway"
- })
- public NetworkAndAddressRange(String name, String ipV4Range, @Nullable String gateway) {
- this.name = checkNotNull(name, "name");
- this.ipV4Range = checkNotNull(ipV4Range, "ipV4Range");
- this.gateway = fromNullable(gateway);
- }
-
- public String getName() {
- return name;
- }
-
- public String getIpV4Range() {
- return ipV4Range;
- }
-
- @Nullable
- public Optional<String> getGateway() {
- return gateway;
- }
-
- @Override
- public int hashCode() {
- // We only do hashcode/equals on name.
- // the ip v4 range and gateway are included for creation rather than caching.
- return Objects.hashCode(name);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- NetworkAndAddressRange that = NetworkAndAddressRange.class.cast(obj);
- return equal(this.name, that.name);
- }
-
- protected ToStringHelper string() {
- return toStringHelper(this)
- .omitNullValues()
- .add("name", name)
- .add("ipV4Range", ipV4Range)
- .add("gateway", gateway.orNull());
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/templates/InstanceTemplate.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/templates/InstanceTemplate.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/templates/InstanceTemplate.java
new file mode 100644
index 0000000..f726234
--- /dev/null
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/templates/InstanceTemplate.java
@@ -0,0 +1,269 @@
+/*
+ * 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.templates;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk;
+import static org.jclouds.googlecomputeengine.domain.Instance.AttachedDisk.Mode;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
+import org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig.Type;
+import org.jclouds.googlecomputeengine.domain.Instance.ServiceAccount;
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/** Optional information for creating an instance. */
+public class InstanceTemplate {
+
+ public static final class PersistentDisk {
+
+ private final AttachedDisk.Type type = AttachedDisk.Type.PERSISTENT;
+ private final AttachedDisk.Mode mode;
+ private final URI source;
+ private final String deviceName;
+ private final boolean autoDelete;
+ private final boolean boot;
+
+ public PersistentDisk(AttachedDisk.Mode mode, URI source, String deviceName, boolean autoDelete, boolean boot) {
+ this.mode = checkNotNull(mode, "mode");
+ this.source = checkNotNull(source, "source");
+ this.deviceName = deviceName;
+ this.autoDelete = autoDelete;
+ this.boot = boot;
+ }
+
+ public AttachedDisk.Mode mode() {
+ return mode;
+ }
+
+ public URI source() {
+ return source;
+ }
+
+ @Nullable public String deviceName() {
+ return deviceName;
+ }
+
+ public boolean autoDelete() {
+ return autoDelete;
+ }
+
+ public boolean boot() {
+ return boot;
+ }
+ }
+
+ public static final class NetworkInterface {
+
+ private final URI network;
+ private final String networkIP;
+ private final List<AccessConfig> accessConfigs;
+
+ public NetworkInterface(URI network, String networkIP, List<AccessConfig> accessConfigs) {
+ this.network = network;
+ this.networkIP = networkIP;
+ this.accessConfigs = accessConfigs;
+ }
+
+ public URI network() {
+ return network;
+ }
+
+ @Nullable public String networkIP() {
+ return networkIP;
+ }
+
+ @Nullable public List<AccessConfig> accessConfigs() {
+ return accessConfigs;
+ }
+ }
+
+ private String name;
+ private String description;
+ private URI machineType;
+ private URI image;
+ private List<ServiceAccount> serviceAccounts = Lists.newArrayList();
+ private List<PersistentDisk> disks = Lists.newArrayList();
+ private List<NetworkInterface> networkInterfaces = Lists.newArrayList();
+ private Map<String, String> metadata = Maps.newLinkedHashMap();
+ private String machineTypeName;
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#name()
+ */
+ public String name() {
+ return name;
+ }
+
+ public InstanceTemplate name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#description()
+ */
+ public String description() {
+ return description;
+ }
+
+ public InstanceTemplate description(String description) {
+ this.description = description;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#image()
+ */
+ public URI image() {
+ return image;
+ }
+
+ public InstanceTemplate image(URI image) {
+ this.image = image;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#machineType()
+ */
+ public URI machineType() {
+ return machineType;
+ }
+
+ public InstanceTemplate machineType(URI machineType) {
+ this.machineType = machineType;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#machineTypeName()
+ */
+ public String machineTypeName() {
+ return machineTypeName;
+ }
+
+ public InstanceTemplate machineTypeName(String machineTypeName) {
+ this.machineTypeName = machineTypeName;
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#disks()
+ */
+ public List<PersistentDisk> disks() {
+ return disks;
+ }
+
+ public InstanceTemplate addDisk(Mode mode, URI source) {
+ this.disks.add(new PersistentDisk(mode, source, null, false, false));
+ return this;
+ }
+
+ public InstanceTemplate addDisk(Mode mode, URI source, boolean autoDelete) {
+ this.disks.add(new PersistentDisk(mode, source, null, autoDelete, false));
+ return this;
+ }
+
+ public InstanceTemplate addDisk(Mode mode, URI source, String deviceName, boolean autoDelete) {
+ this.disks.add(new PersistentDisk(mode, source, deviceName, autoDelete, false));
+ return this;
+ }
+
+ public InstanceTemplate addDisk(Mode mode, URI source, String deviceName, boolean autoDelete, boolean boot) {
+ this.disks.add(new PersistentDisk(mode, source, deviceName, autoDelete, boot));
+ return this;
+ }
+
+ public InstanceTemplate disks(List<PersistentDisk> disks) {
+ this.disks = Lists.newArrayList();
+ this.disks.addAll(checkNotNull(disks, "disks"));
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#networkInterfaces()
+ */
+ public List<NetworkInterface> networkInterfaces() {
+ return networkInterfaces;
+ }
+
+ public InstanceTemplate addNetworkInterface(URI network) {
+ this.networkInterfaces.add(new NetworkInterface(network, null, null));
+ return this;
+ }
+
+ public InstanceTemplate addNetworkInterface(URI network, Type type) {
+ this.networkInterfaces
+ .add(new NetworkInterface(network, null, ImmutableList.of(AccessConfig.create(null, type, null))));
+ return this;
+ }
+
+ public InstanceTemplate addNetworkInterface(NetworkInterface networkInterface) {
+ this.networkInterfaces.add(networkInterface);
+ return this;
+ }
+
+ public InstanceTemplate networkInterfaces(List<NetworkInterface> networkInterfaces) {
+ this.networkInterfaces = Lists.newArrayList(networkInterfaces);
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#metadata()
+ */
+ public Map<String, String> metadata() {
+ return metadata;
+ }
+
+ public InstanceTemplate addMetadata(String key, String value) {
+ this.metadata.put(checkNotNull(key, "key"), checkNotNull(value, "value of %", key));
+ return this;
+ }
+
+ public InstanceTemplate metadata(Map<String, String> metadata) {
+ this.metadata = Maps.newLinkedHashMap();
+ this.metadata.putAll(checkNotNull(metadata, "metadata"));
+ return this;
+ }
+
+ /**
+ * @see org.jclouds.googlecomputeengine.domain.Instance#serviceAccounts()
+ */
+ public List<ServiceAccount> serviceAccounts() {
+ return serviceAccounts;
+ }
+
+ public InstanceTemplate addServiceAccount(ServiceAccount serviceAccount) {
+ this.serviceAccounts.add(checkNotNull(serviceAccount, "serviceAccount"));
+ return this;
+ }
+
+ public InstanceTemplate serviceAccounts(List<ServiceAccount> serviceAccounts) {
+ this.serviceAccounts = Lists.newArrayList();
+ this.serviceAccounts.addAll(checkNotNull(serviceAccounts, "serviceAccounts"));
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
index e142d7a..bbb65de 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/AddressApi.java
@@ -30,10 +30,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.Address;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
@@ -118,7 +118,7 @@ public interface AddressApi {
@Path("/regions/{region}/addresses")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseAddresses.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Address> listFirstPageInRegion(@PathParam("region") String region);
/**
@@ -130,7 +130,7 @@ public interface AddressApi {
@Path("/regions/{region}/addresses")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseAddresses.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Address> listAtMarkerInRegion(@PathParam("region") String region, @QueryParam("pageToken") @Nullable String marker);
/**
@@ -151,7 +151,7 @@ public interface AddressApi {
@Path("/regions/{region}/addresses")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseAddresses.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Address> listAtMarkerInRegion(@PathParam("region") String region, @QueryParam("pageToken") @Nullable String marker, ListOptions listOptions);
/**
@@ -181,5 +181,4 @@ public interface AddressApi {
@Transform(ParseAddresses.ToPagedIterable.class)
@Fallback(EmptyPagedIterableOnNotFoundOr404.class)
PagedIterable<Address> listInRegion(@PathParam("region") String region, ListOptions options);
-
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
index ba3c3f1..7159a6f 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskApi.java
@@ -30,16 +30,16 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.DiskCreationBinder;
import org.jclouds.googlecomputeengine.domain.Disk;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseDisks;
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
-import org.jclouds.googlecomputeengine.binders.DiskCreationBinder;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
@@ -145,7 +145,7 @@ public interface DiskApi {
@Path("/zones/{zone}/disks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDisks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Disk> listFirstPageInZone(@PathParam("zone") String zone);
/**
@@ -157,7 +157,7 @@ public interface DiskApi {
@Path("/zones/{zone}/disks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDisks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Disk> listAtMarkerInZone(@PathParam("zone") String zone, @QueryParam("pageToken") @Nullable String marker);
/**
@@ -178,7 +178,7 @@ public interface DiskApi {
@Path("/zones/{zone}/disks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDisks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Disk> listAtMarkerInZone(@PathParam("zone") String zone, @QueryParam("pageToken") @Nullable String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java
index b8dc906..ab72f4c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/DiskTypeApi.java
@@ -26,10 +26,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.DiskType;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.functions.internal.ParseDiskTypes;
@@ -75,7 +75,7 @@ public interface DiskTypeApi {
@Path("/zones/{zone}/diskTypes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDiskTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<DiskType> listFirstPageInZone(@PathParam("zone") String zone);
/**
@@ -86,7 +86,7 @@ public interface DiskTypeApi {
@Path("/zones/{zone}/diskType")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDiskTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<DiskType> listAtMarkerInZone(@PathParam("zone") String zone, @QueryParam("pageToken") @Nullable String marker);
/**
@@ -106,7 +106,7 @@ public interface DiskTypeApi {
@Path("/zones/{zone}/diskTypes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseDiskTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<DiskType> listAtMarkerInZone(@PathParam("zone") String zone,
@QueryParam("pageToken") @Nullable String marker,
ListOptions listOptions);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
index 33d2e41..1e161de 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/FirewallApi.java
@@ -33,16 +33,16 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.FirewallBinder;
import org.jclouds.googlecomputeengine.domain.Firewall;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.PATCH;
import org.jclouds.googlecomputeengine.functions.internal.ParseFirewalls;
-import org.jclouds.googlecomputeengine.binders.FirewallBinder;
import org.jclouds.googlecomputeengine.options.FirewallOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
@@ -157,7 +157,7 @@ public interface FirewallApi {
@Path("/global/firewalls")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseFirewalls.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Firewall> listFirstPage();
/**
@@ -169,7 +169,7 @@ public interface FirewallApi {
@Path("/global/firewalls")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseFirewalls.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Firewall> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
/**
@@ -189,7 +189,7 @@ public interface FirewallApi {
@Path("/global/firewalls")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseFirewalls.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Firewall> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions options);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
index baeed4f..2e8820c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ForwardingRuleApi.java
@@ -16,18 +16,32 @@
*/
package org.jclouds.googlecomputeengine.features;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+
import java.net.URI;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.ForwardingRuleCreationBinder;
import org.jclouds.googlecomputeengine.domain.ForwardingRule;
+import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseForwardingRules;
-import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
-import org.jclouds.googlecomputeengine.binders.ForwardingRuleCreationBinder;
+import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
@@ -40,19 +54,6 @@ import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.binders.BindToJsonPayload;
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-
/**
* Provides access to ForwardingRules via their REST API.
*/
@@ -128,8 +129,8 @@ public interface ForwardingRuleApi {
@Path("/forwardingRules")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseForwardingRules.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- IterableWithMarker<ForwardingRule> list(ListOptions options);
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
+ ListPage<ForwardingRule> list(ListOptions options);
/**
* Changes the target url for a forwarding rule.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
index 77a57b8..572af71 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/GlobalOperationApi.java
@@ -28,10 +28,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseGlobalOperations;
@@ -87,7 +87,7 @@ public interface GlobalOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseGlobalOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listFirstPage();
/**
@@ -99,7 +99,7 @@ public interface GlobalOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseGlobalOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
/**
@@ -119,7 +119,7 @@ public interface GlobalOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseGlobalOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarker(@QueryParam("pageToken") @Nullable String marker,
ListOptions listOptions);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
index d31c6d0..5974729 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/HttpHealthCheckApi.java
@@ -16,12 +16,27 @@
*/
package org.jclouds.googlecomputeengine.features;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
import org.jclouds.googlecomputeengine.binders.HttpHealthCheckCreationBinder;
import org.jclouds.googlecomputeengine.domain.HttpHealthCheck;
+import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseHttpHealthChecks;
import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
@@ -39,20 +54,6 @@ import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.binders.BindToJsonPayload;
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-
/**
* Provides access to HttpHealthChecks via their REST API.
*/
@@ -92,7 +93,7 @@ public interface HttpHealthCheckApi {
/**
* Creates a HttpHealthCheck resource in the specified project and region using the data included in the request.
*
- * @param httpHealthCheckName the name of the forwarding rule.
+ * @param name the name of the forwarding rule.
* @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.
*/
@@ -132,14 +133,14 @@ public interface HttpHealthCheckApi {
/**
* @param options @see org.jclouds.googlecomputeengine.options.ListOptions
- * @return IterableWithMarker
+ * @return ListPage
*/
@Named("HttpHealthChecks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseHttpHealthChecks.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- IterableWithMarker<HttpHealthCheck> list(ListOptions options);
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
+ ListPage<HttpHealthCheck> list(ListOptions options);
/**
* Updates a HttpHealthCheck resource in the specified project
@@ -156,7 +157,8 @@ public interface HttpHealthCheckApi {
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(HttpHealthCheckCreationBinder.class)
@Nullable
- Operation patch(@PathParam("httpHealthCheck") @PayloadParam("name") String name, @PayloadParam("options") HttpHealthCheckCreationOptions options);
+ Operation patch(@PathParam("httpHealthCheck") @PayloadParam("name") String name,
+ @PayloadParam("options") HttpHealthCheckCreationOptions options);
/**
* Updates a HttpHealthCheck resource in the specified project using the data included in the request.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
index deaf7dc..5521116 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ImageApi.java
@@ -30,10 +30,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.Image;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
@@ -97,7 +97,7 @@ public interface ImageApi {
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseImages.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Image> listFirstPage();
/**
@@ -109,7 +109,7 @@ public interface ImageApi {
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseImages.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Image> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
/**
@@ -129,7 +129,7 @@ public interface ImageApi {
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseImages.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Image> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
index 1585679..f5f033b 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/InstanceApi.java
@@ -20,7 +20,6 @@ import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPU
import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
import java.util.Map;
-import java.util.Set;
import javax.inject.Named;
import javax.ws.rs.Consumes;
@@ -33,17 +32,17 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.InstanceBinder;
+import org.jclouds.googlecomputeengine.binders.MetadataBinder;
import org.jclouds.googlecomputeengine.domain.Instance;
-import org.jclouds.googlecomputeengine.domain.InstanceTemplate;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
+import org.jclouds.googlecomputeengine.domain.templates.InstanceTemplate;
import org.jclouds.googlecomputeengine.functions.internal.ParseInstances;
-import org.jclouds.googlecomputeengine.binders.InstanceBinder;
-import org.jclouds.googlecomputeengine.binders.MetadataBinder;
import org.jclouds.googlecomputeengine.options.AttachDiskOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
@@ -135,7 +134,7 @@ public interface InstanceApi {
@Path("/zones/{zone}/instances")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseInstances.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Instance> listFirstPageInZone(@PathParam("zone") String zone);
/**
@@ -156,7 +155,7 @@ public interface InstanceApi {
@Path("/zones/{zone}/instances")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseInstances.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Instance> listAtMarkerInZone(@PathParam("zone") String zone, @Nullable String marker,
ListOptions listOptions);
@@ -169,7 +168,7 @@ public interface InstanceApi {
@Path("/zones/{zone}/instances")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseInstances.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Instance> listAtMarkerInZone(@PathParam("zone") String zone,
@Nullable String marker);
@@ -344,7 +343,7 @@ public interface InstanceApi {
@PayloadParam("fingerprint") String fingerprint);
/**
- * Sets items for an instance
+ * Lists items for an instance
*
* @param zone The zone the instance is in
* @param instanceName the name of the instance
@@ -362,7 +361,7 @@ public interface InstanceApi {
@MapBinder(BindToJsonPayload.class)
Operation setTagsInZone(@PathParam("zone") String zone,
@PathParam("instance") String instanceName,
- @PayloadParam("items") Set<String> items,
+ @PayloadParam("items") Iterable<String> items,
@PayloadParam("fingerprint") String fingerprint);
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
index 8977fbe..0c5df8c 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/MachineTypeApi.java
@@ -26,10 +26,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.MachineType;
import org.jclouds.googlecomputeengine.functions.internal.ParseMachineTypes;
@@ -73,7 +73,7 @@ public interface MachineTypeApi {
@Path("/zones/{zone}/machineTypes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseMachineTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<MachineType> listFirstPageInZone(@PathParam("zone") String zone);
/**
@@ -84,7 +84,7 @@ public interface MachineTypeApi {
@Path("/zones/{zone}/machineTypes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseMachineTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<MachineType> listAtMarkerInZone(@PathParam("zone") String zone, @QueryParam("pageToken") @Nullable String marker);
/**
@@ -104,7 +104,7 @@ public interface MachineTypeApi {
@Path("/zones/{zone}/machineTypes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseMachineTypes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<MachineType> listAtMarkerInZone(@PathParam("zone") String zone,
@QueryParam("pageToken") @Nullable String marker,
ListOptions listOptions);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
index bee6861..88ac001 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/NetworkApi.java
@@ -30,10 +30,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Network;
import org.jclouds.googlecomputeengine.domain.Operation;
@@ -134,7 +134,7 @@ public interface NetworkApi {
@Path("/global/networks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseNetworks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Network> listFirstPage();
/**
@@ -146,7 +146,7 @@ public interface NetworkApi {
@Path("/global/networks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseNetworks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Network> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
/**
@@ -166,7 +166,7 @@ public interface NetworkApi {
@Path("/global/networks")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseNetworks.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Network> listAtMarker(@QueryParam("pageToken") @Nullable String marker,
ListOptions options);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
index 59cb5a0..effbc83 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ProjectApi.java
@@ -31,9 +31,9 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.MetadataBinder;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Project;
-import org.jclouds.googlecomputeengine.binders.MetadataBinder;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
import org.jclouds.rest.annotations.Fallback;
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
index 5350151..ae760a0 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionApi.java
@@ -25,10 +25,10 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Region;
import org.jclouds.googlecomputeengine.functions.internal.ParseRegions;
@@ -70,7 +70,7 @@ public interface RegionApi {
@Path("/regions")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRegions.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Region> listFirstPage();
/**
@@ -81,7 +81,7 @@ public interface RegionApi {
@Path("/regions")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRegions.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Region> listAtMarker(String marker);
/**
@@ -100,7 +100,7 @@ public interface RegionApi {
@Path("/regions")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRegions.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Region> listAtMarker(String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
index 99cf162..9985483 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RegionOperationApi.java
@@ -28,10 +28,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseRegionOperations;
@@ -89,7 +89,7 @@ public interface RegionOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseRegionOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listFirstPageInRegion(@PathParam("region") String region);
/**
@@ -101,7 +101,7 @@ public interface RegionOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseRegionOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarkerInRegion(@PathParam("region") String region,
@QueryParam("pageToken") @Nullable String marker);
@@ -123,7 +123,7 @@ public interface RegionOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseRegionOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarkerInRegion(@PathParam("region") String region,
@QueryParam("pageToken") @Nullable String marker,
ListOptions listOptions);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
index 815ea8e..1d8b0eb 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/RouteApi.java
@@ -31,15 +31,15 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.RouteBinder;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Route;
import org.jclouds.googlecomputeengine.functions.internal.ParseRoutes;
-import org.jclouds.googlecomputeengine.binders.RouteBinder;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.RouteOptions;
import org.jclouds.javax.annotation.Nullable;
@@ -82,7 +82,7 @@ public interface RouteApi {
@Path("/global/routes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRoutes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Route> listFirstPage();
/**
@@ -93,7 +93,7 @@ public interface RouteApi {
@Path("/global/routes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRoutes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Route> listAtMarker(String marker);
/**
@@ -112,7 +112,7 @@ public interface RouteApi {
@Path("/global/routes")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseRoutes.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Route> listAtMarker(String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
index 06616e8..282ad07 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/SnapshotApi.java
@@ -28,10 +28,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Snapshot;
@@ -93,7 +93,7 @@ public interface SnapshotApi {
@Path("/global/snapshots")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseSnapshots.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Snapshot> listFirstPage();
/**
@@ -105,7 +105,7 @@ public interface SnapshotApi {
@Path("/global/snapshots")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseSnapshots.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Snapshot> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
/**
@@ -125,7 +125,7 @@ public interface SnapshotApi {
@Path("/global/snapshots")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseSnapshots.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Snapshot> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
index 09cf874..5725937 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetPoolApi.java
@@ -16,21 +16,36 @@
*/
package org.jclouds.googlecomputeengine.features;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
+import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+
import java.net.URI;
-import java.util.Set;
+import java.util.List;
+
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.IterableWithMarker;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
+import org.jclouds.googlecomputeengine.binders.TargetPoolChangeHealthChecksBinder;
+import org.jclouds.googlecomputeengine.binders.TargetPoolChangeInstancesBinder;
+import org.jclouds.googlecomputeengine.binders.TargetPoolCreationBinder;
+import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.TargetPool;
import org.jclouds.googlecomputeengine.functions.internal.ParseTargetPools;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
-import org.jclouds.googlecomputeengine.binders.TargetPoolChangeHealthChecksBinder;
-import org.jclouds.googlecomputeengine.binders.TargetPoolChangeInstancesBinder;
-import org.jclouds.googlecomputeengine.binders.TargetPoolCreationBinder;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
@@ -43,20 +58,6 @@ import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.binders.BindToJsonPayload;
-import javax.inject.Named;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
-
/**
* Provides access to TargetPools via their REST API.
*/
@@ -82,8 +83,8 @@ public interface TargetPoolApi {
/**
* Creates a TargetPool resource in the specified project and region using the data included in the request.
*
- * @param targetPoolName the name of the targetPool.
- * @param the options of the TargetPool to create.
+ * @param name the name of the targetPool.
+ * @param options options of the TargetPool 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.
*/
@@ -93,8 +94,7 @@ public interface TargetPoolApi {
@Path("/targetPools")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolCreationBinder.class)
- Operation create(@PayloadParam("name") String targetPoolName,
- @PayloadParam("options") TargetPoolCreationOptions targetPoolCreationOptions);
+ Operation create(@PayloadParam("name") String name, @PayloadParam("options") TargetPoolCreationOptions options);
/**
* Deletes the specified TargetPool resource.
@@ -126,15 +126,15 @@ public interface TargetPoolApi {
/**
* @param options @see org.jclouds.googlecomputeengine.options.ListOptions
- * @return IterableWithMarker
+ * @return ListPage
*/
@Named("TargetPools:list")
@GET
@Path("/targetPools")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseTargetPools.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- IterableWithMarker<TargetPool> list(ListOptions options);
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
+ ListPage<TargetPool> list(ListOptions options);
/**
* Adds instance to the targetPool.
@@ -151,7 +151,7 @@ public interface TargetPoolApi {
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeInstancesBinder.class)
@Nullable
- Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") Set<URI> instances);
+ Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
/**
* Removes instance URL from targetPool.
@@ -168,7 +168,7 @@ public interface TargetPoolApi {
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeInstancesBinder.class)
@Nullable
- Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") Set<URI> instances);
+ Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
/**
* Adds health check URL to targetPool.
@@ -185,7 +185,7 @@ public interface TargetPoolApi {
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
- Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") Set<URI> healthChecks);
+ Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
/**
@@ -203,7 +203,7 @@ public interface TargetPoolApi {
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
- Operation removeHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") Set<URI> healthChecks);
+ Operation removeHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
/**
@@ -243,5 +243,4 @@ public interface TargetPoolApi {
@MapBinder(BindToJsonPayload.class)
@Nullable
Operation setBackup(@PathParam("targetPool") String targetPool, @QueryParam("failoverRatio") Float failoverRatio, @PayloadParam("target") URI target);
-
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
index 32ef1ad..61293b2 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneApi.java
@@ -25,10 +25,10 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Zone;
import org.jclouds.googlecomputeengine.functions.internal.ParseZones;
@@ -70,7 +70,7 @@ public interface ZoneApi {
@Path("/zones")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseZones.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Zone> listFirstPage();
/**
@@ -81,7 +81,7 @@ public interface ZoneApi {
@Path("/zones")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseZones.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Zone> listAtMarker(String marker);
/**
@@ -100,7 +100,7 @@ public interface ZoneApi {
@Path("/zones")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@ResponseParser(ParseZones.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Zone> listAtMarker(String marker, ListOptions listOptions);
/**
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
index 44ff057..8d6a0d1 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/ZoneOperationApi.java
@@ -28,10 +28,10 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import org.jclouds.Fallbacks.EmptyIterableWithMarkerOnNotFoundOr404;
import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyListPageOnNotFoundOr404;
import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.functions.internal.ParseZoneOperations;
@@ -89,7 +89,7 @@ public interface ZoneOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseZoneOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listFirstPageInZone(@PathParam("zone") String zone);
/**
@@ -101,7 +101,7 @@ public interface ZoneOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseZoneOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarkerInZone(@PathParam("zone") String zone,
@QueryParam("pageToken") @Nullable String marker);
@@ -123,7 +123,7 @@ public interface ZoneOperationApi {
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(MediaType.APPLICATION_JSON)
@ResponseParser(ParseZoneOperations.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
+ @Fallback(EmptyListPageOnNotFoundOr404.class)
ListPage<Operation> listAtMarkerInZone(@PathParam("zone") String zone,
@QueryParam("pageToken") @Nullable String marker,
ListOptions listOptions);
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
deleted file mode 100644
index e6d4b11..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.functions;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.OPERATION_COMPLETE_INTERVAL;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.OPERATION_COMPLETE_TIMEOUT;
-import static org.jclouds.util.Predicates2.retry;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.compute.reference.ComputeServiceConstants;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.config.UserProject;
-import org.jclouds.googlecomputeengine.domain.Network;
-import org.jclouds.googlecomputeengine.domain.Operation;
-import org.jclouds.googlecomputeengine.domain.internal.NetworkAndAddressRange;
-import org.jclouds.logging.Logger;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.util.concurrent.Atomics;
-
-@Singleton
-public class CreateNetworkIfNeeded implements Function<NetworkAndAddressRange, Network> {
- @Resource
- @Named(ComputeServiceConstants.COMPUTE_LOGGER)
- protected Logger logger = Logger.NULL;
-
- protected final GoogleComputeEngineApi api;
- protected final Supplier<String> userProject;
- private final Predicate<AtomicReference<Operation>> operationDonePredicate;
- private final long operationCompleteCheckInterval;
- private final long operationCompleteCheckTimeout;
-
- @Inject
- public CreateNetworkIfNeeded(GoogleComputeEngineApi api,
- @UserProject Supplier<String> userProject,
- @Named("global") Predicate<AtomicReference<Operation>> operationDonePredicate,
- @Named(OPERATION_COMPLETE_INTERVAL) Long operationCompleteCheckInterval,
- @Named(OPERATION_COMPLETE_TIMEOUT) Long operationCompleteCheckTimeout) {
- this.api = checkNotNull(api, "api");
- this.userProject = checkNotNull(userProject, "userProject");
- this.operationCompleteCheckInterval = checkNotNull(operationCompleteCheckInterval,
- "operation completed check interval");
- this.operationCompleteCheckTimeout = checkNotNull(operationCompleteCheckTimeout,
- "operation completed check timeout");
- this.operationDonePredicate = checkNotNull(operationDonePredicate, "operationDonePredicate");
- }
-
- @Override
- public Network apply(NetworkAndAddressRange input) {
- checkNotNull(input, "input");
-
- Network nw = api.getNetworkApi(userProject.get()).get(input.getName());
- if (nw != null) {
- return nw;
- }
-
- if (input.getGateway().isPresent()) {
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(userProject
- .get()).createInIPv4RangeWithGateway(input.getName(), input.getIpV4Range(), input.getGateway().get()));
- retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
- MILLISECONDS).apply(operation);
-
- checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
- } else {
- AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApi(userProject
- .get()).createInIPv4Range(input.getName(), input.getIpV4Range()));
- retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
- MILLISECONDS).apply(operation);
-
- checkState(!operation.get().getHttpError().isPresent(), "Could not insert network, operation failed" + operation);
- }
- return checkNotNull(api.getNetworkApi(userProject.get()).get(input.getName()),
- "no network with name %s was found", input.getName());
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/b41b0d04/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToPagedIterable.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToPagedIterable.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToPagedIterable.java
index 588be0a..bf91986 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToPagedIterable.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToPagedIterable.java
@@ -20,6 +20,7 @@ import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.collect.Iterables.tryFind;
import org.jclouds.collect.IterableWithMarker;
+import org.jclouds.collect.IterableWithMarkers;
import org.jclouds.collect.PagedIterable;
import org.jclouds.collect.PagedIterables;
import org.jclouds.googlecomputeengine.domain.ListPage;
@@ -40,18 +41,20 @@ public abstract class BaseToPagedIterable<T, I extends BaseToPagedIterable<T, I>
@Override
public PagedIterable<T> apply(ListPage<T> input) {
- if (input.nextMarker() == null)
- return PagedIterables.of(input);
+ if (input.nextPageToken() == null) {
+ return PagedIterables.onlyPage(IterableWithMarkers.from(input));
+ }
Optional<Object> project = tryFind(request.getCaller().get().getArgs(), instanceOf(String.class));
Optional<Object> listOptions = tryFind(request.getInvocation().getArgs(), instanceOf(ListOptions.class));
- assert project.isPresent() : String.format("programming error, method %s should have a string param for the "
- + "project", request.getCaller().get().getInvokable());
+ assert project.isPresent() :
+ String.format("programming error, method %s should have a string param for the " + "project",
+ request.getCaller().get().getInvokable());
- return PagedIterables.advance(
- input, fetchNextPage(project.get().toString(), (ListOptions) listOptions.orNull()));
+ return PagedIterables.advance(IterableWithMarkers.from(input, input.nextPageToken()),
+ fetchNextPage(project.get().toString(), (ListOptions) listOptions.orNull()));
}
protected abstract Function<Object, IterableWithMarker<T>> fetchNextPage(String projectName,