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/20 02:39:39 UTC
[10/12] jclouds-labs-google git commit: l7 Cont: Removed ResourceView,
Converted to AutoValue and updated.
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
index e1d038c..abb0bf4 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/TargetHttpProxyApi.java
@@ -16,11 +16,10 @@
*/
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.Iterator;
+import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -32,39 +31,32 @@ 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.domain.ListPage;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecloud.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.TargetHttpProxy;
-import org.jclouds.googlecomputeengine.functions.internal.ParseTargetHttpProxies;
-import org.jclouds.googlecomputeengine.handlers.PayloadBinder;
+import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.TargetHttpProxyOptions;
import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.config.OAuthScopes;
-import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
+import org.jclouds.oauth.v2.filters.OAuthFilter;
+import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.binders.BindToJsonPayload;
-/**
- * Provides access to Target Http Proxies via their REST API.
- * <p/>
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/latest/targetHttpProxies"/>
- */
+import com.google.common.base.Function;
+
@SkipEncoding({'/', '='})
@Consumes(MediaType.APPLICATION_JSON)
-@RequestFilters(OAuthAuthenticator.class)
+@RequestFilters(OAuthFilter.class)
public interface TargetHttpProxyApi {
+
/**
* Returns the specified target http proxy resource.
*
@@ -74,16 +66,14 @@ public interface TargetHttpProxyApi {
@Named("TargetHttpProxys:get")
@GET
@Path("/global/targetHttpProxies/{targetHttpProxy}")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
TargetHttpProxy get(@PathParam("targetHttpProxy") String targetHttpProxyName);
/**
* Creates a TargetHttpProxy resource in the specified project using the data included in the request.
- *
- * @param name the name of the targetHttpProxy to be inserted.
* @param targetHttpProxyOptions the options of the targetHttpProxy to add.
+ *
* @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.
*/
@@ -91,11 +81,8 @@ public interface TargetHttpProxyApi {
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/global/targetHttpProxies")
- @OAuthScopes({COMPUTE_SCOPE})
- @MapBinder(PayloadBinder.class)
- Operation create(@PayloadParam("name") String name,
- @PayloadParam("options") TargetHttpProxyOptions targetHttpProxyOptions);
-
+ Operation create(@BinderParam(BindToJsonPayload.class) TargetHttpProxyOptions targetHttpProxyOptions);
+
/**
* Creates a targetHttpProxy resource in the specified project using the given URI for the urlMap.
*
@@ -108,7 +95,6 @@ public interface TargetHttpProxyApi {
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/global/targetHttpProxies")
- @OAuthScopes({COMPUTE_SCOPE})
@MapBinder(BindToJsonPayload.class)
Operation create(@PayloadParam("name") String name, @PayloadParam("urlMap") URI urlMap);
@@ -124,7 +110,6 @@ public interface TargetHttpProxyApi {
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("targetHttpProxies/{targetHttpProxy}/setUrlMap")
- @OAuthScopes({COMPUTE_SCOPE})
@MapBinder(BindToJsonPayload.class)
Operation setUrlMap(@PathParam("targetHttpProxy") String targetHttpProxyName,
@PayloadParam("urlMap") URI urlMap);
@@ -139,76 +124,51 @@ public interface TargetHttpProxyApi {
@Named("TargetHttpProxys:delete")
@DELETE
@Path("/global/targetHttpProxies/{targetHttpProxy}")
- @OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
Operation delete(@PathParam("targetHttpProxy") String targetHttpProxyName);
/**
- * @see TargetHttpProxyApi#list(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
- @Named("TargetHttpProxys:list")
- @GET
- @Path("/global/targetHttpProxies")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseTargetHttpProxies.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<TargetHttpProxy> listFirstPage();
-
- /**
- * @see TargetHttpProxyApi#list(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
- @Named("TargetHttpProxys:list")
- @GET
- @Path("/global/targetHttpProxies")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseTargetHttpProxies.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<TargetHttpProxy> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
-
- /**
* Retrieves the list of targetHttpProxy resources available to the specified project.
* By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
* been set.
*
- * @param marker marks the beginning of the next list page.
- * @param listOptions listing options.
- * @return a page of the list.
- * @see ListOptions
- * @see org.jclouds.googlecomputeengine.domain.ListPage
+ * @param pageToken marks the beginning of the next list page
+ * @param listOptions listing options
+ * @return a page of the list
*/
@Named("TargetHttpProxys:list")
@GET
@Path("/global/targetHttpProxies")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseTargetHttpProxies.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<TargetHttpProxy> list(@QueryParam("pageToken") @Nullable String marker, ListOptions options);
+ ListPage<TargetHttpProxy> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
- /**
- * @see TargetHttpProxyApi#list(org.jclouds.googlecomputeengine.options.ListOptions)
- */
+ /** @see #listPage(String, ListOptions) */
@Named("TargetHttpProxys:list")
@GET
@Path("/global/targetHttpProxies")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseTargetHttpProxies.class)
- @Transform(ParseTargetHttpProxies.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- PagedIterable<TargetHttpProxy> list();
+ @Transform(TargetHttpProxyPages.class)
+ Iterator<ListPage<TargetHttpProxy>> list();
- /**
- * A paged version of TargetHttpProxyApi#list().
- *
- * @return a Paged, Fluent Iterable that is able to fetch additional pages when required.
- * @see PagedIterable
- * @see TargetHttpProxyApi#list(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
+ /** @see #listPage(String, ListOptions) */
@Named("TargetHttpProxys:list")
@GET
@Path("/global/targetHttpProxies")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseTargetHttpProxies.class)
- @Transform(ParseTargetHttpProxies.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- PagedIterable<TargetHttpProxy> list(ListOptions options);
+ @Transform(TargetHttpProxyPages.class)
+ Iterator<ListPage<TargetHttpProxy>> list(ListOptions listOptions);
+
+ static final class TargetHttpProxyPages extends BaseToIteratorOfListPage<TargetHttpProxy, TargetHttpProxyPages> {
+
+ private final GoogleComputeEngineApi api;
+
+ @Inject TargetHttpProxyPages(GoogleComputeEngineApi api) {
+ this.api = api;
+ }
+
+ @Override protected Function<String, ListPage<TargetHttpProxy>> fetchNextPage(final ListOptions options) {
+ return new Function<String, ListPage<TargetHttpProxy>>() {
+ @Override public ListPage<TargetHttpProxy> apply(String pageToken) {
+ return api.targetHttpProxies().listPage(pageToken, options);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
index 41122e4..25783d2 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/features/UrlMapApi.java
@@ -16,11 +16,12 @@
*/
package org.jclouds.googlecomputeengine.features;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE;
-import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import java.net.URI;
+import java.util.Iterator;
+import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -31,74 +32,55 @@ 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.EmptyIterableWithMarkerOnNotFoundOr404;
-import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.collect.PagedIterable;
-import org.jclouds.googlecomputeengine.domain.ListPage;
+import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
+import org.jclouds.googlecloud.domain.ListPage;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.UrlMap;
import org.jclouds.googlecomputeengine.domain.UrlMapValidateResult;
-import org.jclouds.googlecomputeengine.functions.internal.PATCH;
-import org.jclouds.googlecomputeengine.functions.internal.ParseUrlMaps;
-import org.jclouds.googlecomputeengine.handlers.PayloadBinder;
+import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.UrlMapOptions;
import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.oauth.v2.config.OAuthScopes;
-import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
+import org.jclouds.oauth.v2.filters.OAuthFilter;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
+import org.jclouds.rest.annotations.PATCH;
import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
import org.jclouds.rest.annotations.SkipEncoding;
import org.jclouds.rest.annotations.Transform;
import org.jclouds.rest.binders.BindToJsonPayload;
-/**
- * Provides access to UrlMaps via their REST API.
- * <p/>
- *
- * @see <a href="https://developers.google.com/compute/docs/reference/latest/urlMaps"/>
- */
+import com.google.common.base.Function;
+
@SkipEncoding({'/', '='})
-@RequestFilters(OAuthAuthenticator.class)
-@Consumes(MediaType.APPLICATION_JSON)
+@RequestFilters(OAuthFilter.class)
+@Consumes(APPLICATION_JSON)
public interface UrlMapApi {
- /**
- * Returns the specified urlMap resource.
- *
- * @param urlMapName name of the urlMap resource to return.
- * @return an UrlMap resource.
- */
+
+ /** Returns the specified urlMap resource by name or null if not found. */
@Named("UrlMaps:get")
@GET
- @Path("/global/urlMaps/{urlMap}")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
+ @Path("/{urlMap}")
@Fallback(NullOnNotFoundOr404.class)
@Nullable
UrlMap get(@PathParam("urlMap") String urlMapName);
/**
* Creates a urlMap resource in the specified project using the data included in the request.
- *
- * @param name the name of the urlMap to be inserted.
* @param urlMapOptions the options of the urlMap to add.
+ *
* @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to
* you, and look for the status field.
*/
@Named("UrlMaps:insert")
@POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/global/urlMaps")
- @OAuthScopes({COMPUTE_SCOPE})
- @MapBinder(PayloadBinder.class)
- Operation create(@PayloadParam("name") String name, @PayloadParam("options") UrlMapOptions urlMapOptions);
-
+ @Produces(APPLICATION_JSON)
+ Operation create(@BinderParam(BindToJsonPayload.class) UrlMapOptions urlMapOptions);
+
/**
* Creates a urlMap resource in the specified project using the data included in the request.
*
@@ -109,9 +91,7 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:insert")
@POST
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/global/urlMaps")
- @OAuthScopes({COMPUTE_SCOPE})
+ @Produces(APPLICATION_JSON)
@MapBinder(BindToJsonPayload.class)
Operation create(@PayloadParam("name") String name,
@PayloadParam("defaultService") URI defaultService);
@@ -126,9 +106,8 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:update")
@PUT
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/global/urlMaps/{urlMap}")
- @OAuthScopes({COMPUTE_SCOPE})
+ @Produces(APPLICATION_JSON)
+ @Path("/{urlMap}")
Operation update(@PathParam("urlMap") String urlMapName,
@BinderParam(BindToJsonPayload.class) UrlMapOptions urlMapOptions);
@@ -142,9 +121,8 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:patch")
@PATCH
- @Produces(MediaType.APPLICATION_JSON)
- @Path("/global/urlMaps/{urlMap}")
- @OAuthScopes({COMPUTE_SCOPE})
+ @Produces(APPLICATION_JSON)
+ @Path("/{urlMap}")
Operation patch(@PathParam("urlMap") String urlMapName,
@BinderParam(BindToJsonPayload.class) UrlMapOptions urlMapOptions);
@@ -157,11 +135,10 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:delete")
@DELETE
- @Path("/global/urlMaps/{urlMap}")
- @OAuthScopes(COMPUTE_SCOPE)
+ @Path("/{urlMap}")
@Fallback(NullOnNotFoundOr404.class)
Operation delete(@PathParam("urlMap") String urlMapName);
-
+
/**
* Runs the tests specified for the give urlMap resource.
*
@@ -171,14 +148,13 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:validate")
@POST
- @Path("/global/urlMaps/{urlMap}/validate")
- @OAuthScopes(COMPUTE_SCOPE)
+ @Path("/{urlMap}/validate")
@Fallback(NullOnNotFoundOr404.class)
@Nullable
@MapBinder(BindToJsonPayload.class)
UrlMapValidateResult validate(@PathParam("urlMap") String urlMapName,
@PayloadParam("resource") UrlMapOptions options);
-
+
/**
* Runs the tests specified for the give urlMap resource.
*
@@ -188,8 +164,7 @@ public interface UrlMapApi {
*/
@Named("UrlMaps:validate")
@POST
- @Path("/global/urlMaps/{urlMap}/validate")
- @OAuthScopes(COMPUTE_SCOPE)
+ @Path("/{urlMap}/validate")
@Fallback(NullOnNotFoundOr404.class)
@Nullable
@MapBinder(BindToJsonPayload.class)
@@ -197,71 +172,44 @@ public interface UrlMapApi {
@PayloadParam("resource") UrlMap urlMap);
/**
- * @see UrlMapApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
- @Named("UrlMaps:list")
- @GET
- @Path("/global/urlMaps")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseUrlMaps.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<UrlMap> listFirstPage();
-
- /**
- * @see UrlMapApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
- @Named("UrlMaps:list")
- @GET
- @Path("/global/urlMaps")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseUrlMaps.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<UrlMap> listAtMarker(@QueryParam("pageToken") @Nullable String marker);
-
- /**
* Retrieves the list of urlMap resources available to the specified project.
* By default the list as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has not
* been set.
*
- * @param marker marks the beginning of the next list page.
- * @param listOptions listing options.
- * @return a page of the list.
- * @see ListOptions
- * @see org.jclouds.googlecomputeengine.domain.ListPage
+ * @param pageToken marks the beginning of the next list page
+ * @param listOptions listing options
+ * @return a page of the list
*/
@Named("UrlMaps:list")
@GET
- @Path("/global/urlMaps")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseUrlMaps.class)
- @Fallback(EmptyIterableWithMarkerOnNotFoundOr404.class)
- ListPage<UrlMap> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions options);
+ ListPage<UrlMap> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
- /**
- * @see UrlMapApi#list(org.jclouds.googlecomputeengine.options.ListOptions)
- */
+ /** @see #listPage(String, String, ListOptions) */
@Named("UrlMaps:list")
@GET
- @Path("/global/urlMaps")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseUrlMaps.class)
- @Transform(ParseUrlMaps.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- PagedIterable<UrlMap> list();
+ @Transform(UrlMapPages.class)
+ Iterator<ListPage<UrlMap>> list();
- /**
- * A paged version of UrlMapApi#list().
- *
- * @return a Paged, Fluent Iterable that is able to fetch additional pages when required.
- * @see PagedIterable
- * @see UrlMapApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions)
- */
+ /** @see #listPage(String, String, ListOptions) */
@Named("UrlMaps:list")
@GET
- @Path("/global/urlMaps")
- @OAuthScopes(COMPUTE_READONLY_SCOPE)
- @ResponseParser(ParseUrlMaps.class)
- @Transform(ParseUrlMaps.ToPagedIterable.class)
- @Fallback(EmptyPagedIterableOnNotFoundOr404.class)
- PagedIterable<UrlMap> list(ListOptions options);
+ @Transform(UrlMapPages.class)
+ Iterator<ListPage<UrlMap>> list(ListOptions options);
+
+ static final class UrlMapPages extends BaseToIteratorOfListPage<UrlMap, UrlMapPages> {
+
+ private final GoogleComputeEngineApi api;
+
+ @Inject UrlMapPages(GoogleComputeEngineApi api) {
+ this.api = api;
+ }
+
+ @Override protected Function<String, ListPage<UrlMap>> fetchNextPage(final ListOptions options) {
+ return new Function<String, ListPage<UrlMap>>() {
+ @Override public ListPage<UrlMap> apply(String pageToken) {
+ return api.urlMaps().listPage(pageToken, options);
+ }
+ };
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionAndNameToPagedIterable.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionAndNameToPagedIterable.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionAndNameToPagedIterable.java
deleted file mode 100644
index 4018a5f..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionAndNameToPagedIterable.java
+++ /dev/null
@@ -1,83 +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.internal;
-
-import static com.google.common.base.Optional.fromNullable;
-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.PagedIterable;
-import org.jclouds.collect.PagedIterables;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-
-@Beta
-public abstract class BaseWithRegionAndNameToPagedIterable<T, I extends BaseWithRegionAndNameToPagedIterable<T, I>>
- implements Function<ListPage<T>, PagedIterable<T>>, InvocationContext<I> {
-
- private GeneratedHttpRequest request;
-
- @Override
- public PagedIterable<T> apply(ListPage<T> input) {
- if (input.nextMarker() == null)
- return PagedIterables.of(input);
-
- Optional<Object> project = tryFind(request.getCaller().get().getArgs(),
- instanceOf(String.class));
-
- Optional<Object> region = fromNullable(Iterables.get(request.getInvocation().getArgs(),
- 0, null));
-
- Optional<Object> name = fromNullable(Iterables.get(request.getInvocation().getArgs(),
- 1, null));
-
- 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 region.isPresent() : String.format("programming error, method %s should have a string param for the "
- + "zone", request.getCaller().get().getInvokable());
-
- return PagedIterables.advance(
- input, fetchNextPage(project.get().toString(),
- region.get().toString(), name.get().toString(),
- (ListOptions) listOptions.orNull()));
- }
-
- protected abstract Function<Object, IterableWithMarker<T>> fetchNextPage(String projectName,
- String regionName,
- String name,
- ListOptions listOptions);
-
- @SuppressWarnings("unchecked")
- @Override
- public I setContext(HttpRequest request) {
- this.request = GeneratedHttpRequest.class.cast(request);
- return (I) this;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneAndNameToPagedIterable.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneAndNameToPagedIterable.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneAndNameToPagedIterable.java
deleted file mode 100644
index d3c67ec..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneAndNameToPagedIterable.java
+++ /dev/null
@@ -1,83 +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.internal;
-
-import static com.google.common.base.Optional.fromNullable;
-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.PagedIterable;
-import org.jclouds.collect.PagedIterables;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.InvocationContext;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.collect.Iterables;
-
-@Beta
-public abstract class BaseWithZoneAndNameToPagedIterable<T, I extends BaseWithZoneAndNameToPagedIterable<T, I>>
- implements Function<ListPage<T>, PagedIterable<T>>, InvocationContext<I> {
-
- private GeneratedHttpRequest request;
-
- @Override
- public PagedIterable<T> apply(ListPage<T> input) {
- if (input.nextMarker() == null)
- return PagedIterables.of(input);
-
- Optional<Object> project = tryFind(request.getCaller().get().getArgs(),
- instanceOf(String.class));
-
- Optional<Object> zone = fromNullable(Iterables.get(request.getInvocation().getArgs(),
- 0, null));
-
- Optional<Object> name = fromNullable(Iterables.get(request.getInvocation().getArgs(),
- 1, null));
-
- 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 zone.isPresent() : String.format("programming error, method %s should have a string param for the "
- + "zone", request.getCaller().get().getInvokable());
-
- return PagedIterables.advance(
- input, fetchNextPage(project.get().toString(), zone.get().toString(),
- name.get().toString(),
- (ListOptions) listOptions.orNull()));
- }
-
- protected abstract Function<Object, IterableWithMarker<T>> fetchNextPage(String projectName,
- String zoneName,
- String name,
- ListOptions listOptions);
-
- @SuppressWarnings("unchecked")
- @Override
- public I setContext(HttpRequest request) {
- this.request = GeneratedHttpRequest.class.cast(request);
- return (I) this;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseBackendServices.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseBackendServices.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseBackendServices.java
deleted file mode 100644
index 52172e3..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseBackendServices.java
+++ /dev/null
@@ -1,63 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.BackendService;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-public class ParseBackendServices extends ParseJson<ListPage<BackendService>> {
-
- @Inject
- public ParseBackendServices(Json json) {
- super(json, new TypeLiteral<ListPage<BackendService>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseToPagedIterable<BackendService, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<BackendService>> fetchNextPage(final String projectName,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<BackendService>>() {
-
- @Override
- public IterableWithMarker<BackendService> apply(Object input) {
- return api.getBackendServiceApiForProject(projectName).listAtMarker(input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViewMembers.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViewMembers.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViewMembers.java
deleted file mode 100644
index c14ac44..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViewMembers.java
+++ /dev/null
@@ -1,69 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-@Singleton
-public class ParseRegionResourceViewMembers extends ParseJson<ListPage<URI>> {
-
- @Inject
- public ParseRegionResourceViewMembers(Json json) {
- super(json, new TypeLiteral<ListPage<URI>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseWithRegionAndNameToPagedIterable<URI, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<URI>> fetchNextPage(final String projectName,
- final String regionName,
- final String name,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<URI>>() {
-
- @Override
- public IterableWithMarker<URI> apply(Object input) {
- return api.getResourceViewApiForProject(projectName)
- .listResourcesAtMarkerInRegion(regionName, name, input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViews.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViews.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViews.java
deleted file mode 100644
index 778b5c3..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionResourceViews.java
+++ /dev/null
@@ -1,67 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.ResourceView;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-@Singleton
-public class ParseRegionResourceViews extends ParseJson<ListPage<ResourceView>> {
-
- @Inject
- public ParseRegionResourceViews(Json json) {
- super(json, new TypeLiteral<ListPage<ResourceView>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseWithRegionToPagedIterable<ResourceView, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<ResourceView>> fetchNextPage(final String projectName,
- final String regionName,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<ResourceView>>() {
-
- @Override
- public IterableWithMarker<ResourceView> apply(Object input) {
- return api.getResourceViewApiForProject(projectName)
- .listAtMarkerInRegion(regionName, input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetHttpProxies.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetHttpProxies.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetHttpProxies.java
deleted file mode 100644
index 62537e9..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseTargetHttpProxies.java
+++ /dev/null
@@ -1,63 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.domain.TargetHttpProxy;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-public class ParseTargetHttpProxies extends ParseJson<ListPage<TargetHttpProxy>> {
-
- @Inject
- public ParseTargetHttpProxies(Json json) {
- super(json, new TypeLiteral<ListPage<TargetHttpProxy>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseToPagedIterable<TargetHttpProxy, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<TargetHttpProxy>> fetchNextPage(final String projectName,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<TargetHttpProxy>>() {
-
- @Override
- public IterableWithMarker<TargetHttpProxy> apply(Object input) {
- return api.getTargetHttpProxyApiForProject(projectName).list(input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseUrlMaps.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseUrlMaps.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseUrlMaps.java
deleted file mode 100644
index dc9e5ca..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseUrlMaps.java
+++ /dev/null
@@ -1,63 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.UrlMap;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-public class ParseUrlMaps extends ParseJson<ListPage<UrlMap>> {
-
- @Inject
- public ParseUrlMaps(Json json) {
- super(json, new TypeLiteral<ListPage<UrlMap>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseToPagedIterable<UrlMap, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<UrlMap>> fetchNextPage(final String projectName,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<UrlMap>>() {
-
- @Override
- public IterableWithMarker<UrlMap> apply(Object input) {
- return api.getUrlMapApiForProject(projectName).listAtMarker(input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViewMembers.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViewMembers.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViewMembers.java
deleted file mode 100644
index 230bfe8..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViewMembers.java
+++ /dev/null
@@ -1,70 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-@Singleton
-public class ParseZoneResourceViewMembers extends ParseJson<ListPage<URI>> {
-
- @Inject
- public ParseZoneResourceViewMembers(Json json) {
- super(json, new TypeLiteral<ListPage<URI>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseWithZoneAndNameToPagedIterable<URI, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<URI>> fetchNextPage(final String projectName,
- final String zoneName,
- final String name,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<URI>>() {
-
- @Override
- public IterableWithMarker<URI> apply(Object input) {
- return api.getResourceViewApiForProject(projectName)
- .listResourcesAtMarkerInZone(zoneName, name,
- input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViews.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViews.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViews.java
deleted file mode 100644
index 8fb3433..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseZoneResourceViews.java
+++ /dev/null
@@ -1,67 +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.internal;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.collect.IterableWithMarker;
-import org.jclouds.googlecomputeengine.GoogleComputeEngineApi;
-import org.jclouds.googlecomputeengine.domain.ResourceView;
-import org.jclouds.googlecomputeengine.domain.ListPage;
-import org.jclouds.googlecomputeengine.options.ListOptions;
-import org.jclouds.http.functions.ParseJson;
-import org.jclouds.json.Json;
-
-import com.google.common.base.Function;
-import com.google.inject.TypeLiteral;
-
-@Singleton
-public class ParseZoneResourceViews extends ParseJson<ListPage<ResourceView>> {
-
- @Inject
- public ParseZoneResourceViews(Json json) {
- super(json, new TypeLiteral<ListPage<ResourceView>>() {
- });
- }
-
- public static class ToPagedIterable extends BaseWithZoneToPagedIterable<ResourceView, ToPagedIterable> {
-
- private final GoogleComputeEngineApi api;
-
- @Inject
- protected ToPagedIterable(GoogleComputeEngineApi api) {
- this.api = checkNotNull(api, "api");
- }
-
- @Override
- protected Function<Object, IterableWithMarker<ResourceView>> fetchNextPage(final String projectName,
- final String zoneName,
- final ListOptions options) {
- return new Function<Object, IterableWithMarker<ResourceView>>() {
-
- @Override
- public IterableWithMarker<ResourceView> apply(Object input) {
- return api.getResourceViewApiForProject(projectName)
- .listAtMarkerInZone(zoneName, input.toString(), options);
- }
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/PayloadBinder.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/PayloadBinder.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/PayloadBinder.java
deleted file mode 100644
index 46b8476..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/PayloadBinder.java
+++ /dev/null
@@ -1,56 +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.handlers;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.googlecomputeengine.options.ResourceOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.MapBinder;
-import org.jclouds.rest.binders.BindToJsonPayload;
-
-public class PayloadBinder implements MapBinder {
-
- @Inject
- private BindToJsonPayload jsonBinder;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) {
- ResourceOptions options = (ResourceOptions) checkNotNull(postParams.get("options"), "options");
- String name = (String) checkNotNull(postParams.get("name"), "name");
- // Set the name field in the options object to the one that was passed in as part of the url.
- // This ensures that a resource at url .../<resource type>/<some name> does not have its name
- // field set to something different than what is in the url.
- options.name(name);
- return bindToRequest(request, options);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- return jsonBinder.bindToRequest(request, input);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
index 0ed2d02..6a2e82f 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/BackendServiceOptions.java
@@ -16,106 +16,96 @@
*/
package org.jclouds.googlecomputeengine.options;
-import static com.google.common.base.Objects.equal;
-
import java.net.URI;
-import java.util.Set;
+import java.util.List;
import org.jclouds.googlecomputeengine.domain.BackendService.Backend;
+import org.jclouds.javax.annotation.Nullable;
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableSet;
+public class BackendServiceOptions {
-/**
- * Options to create a backend service resource.
- *
- * @see org.jclouds.googlecomputeengine.domain.BackendService
- */
-public class BackendServiceOptions extends ResourceOptions {
-
- private ImmutableSet.Builder<URI> healthChecks = ImmutableSet.builder();
- private ImmutableSet.Builder<Backend> backends = ImmutableSet.builder();
+ private String name;
+ @Nullable private String description;
+ private List<URI> healthChecks;
+ private List<Backend> backends;
private Integer timeoutSec;
private Integer port;
private String protocol;
private String fingerprint;
-
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getBackends()
+ * Name of the BackendService resource.
+ * @return name, provided by the client.
*/
- public Set<Backend> getBackends() {
- return backends.build();
+ public String getName(){
+ return name;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getBackends()
+ * @see BackendServiceOptions#getName()
*/
- public BackendServiceOptions addBackend(Backend backend) {
- this.backends.add(backend);
+ public BackendServiceOptions name(String name) {
+ this.name = name;
return this;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getBackends()
+ * An optional textual description of the BackendService.
+ * @return description, provided by the client.
*/
- public BackendServiceOptions backends(Set<Backend> backends) {
- this.backends = ImmutableSet.builder();
- this.backends.addAll(backends);
- return this;
+ public String getDescription(){
+ return description;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getName()
+ * @see BackendServiceOptions#getDescription()
*/
- @Override
- public BackendServiceOptions name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getDescription()
- */
- @Override
public BackendServiceOptions description(String description) {
this.description = description;
return this;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getHealthChecks()
+ * The list of {@link HttpHealthCheck#selfLink Links} to the HttpHealthCheck resource for health checking this BackendService.
+ * Currently at most one health check can be specified, and a health check is required.
*/
- public Set<URI> getHealthChecks() {
- return healthChecks.build();
+ public List<URI> getHealthChecks() {
+ return healthChecks;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getHealthChecks()
+ * @see BackendServiceOptions#getHealthChecks()
*/
- public BackendServiceOptions addHealthCheck(URI healthCheck) {
- this.healthChecks.add(healthCheck);
+ public BackendServiceOptions healthChecks(List<URI> healthChecks) {
+ this.healthChecks = healthChecks;
return this;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getHealthChecks()
+ * The list of backends that serve this BackendService.
+ */
+ public List<Backend> getBackends() {
+ return backends;
+ }
+
+ /**
+ * @see BackendServiceOptions#getBackends()
*/
- public BackendServiceOptions healthChecks(Set<URI> healthChecks) {
- this.healthChecks = ImmutableSet.builder();
- this.healthChecks.addAll(healthChecks);
+ public BackendServiceOptions backends(List<Backend> backends){
+ this.backends = backends;
return this;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getTimeoutSec()
+ * How many seconds to wait for the backend before considering it a failed request.
+ * Default is 30 seconds.
*/
public Integer getTimeoutSec() {
return timeoutSec;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getTimeoutSec()
+ * @see BackendServiceOptions#getTimeoutSec()
*/
public BackendServiceOptions timeoutSec(Integer timeoutSec) {
this.timeoutSec = timeoutSec;
@@ -123,94 +113,52 @@ public class BackendServiceOptions extends ResourceOptions {
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getPort()
+ * The TCP port to connect on the backend.
+ * The default value is 80.
*/
public Integer getPort() {
return port;
}
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getPort()
+ * @see BackendServiceOptions#getPort()
*/
public BackendServiceOptions port(Integer port) {
this.port = port;
return this;
}
+
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getProtocol()
+ * The protocol for incoming requests.
*/
public String getProtocol() {
return protocol;
}
-
+
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getProtocol()
+ * @see BackendServiceOptions#getProtocol()
*/
public BackendServiceOptions protocol(String protocol) {
this.protocol = protocol;
return this;
}
-
+
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getFingerprint()
+ * Fingerprint of this resource. A hash of the contents stored in this object.
+ * This field is used in optimistic locking. This field will be ignored when
+ * inserting a BackendService. An up-to-date fingerprint must be provided in
+ * order to update the BackendService.
*/
public String getFingerprint() {
return fingerprint;
}
-
+
/**
- * @see org.jclouds.googlecomputeengine.domain.BackendService#getFingerprint()
+ * @see BackendServiceOptions#getFingerprint()
*/
public BackendServiceOptions fingerprint(String fingerprint) {
this.fingerprint = fingerprint;
return this;
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return Objects.hashCode(name, backends, healthChecks, timeoutSec,
- port, protocol);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- BackendServiceOptions that = BackendServiceOptions.class.cast(obj);
- return equal(this.name, that.name)
- && equal(this.backends, that.backends)
- && equal(this.healthChecks, that.healthChecks)
- && equal(this.timeoutSec, that.timeoutSec)
- && equal(this.port, that.port)
- && equal(this.protocol, that.protocol);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Objects.ToStringHelper string() {
- return super.string()
- .omitNullValues()
- .add("backends", backends)
- .add("healthChecks", healthChecks)
- .add("timeoutSec", timeoutSec)
- .add("port", port)
- .add("protocol", protocol)
- .add("fingerprint", fingerprint);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleOptions.java
deleted file mode 100644
index b68a000..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ForwardingRuleOptions.java
+++ /dev/null
@@ -1,176 +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.options;
-
-import static com.google.common.base.Objects.equal;
-
-import java.net.URI;
-
-import com.google.common.base.Objects;
-
-/**
- * Options to create a forwarding rule resource.
- *
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule
- */
-public class ForwardingRuleOptions extends ResourceOptions {
-
- private String region;
- private String ipAddress;
- private String ipProtocol;
- private String portRange;
- private URI target;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ForwardingRuleOptions name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ForwardingRuleOptions description(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getRegion()
- */
- public String getRegion() {
- return region;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getRegion()
- */
- public ForwardingRuleOptions region(String region) {
- this.region = region;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpAddress()
- */
- public String getIpAddress() {
- return ipAddress;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpAddress()
- */
- public ForwardingRuleOptions ipAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpProtocol()
- */
- public String getIpProtocol() {
- return ipProtocol;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getIpProtocol()
- */
- public ForwardingRuleOptions ipProtocol(String ipProtocol) {
- this.ipProtocol = ipProtocol;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getPortRange()
- */
- public String getPortRange() {
- return portRange;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getPortRange()
- */
- public ForwardingRuleOptions portRange(String portRange) {
- this.portRange = portRange;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getTarget()
- */
- public URI getTarget() {
- return target;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ForwardingRule#getTarget()
- */
- public ForwardingRuleOptions target(URI target) {
- this.target = target;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return Objects.hashCode(name, region, ipAddress, ipProtocol, portRange,
- target);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ForwardingRuleOptions that = ForwardingRuleOptions.class.cast(obj);
- return equal(this.name, that.name)
- && equal(this.region, that.region)
- && equal(this.ipAddress, that.ipAddress)
- && equal(this.ipProtocol, that.ipProtocol)
- && equal(this.portRange, that.portRange)
- && equal(this.target, that.target);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Objects.ToStringHelper string() {
- return super.string()
- .omitNullValues()
- .add("region", region)
- .add("ipAddress", ipAddress)
- .add("ipProtocol", ipProtocol)
- .add("portRange", portRange)
- .add("target", target);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceOptions.java
deleted file mode 100644
index 29cae0c..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceOptions.java
+++ /dev/null
@@ -1,69 +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.options;
-
-import static com.google.common.base.Objects.toStringHelper;
-
-import com.google.common.base.Objects;
-
-public abstract class ResourceOptions {
-
- protected String name;
- protected String description;
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getName()
- */
- public abstract ResourceOptions name(String name);
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getDescription()
- */
- public abstract ResourceOptions description(String description);
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.Resource#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * {@inheritDoc}
- */
- protected Objects.ToStringHelper string() {
- return toStringHelper(this)
- .omitNullValues()
- .add("name", name)
- .add("description", description);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceViewOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceViewOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceViewOptions.java
deleted file mode 100644
index 43fc5d7..0000000
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/ResourceViewOptions.java
+++ /dev/null
@@ -1,149 +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.options;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.net.URI;
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Options to create a resource view.
- *
- * @see org.jclouds.googlecomputeengine.domain.ResourceView
- */
-public class ResourceViewOptions extends ResourceOptions {
-
- private ImmutableSet.Builder<URI> members = ImmutableSet.<URI>builder();
- private String region;
- private String zone;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ResourceViewOptions name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ResourceViewOptions description(String description) {
- this.description = description;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getMembers()
- */
- public Set<URI> getMembers() {
- return members.build();
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getMembers()
- */
- public ResourceViewOptions addMember(URI member) {
- this.members.add(checkNotNull(member));
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getMembers()
- */
- public ResourceViewOptions members(Set<URI> members) {
- this.members = ImmutableSet.builder();
- this.members.addAll(members);
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getRegion()
- */
- public ResourceViewOptions region(String region) {
- this.region = region;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getRegion()
- */
- public String getRegion() {
- return region;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getZone()
- */
- public ResourceViewOptions zone(String zone) {
- this.zone = zone;
- return this;
- }
-
- /**
- * @see org.jclouds.googlecomputeengine.domain.ResourceView#getZone()
- */
- public String getZone() {
- return zone;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return Objects.hashCode(name, members, zone, region);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ResourceViewOptions that = ResourceViewOptions.class.cast(obj);
- return equal(this.name, that.name)
- && equal(this.members, that.members)
- && equal(this.zone, that.zone)
- && equal(this.region, that.region);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Objects.ToStringHelper string() {
- return super.string()
- .omitNullValues()
- .add("memebers", members);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d147afdc/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
----------------------------------------------------------------------
diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
index 280acca..94dd75a 100644
--- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
+++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/options/TargetHttpProxyOptions.java
@@ -16,88 +16,60 @@
*/
package org.jclouds.googlecomputeengine.options;
-import static com.google.common.base.Objects.equal;
-
import java.net.URI;
-import com.google.common.base.Objects;
+import org.jclouds.javax.annotation.Nullable;
-/**
- * Options to create a target http proxy.
- *
- * @see org.jclouds.googlecomputeengine.domain.TargetHttpProxy
- */
-public final class TargetHttpProxyOptions extends ResourceOptions {
+public final class TargetHttpProxyOptions {
+ private String name;
+ @Nullable private String description;
private URI urlMap;
-
+
+ /**
+ * Name of the TargetHttpProxy resource.
+ * @return name, provided by the client.
+ */
+ public String getName(){
+ return name;
+ }
+
/**
- * {@inheritDoc}
+ * @see TargetHttpProxyOptions#getName()
*/
- @Override
public TargetHttpProxyOptions name(String name) {
this.name = name;
return this;
}
/**
- * {@inheritDoc}
+ * An optional textual description of the TargetHttpProxy.
+ * @return description, provided by the client.
+ */
+ public String getDescription(){
+ return description;
+ }
+
+ /**
+ * @see TargetHttpProxyOptions#getDescription()
*/
- @Override
public TargetHttpProxyOptions description(String description) {
this.description = description;
return this;
}
-
+
/**
- * @see org.jclouds.googlecomputeengine.domain.TargetHttpProxy#getUrlMap()
+ * URL to the UrlMap resource that defines the mapping from URL to the BackendService.
*/
public URI getUrlMap() {
return urlMap;
}
-
+
/**
- * @see org.jclouds.googlecomputeengine.domain.TargetHttpProxy#getUrlMap()
+ * @see TargetHttpProxyOptions#getUrlMap()
*/
public TargetHttpProxyOptions urlMap(URI urlMap) {
this.urlMap = urlMap;
return this;
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return Objects.hashCode(name, urlMap);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- TargetHttpProxyOptions that = TargetHttpProxyOptions.class.cast(obj);
- return equal(this.name, that.name)
- && equal(this.urlMap, that.urlMap);
- }
-
- /**
- * {@inheritDoc}
- */
- protected Objects.ToStringHelper string() {
- return super.string()
- .omitNullValues()
- .add("urlMap", urlMap);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return string().toString();
- }
}