http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 2b4562a..2b1340c 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -30,7 +31,6 @@ 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.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -52,73 +52,66 @@ import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; import org.jclouds.rest.binders.BindToJsonPayload; -/** - * Provides access to Images via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/images") +@Consumes(APPLICATION_JSON) public interface ImageApi { - /** - * Returns the specified image resource. - * - * @param imageName name of the image resource to return. - * @return an Image resource - */ + + /** Returns an image by name or null if not found. */ @Named("Images:get") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/images/{image}") + @Path("/{image}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable - Image get(@PathParam("image") String imageName); + Image get(@PathParam("image") String image); - /** - * Deletes the specified image resource. - * - * @param imageName name of the image resource to delete. - * @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. If the image did not exist the result is null. - */ + /** Deletes an image by name and returns the operation in progress, or null if not found. */ @Named("Images:delete") @DELETE - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/images/{image}") + @Path("/{image}") @OAuthScopes(COMPUTE_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable - Operation delete(@PathParam("image") String imageName); + Operation delete(@PathParam("image") String image); + + /** + * Creates an image resource in the specified project from the provided persistent disk. + * + * @param image the name of the created image + * @param sourceDisk fully qualified URL for the persistent disk to create the image from + * @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("Images:insert") + @POST + @Produces(APPLICATION_JSON) + @OAuthScopes(COMPUTE_SCOPE) + @MapBinder(BindToJsonPayload.class) + Operation createFromDisk(@PayloadParam("name") String image, @PayloadParam("sourceDisk") String sourceDisk); /** * Retrieves the list of image 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 token 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 */ @Named("Images:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/images") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseImages.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Image> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions listOptions); + ListPage<Image> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * A paged version of ImageApi#list() - * - * @return an Iterator that is able to fetch additional pages when required - * @see ImageApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Images:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/images") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseImages.class) @Transform(ParseImages.ToIteratorOfListPage.class) @@ -126,35 +119,13 @@ public interface ImageApi { Iterator<ListPage<Image>> list(); /** - * A paged version of ImageApi#list() - * - * @return an Iterator that is able to fetch additional pages when required - * @see ImageApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Images:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/images") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseImages.class) @Transform(ParseImages.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) Iterator<ListPage<Image>> list(ListOptions options); - - /** - * Creates an image resource in the specified project from the provided persistent disk. - * - * @param imageName the name of the created image - * @param sourceDisk fully qualified URL for the persistent disk to create the image from - * @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("Images:insert") - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("/global/images") - @OAuthScopes(COMPUTE_SCOPE) - @MapBinder(BindToJsonPayload.class) - Operation createImageFromPD(@PayloadParam("name") String imageName, @PayloadParam("sourceDisk") String sourceDisk); }
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 09dc36d..33ed393 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 @@ -60,10 +60,6 @@ import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; import org.jclouds.rest.binders.BindToJsonPayload; -/** - * Provides access to Instances via their REST API. - * @see InstanceApi - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) @Path("/instances") @@ -82,7 +78,6 @@ public interface InstanceApi { /** * Creates a instance resource in the specified project using the data included in the request. * - * * @param instance this name of the instance to be created * @param template the instance template * @return an Operation resource. To check on the status of an operation, poll the Operations resource returned to @@ -112,18 +107,16 @@ public interface InstanceApi { * @param token 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 */ @Named("Instances:list") @GET @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseInstances.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Instance> listPage(@Nullable String token, ListOptions listOptions); + ListPage<Instance> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see InstanceApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Instances:list") @GET @@ -134,7 +127,7 @@ public interface InstanceApi { Iterator<ListPage<Instance>> list(); /** - * @see InstanceApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Instances:list") @GET http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 f78d12d..b197ab2 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import java.util.Iterator; @@ -26,7 +27,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -44,76 +44,55 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to MachineTypes via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) -@Consumes(MediaType.APPLICATION_JSON) +@Path("/machineTypes") +@Consumes(APPLICATION_JSON) public interface MachineTypeApi { - /** - * Returns the specified machine type resource - * - * @param zone the name of the zone the machine type is in - * @param machineTypeName name of the machine type resource to return. - * @return If successful, this method returns a MachineType resource - */ + /** Returns an machine type by name or null if not found. */ @Named("MachineTypes:get") @GET - @Path("/zones/{zone}/machineTypes/{machineType}") + @Path("/{machineType}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) - MachineType getInZone(@PathParam("zone") String zone, @PathParam("machineType") String machineTypeName); + MachineType get(@PathParam("machineType") String machineType); /** * Retrieves the list of machine type 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 zone The name of the zone to list in. - * @param marker marks the beginning of the next list page + * @param token 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 */ @Named("MachineTypes:list") @GET - @Path("/zones/{zone}/machineTypes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseMachineTypes.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<MachineType> listAtMarkerInZone(@PathParam("zone") String zone, - @QueryParam("pageToken") @Nullable String marker, - ListOptions listOptions); + ListPage<MachineType> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see MachineTypeApi#listInZone(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("MachineTypes:list") @GET - @Path("/zones/{zone}/machineTypes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseMachineTypes.class) @Transform(ParseMachineTypes.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<MachineType>> listInZone(@PathParam("zone") String zone); + Iterator<ListPage<MachineType>> list(); /** - * A paged version of MachineTypeApi#listInZone(String) - * - * @param zone the zone to list in - * @return an Iterator that is able to fetch additional pages when required - * @see MachineTypeApi#listAtMarkerInZone(String, String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("MachineTypes:list") @GET - @Path("/zones/{zone}/machineTypes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseMachineTypes.class) @Transform(ParseMachineTypes.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<MachineType>> listInZone(@PathParam("zone") String zone, ListOptions listOptions); - + Iterator<ListPage<MachineType>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 c998be5..7b80233 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -30,7 +31,6 @@ 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.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -52,23 +52,16 @@ import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; import org.jclouds.rest.binders.BindToJsonPayload; -/** - * Provides access to Networks via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/networks") +@Consumes(APPLICATION_JSON) public interface NetworkApi { - /** - * Returns the specified persistent network resource. - * - * @param networkName name of the persistent network resource to return. - * @return a Network resource. - */ + /** Returns a network by name or null if not found. */ @Named("Networks:get") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/networks/{network}") + @Path("/{network}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) Network get(@PathParam("network") String networkName); @@ -83,9 +76,7 @@ public interface NetworkApi { */ @Named("Networks:insert") @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("/global/networks") + @Produces(APPLICATION_JSON) @OAuthScopes({COMPUTE_SCOPE}) @MapBinder(BindToJsonPayload.class) Operation createInIPv4Range(@PayloadParam("name") String networkName, @@ -102,56 +93,42 @@ public interface NetworkApi { */ @Named("Networks:insert") @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("/global/networks") + @Produces(APPLICATION_JSON) @OAuthScopes({COMPUTE_SCOPE}) @MapBinder(BindToJsonPayload.class) Operation createInIPv4RangeWithGateway(@PayloadParam("name") String networkName, @PayloadParam("IPv4Range") String IPv4Range, @PayloadParam("gatewayIPv4") String gatewayIPv4); - /** - * Deletes the specified persistent network resource. - * - * @param networkName name of the persistent network resource to delete. - * @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. - */ + /** Deletes a network by name and returns the operation in progress, or null if not found. */ @Named("Networks:delete") @DELETE - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/networks/{network}") + @Path("/{network}") @OAuthScopes(COMPUTE_SCOPE) @Fallback(NullOnNotFoundOr404.class) Operation delete(@PathParam("network") String networkName); /** - * Retrieves the list of persistent network resources contained within the specified project. + * Retrieves the list of network 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 options listing options + * @param token marks the beginning of the next list page + * @param listOptions listing options * @return a page of the list - * @see ListOptions */ @Named("Networks:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/networks") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseNetworks.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Network> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions options); + ListPage<Network> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see NetworkApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Networks:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/networks") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseNetworks.class) @Transform(ParseNetworks.ToIteratorOfListPage.class) @@ -159,15 +136,10 @@ public interface NetworkApi { Iterator<ListPage<Network>> list(); /** - * A paged version of NetworkApi#list() - * - * @return an Iterator that is able to fetch additional pages when required - * @see NetworkApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Networks:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/networks") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseNetworks.class) @Transform(ParseNetworks.ToIteratorOfListPage.class) http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 573aaa5..2a9c1a1 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -28,7 +29,6 @@ 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.googlecomputeengine.GoogleComputeEngineFallbacks.NullOn400or404; import org.jclouds.googlecomputeengine.binders.MetadataBinder; @@ -42,25 +42,18 @@ import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.SkipEncoding; -/** - * Provides access to Projects via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/projects") +@Consumes(APPLICATION_JSON) public interface ProjectApi { - /** - * Returns the specified project resource. - * - * @param projectName name of the project to return - * @return if successful, this method returns a Project resource - */ + /** Returns a project by name or null if not found. */ @Named("Projects:get") @GET @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @Fallback(NullOn400or404.class) - @Path("/projects/{project}") + @Path("/{project}") Project get(@PathParam("project") String projectName); /** @@ -83,10 +76,9 @@ public interface ProjectApi { */ @Named("Projects:setCommonInstanceMetadata") @POST - @Path("/projects/{project}/setCommonInstanceMetadata") + @Path("/{project}/setCommonInstanceMetadata") @OAuthScopes(COMPUTE_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) + @Produces(APPLICATION_JSON) @MapBinder(MetadataBinder.class) Operation setCommonInstanceMetadata(@PathParam("project") String projectName, @PayloadParam("items") Map<String, String> metadata, http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 6480a14..6e5da47 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import java.util.Iterator; @@ -25,7 +26,7 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; +import javax.ws.rs.QueryParam; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -34,6 +35,7 @@ import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.domain.Region; import org.jclouds.googlecomputeengine.functions.internal.ParseRegions; 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.OAuthAuthenticationFilter; import org.jclouds.rest.annotations.Fallback; @@ -42,49 +44,41 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Regions via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) -@Consumes(MediaType.APPLICATION_JSON) +@Path("/regions") +@Consumes(APPLICATION_JSON) public interface RegionApi { - /** - * Returns the specified region resource - * - * @param regionName name of the region resource to return. - * @return If successful, this method returns a Region resource - */ + /** Returns a region by name or null if not found. */ @Named("Regions:get") @GET - @Path("/regions/{region}") + @Path("/{region}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) - Region get(@PathParam("region") String regionName); + Region get(@PathParam("region") String region); /** - * Retrieves the listFirstPage of region resources available to the specified project. - * By default the listFirstPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() - * has not been set. + * Retrieves the list of region 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 token marks the beginning of the next list page * @param listOptions listing options + * @return a page of the list */ @Named("Regions:list") @GET - @Path("/regions") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRegions.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Region> listAtMarker(String marker, ListOptions listOptions); + ListPage<Region> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see RegionApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Regions:list") @GET - @Path("/regions") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRegions.class) @Transform(ParseRegions.ToIteratorOfListPage.class) @@ -92,17 +86,13 @@ public interface RegionApi { Iterator<ListPage<Region>> list(); /** - * A paged version of RegionApi#listFirstPage() - * - * @return an Iterator that is able to fetch additional pages when required - * @see RegionApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Regions:list") @GET - @Path("/regions") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRegions.class) @Transform(ParseRegions.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Region>> list(ListOptions listOptions); + Iterator<ListPage<Region>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 5a2f662..4bc0eac 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 @@ -16,6 +16,8 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static org.jclouds.Fallbacks.VoidOnNotFoundOr404; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -28,7 +30,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -46,91 +47,64 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Operations via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/operations") +@Consumes(APPLICATION_JSON) public interface RegionOperationApi { - /** - * Retrieves the specified operation resource. - * - * @param region the region the operation is in - * @param operationName name of the operation resource to return. - * @return If successful, this method returns an Operation resource - */ + /** Returns an operation by name or null if not found. */ @Named("RegionOperations:get") @GET - @Path("/regions/{region}/operations/{operation}") + @Path("/{operation}") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @Fallback(NullOnNotFoundOr404.class) - Operation getInRegion(@PathParam("region") String region, @PathParam("operation") String operationName); + @Nullable + Operation get(@PathParam("operation") String operation); - /** - * Deletes the specified operation resource. - * - * @param region the region the operation is in - * @param operationName name of the operation resource to delete. - */ + /** Deletes an operation by name. */ @Named("RegionOperations:delete") @DELETE - @Path("/regions/{region}/operations/{operation}") + @Path("/{operation}") @OAuthScopes(COMPUTE_SCOPE) - @Fallback(NullOnNotFoundOr404.class) - void deleteInRegion(@PathParam("region") String region, @PathParam("operation") String operationName); + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PathParam("operation") String operation); /** - * Retrieves the listFirstPage of operation resources contained within the specified project. - * By default the listFirstPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() - * has not been set. + * Retrieves the list of operation 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 region the region to list in - * @param marker marks the beginning of the next list page + * @param token marks the beginning of the next list page * @param listOptions listing options - * @return a page of the list, starting at marker - * @see org.jclouds.googlecomputeengine.options.ListOptions - * @see org.jclouds.googlecomputeengine.domain.ListPage + * @return a page of the list */ @Named("RegionOperations:list") @GET - @Path("/regions/{region}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseRegionOperations.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Operation> listAtMarkerInRegion(@PathParam("region") String region, - @QueryParam("pageToken") @Nullable String marker, - ListOptions listOptions); + ListPage<Operation> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see RegionOperationApi#listInRegion(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("RegionOperations:list") @GET - @Path("/regions/{region}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseRegionOperations.class) @Transform(ParseRegionOperations.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Operation>> listInRegion(@PathParam("region") String region); + Iterator<ListPage<Operation>> list(); /** - * A paged version of RegionOperationApi#listFirstPage(String) - * - * @return an Iterator that is able to fetch additional pages when required - * @see org.jclouds.collect.PagedIterable - * @see RegionOperationApi#listAtMarkerInRegion(String, String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("RegionOperations:list") @GET - @Path("/regions/{region}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseRegionOperations.class) @Transform(ParseRegionOperations.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Operation>> listInRegion(@PathParam("region") String region, ListOptions listOptions); + Iterator<ListPage<Operation>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 a2916cc..0919e6d 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -30,7 +31,7 @@ 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 javax.ws.rs.QueryParam; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -53,52 +54,70 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Routes via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) -@Consumes(MediaType.APPLICATION_JSON) +@Path("/routes") +@Consumes(APPLICATION_JSON) public interface RouteApi { - /** - * Returns the specified route resource - * - * @param routeName name of the region resource to return. - * @return If successful, this method returns a Route resource - */ + /** Returns a route type by name or null if not found. */ @Named("Routes:get") @GET - @Path("/global/routes/{route}") + @Path("/{route}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) Route get(@PathParam("route") String routeName); + /** Deletes a route by name and returns the operation in progress, or null if not found. */ + @Named("Routes:delete") + @DELETE + @Consumes(APPLICATION_JSON) + @Path("/{route}") + @OAuthScopes(COMPUTE_SCOPE) + @Fallback(NullOnNotFoundOr404.class) + @Nullable + Operation delete(@PathParam("route") String routeName); + /** - * Retrieves the listFirstPage of route resources available to the specified project. - * By default the listFirstPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() - * has not been set. + * Creates a route resource in the specified project using the data included in the request. * - * @param marker marks the beginning of the next list page + * @param name the name of the route to be inserted. + * @param network the network to which to add the route + * @param routeOptions the options of the route 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("Routes:insert") + @POST + @Consumes(APPLICATION_JSON) + @Produces(APPLICATION_JSON) + @OAuthScopes({COMPUTE_SCOPE}) + @MapBinder(RouteBinder.class) + Operation createInNetwork(@PayloadParam("name") String name, + @PayloadParam("network") URI network, + @PayloadParam("options") RouteOptions routeOptions); + + /** + * Retrieves the list of route 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 token marks the beginning of the next list page * @param listOptions listing options - * @return a page of the listFirstPage - * @see org.jclouds.googlecomputeengine.options.ListOptions - * @see org.jclouds.googlecomputeengine.domain.ListPage + * @return a page of the list */ @Named("Routes:list") @GET - @Path("/global/routes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRoutes.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Route> listAtMarker(String marker, ListOptions listOptions); + ListPage<Route> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see RouteApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Routes:list") @GET - @Path("/global/routes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRoutes.class) @Transform(ParseRoutes.ToIteratorOfListPage.class) @@ -106,55 +125,13 @@ public interface RouteApi { Iterator<ListPage<Route>> list(); /** - * A paged version of RegionApi#listFirstPage() - * - * @return an Iterator that is able to fetch additional pages when required - * @see RouteApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) - * @see org.jclouds.collect.PagedIterable + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Routes:list") @GET - @Path("/global/routes") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseRoutes.class) @Transform(ParseRoutes.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Route>> list(ListOptions listOptions); - - /** - * Deletes the specified route resource. - * - * @param routeName name of the route resource to delete. - * @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. If the route did not exist the result is null. - */ - @Named("Routes:delete") - @DELETE - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/routes/{route}") - @OAuthScopes(COMPUTE_SCOPE) - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Operation delete(@PathParam("route") String routeName); - - /** - * Creates a route resource in the specified project using the data included in the request. - * - * @param name the name of the route to be inserted. - * @param network the network to which to add the route - * @param routeOptions the options of the route 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("Routes:insert") - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Path("/global/routes") - @OAuthScopes({COMPUTE_SCOPE}) - @MapBinder(RouteBinder.class) - Operation createInNetwork(@PayloadParam("name") String name, - @PayloadParam("network") URI network, - @PayloadParam("options") RouteOptions routeOptions); - + Iterator<ListPage<Route>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 840f1d4..f3741a7 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -28,7 +29,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -47,80 +47,62 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Snapshots via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/snapshots") +@Consumes(APPLICATION_JSON) public interface SnapshotApi { - /** - * Returns the specified snapshot resource. - * - * @param snapshotName name of the snapshot resource to return. - * @return a Snapshot resource. - */ + /** Returns a snapshot by name or null if not found. */ @Named("Snapshots:get") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/snapshots/{snapshot}") + @Path("/{snapshot}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable - Snapshot get(@PathParam("snapshot") String snapshotName); + Snapshot get(@PathParam("snapshot") String snapshot); - /** - * Deletes the specified snapshot resource. - * - * @param snapshotName name of the snapshot resource to delete. - * @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. - */ + /** Deletes a snapshot by name and returns the operation in progress, or null if not found. */ @Named("Snapshots:delete") @DELETE - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/snapshots/{snapshot}") + @Path("/{snapshot}") @OAuthScopes(COMPUTE_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable - Operation delete(@PathParam("snapshot") String snapshotName); + Operation delete(@PathParam("snapshot") String snapshot); /** - * Retrieves the listPage of persistent disk resources contained within the specified project and zone. - * By default the listPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() has - * not been set. + * Retrieves the list of snapshot 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 token marks the beginning of the next list page * @param listOptions listing options + * @return a page of the list */ @Named("Snapshots:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/snapshots") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseSnapshots.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Snapshot> listAtMarker(@QueryParam("pageToken") @Nullable String marker, ListOptions listOptions); + ListPage<Snapshot> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * A paged version of SnapshotApi#listPage(String) - * - * @return an Iterator that is able to fetch additional pages when required + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Snapshots:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/snapshots") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseSnapshots.class) @Transform(ParseSnapshots.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) Iterator<ListPage<Snapshot>> list(); + /** + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) + */ @Named("Snapshots:list") @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/global/snapshots") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseSnapshots.class) @Transform(ParseSnapshots.ToIteratorOfListPage.class) http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 a630fd7..7054563 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,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -32,7 +33,6 @@ 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.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -58,23 +58,16 @@ import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; import org.jclouds.rest.binders.BindToJsonPayload; -/** - * Provides access to TargetPools via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticator.class) -@Consumes(MediaType.APPLICATION_JSON) +@Path("/targetPools") +@Consumes(APPLICATION_JSON) public interface TargetPoolApi { - /** - * Returns the specified TargetPool resource. - * - * @param targetPool the name of the TargetPool resource to return. - * @return a TargetPool resource. - */ + /** Returns a target pool by name or null if not found. */ @Named("TargetPools:get") @GET - @Path("/targetPools/{targetPool}") + @Path("/{targetPool}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable @@ -90,53 +83,22 @@ public interface TargetPoolApi { */ @Named("TargetPools:insert") @POST - @Produces(MediaType.APPLICATION_JSON) - @Path("/targetPools") + @Produces(APPLICATION_JSON) + @Path("") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(TargetPoolCreationBinder.class) Operation create(@PayloadParam("name") String name, @PayloadParam("options") TargetPoolCreationOptions options); - /** - * Deletes the specified TargetPool resource. - * - * @param targetPool name of the persistent target pool resource to delete. - * @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. - */ + /** Deletes a target pool by name and returns the operation in progress, or null if not found. */ @Named("TargetPools:delete") @DELETE - @Path("/targetPools/{targetPool}") + @Path("/{targetPool}") @OAuthScopes(COMPUTE_SCOPE) @Fallback(NullOnNotFoundOr404.class) @Nullable Operation delete(@PathParam("targetPool") String targetPool); /** - * @return an Iterator that is able to fetch additional pages when required - * @see org.jclouds.collect.PagedIterable - */ - @Named("TargetPools:list") - @GET - @Path("/targetPools") - @OAuthScopes(COMPUTE_READONLY_SCOPE) - @ResponseParser(ParseTargetPools.class) - @Transform(ParseTargetPools.ToIteratorOfListPage.class) - @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<TargetPool>> list(); - - /** - * @param options @see org.jclouds.googlecomputeengine.options.ListOptions - * @return ListPage - */ - @Named("TargetPools:list") - @GET - @Path("/targetPools") - @OAuthScopes(COMPUTE_READONLY_SCOPE) - @ResponseParser(ParseTargetPools.class) - @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<TargetPool> list(ListOptions options); - - /** * Adds instance to the targetPool. * * @param targetPool the name of the target pool. @@ -147,7 +109,7 @@ public interface TargetPoolApi { */ @Named("TargetPools:addInstance") @POST - @Path("/targetPools/{targetPool}/addInstance") + @Path("/{targetPool}/addInstance") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(TargetPoolChangeInstancesBinder.class) @Nullable @@ -164,7 +126,7 @@ public interface TargetPoolApi { */ @Named("TargetPools:removeInstance") @POST - @Path("/targetPools/{targetPool}/removeInstance") + @Path("/{targetPool}/removeInstance") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(TargetPoolChangeInstancesBinder.class) @Nullable @@ -181,7 +143,7 @@ public interface TargetPoolApi { */ @Named("TargetPools:addHealthCheck") @POST - @Path("/targetPools/{targetPool}/addHealthCheck") + @Path("/{targetPool}/addHealthCheck") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(TargetPoolChangeHealthChecksBinder.class) @Nullable @@ -199,7 +161,7 @@ public interface TargetPoolApi { */ @Named("TargetPools:removeHealthChek") @POST - @Path("/targetPools/{targetPool}/removeHealthCheck") + @Path("/{targetPool}/removeHealthCheck") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(TargetPoolChangeHealthChecksBinder.class) @Nullable @@ -214,14 +176,13 @@ public interface TargetPoolApi { * WARNING: failoverRatio and BackupPool must either both be set or not set. This method * is only for updating the backup pool on a Target Pool that already has a * failoverRatio. - * @see <a href = "https://cloud.google.com/compute/docs/reference/latest/targetPools/setBackup"/> * * @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("TargetPools:setBackup") @POST - @Path("/targetPools/{targetPool}/setBackup") + @Path("/{targetPool}/setBackup") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(BindToJsonPayload.class) @Nullable @@ -238,9 +199,47 @@ public interface TargetPoolApi { */ @Named("TargetPools:setBackup") @POST - @Path("/targetPools/{targetPool}/setBackup") + @Path("/{targetPool}/setBackup") @OAuthScopes(COMPUTE_SCOPE) @MapBinder(BindToJsonPayload.class) @Nullable Operation setBackup(@PathParam("targetPool") String targetPool, @QueryParam("failoverRatio") Float failoverRatio, @PayloadParam("target") URI target); + + /** + * Retrieves the list of target pool 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 token marks the beginning of the next list page + * @param listOptions listing options + * @return a page of the list + */ + @Named("TargetPools:list") + @GET + @OAuthScopes(COMPUTE_READONLY_SCOPE) + @ResponseParser(ParseTargetPools.class) + @Fallback(EmptyListPageOnNotFoundOr404.class) + ListPage<TargetPool> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); + + /** + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) + */ + @Named("TargetPools:list") + @GET + @OAuthScopes(COMPUTE_READONLY_SCOPE) + @ResponseParser(ParseTargetPools.class) + @Transform(ParseTargetPools.ToIteratorOfListPage.class) + @Fallback(EmptyIteratorOnNotFoundOr404.class) + Iterator<ListPage<TargetPool>> list(); + + /** + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) + */ + @Named("TargetPools:list") + @GET + @OAuthScopes(COMPUTE_READONLY_SCOPE) + @ResponseParser(ParseTargetPools.class) + @Transform(ParseTargetPools.ToIteratorOfListPage.class) + @Fallback(EmptyIteratorOnNotFoundOr404.class) + Iterator<ListPage<TargetPool>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 b043900..61716e3 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 @@ -16,6 +16,7 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import java.util.Iterator; @@ -25,7 +26,7 @@ import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; +import javax.ws.rs.QueryParam; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -34,6 +35,7 @@ import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.domain.Zone; import org.jclouds.googlecomputeengine.functions.internal.ParseZones; 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.OAuthAuthenticationFilter; import org.jclouds.rest.annotations.Fallback; @@ -42,49 +44,41 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Zones via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) -@Consumes(MediaType.APPLICATION_JSON) +@Path("/zones") +@Consumes(APPLICATION_JSON) public interface ZoneApi { - /** - * Returns the specified zone resource - * - * @param zoneName name of the zone resource to return. - * @return If successful, this method returns a Zone resource - */ + /** Returns a zone by name or null if not found. */ @Named("Zones:get") @GET - @Path("/zones/{zone}") + @Path("/{zone}") @OAuthScopes(COMPUTE_READONLY_SCOPE) @Fallback(NullOnNotFoundOr404.class) - Zone get(@PathParam("zone") String zoneName); + Zone get(@PathParam("zone") String zone); /** - * Retrieves the listFirstPage of zone resources available to the specified project. - * By default the listFirstPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() - * has not been set. + * Retrieves the list of zone 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 token marks the beginning of the next list page * @param listOptions listing options + * @return a page of the list */ @Named("Zones:list") @GET - @Path("/zones") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseZones.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Zone> listAtMarker(String marker, ListOptions listOptions); + ListPage<Zone> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see ZoneApi#list(org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Zones:list") @GET - @Path("/zones") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseZones.class) @Transform(ParseZones.ToIteratorOfListPage.class) @@ -92,17 +86,13 @@ public interface ZoneApi { Iterator<ListPage<Zone>> list(); /** - * A paged version of ZoneApi#listFirstPage() - * - * @return an Iterator that is able to fetch additional pages when required - * @see ZoneApi#listAtMarker(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("Zones:list") @GET - @Path("/zones") @OAuthScopes(COMPUTE_READONLY_SCOPE) @ResponseParser(ParseZones.class) @Transform(ParseZones.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Zone>> list(ListOptions listOptions); + Iterator<ListPage<Zone>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/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 d486ea2..e89a10b 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 @@ -16,6 +16,8 @@ */ package org.jclouds.googlecomputeengine.features; +import static javax.ws.rs.core.MediaType.APPLICATION_JSON; +import static org.jclouds.Fallbacks.VoidOnNotFoundOr404; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_READONLY_SCOPE; import static org.jclouds.googlecomputeengine.GoogleComputeEngineConstants.COMPUTE_SCOPE; @@ -28,7 +30,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.EmptyIteratorOnNotFoundOr404; @@ -46,88 +47,64 @@ import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; import org.jclouds.rest.annotations.Transform; -/** - * Provides access to Operations via their REST API. - */ @SkipEncoding({'/', '='}) @RequestFilters(OAuthAuthenticationFilter.class) +@Path("/operations") +@Consumes(APPLICATION_JSON) public interface ZoneOperationApi { - /** - * Retrieves the specified operation resource. - * - * @param zone the zone the operation is in - * @param operationName name of the operation resource to return. - * @return If successful, this method returns an Operation resource - */ + /** Returns an operation by name or null if not found. */ @Named("ZoneOperations:get") @GET - @Path("/zones/{zone}/operations/{operation}") + @Path("/{operation}") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @Fallback(NullOnNotFoundOr404.class) - Operation getInZone(@PathParam("zone") String zone, @PathParam("operation") String operationName); + @Nullable + Operation get(@PathParam("operation") String operation); - /** - * Deletes the specified operation resource. - * - * @param zone the zone the operation is in - * @param operationName name of the operation resource to delete. - */ + /** Deletes an operation by name. */ @Named("ZoneOperations:delete") @DELETE - @Path("/zones/{zone}/operations/{operation}") + @Path("/{operation}") @OAuthScopes(COMPUTE_SCOPE) - @Fallback(NullOnNotFoundOr404.class) - void deleteInZone(@PathParam("zone") String zone, @PathParam("operation") String operationName); + @Fallback(VoidOnNotFoundOr404.class) + void delete(@PathParam("operation") String operation); /** - * Retrieves the listFirstPage of operation resources contained within the specified project. - * By default the listFirstPage as a maximum size of 100, if no options are provided or ListOptions#getMaxResults() - * has not been set. + * Retrieves the list of operation 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 zone the zone to list in - * @param marker marks the beginning of the next list page + * @param token marks the beginning of the next list page * @param listOptions listing options - * @return a page of the list, starting at marker + * @return a page of the list */ @Named("ZoneOperations:list") @GET - @Path("/zones/{zone}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseZoneOperations.class) @Fallback(EmptyListPageOnNotFoundOr404.class) - ListPage<Operation> listAtMarkerInZone(@PathParam("zone") String zone, - @QueryParam("pageToken") @Nullable String marker, - ListOptions listOptions); + ListPage<Operation> listPage(@Nullable @QueryParam("pageToken") String token, ListOptions listOptions); /** - * @see ZoneOperationApi#listInZone(String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("ZoneOperations:list") @GET - @Path("/zones/{zone}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseZoneOperations.class) @Transform(ParseZoneOperations.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Operation>> listInZone(@PathParam("zone") String zone); + Iterator<ListPage<Operation>> list(); /** - * A paged version of ZoneOperationApi#listFirstPageInZone(String) - * - * @return an Iterator that is able to fetch additional pages when required - * @see ZoneOperationApi#listAtMarkerInZone(String, String, org.jclouds.googlecomputeengine.options.ListOptions) + * @see #list(org.jclouds.googlecomputeengine.options.ListOptions) */ @Named("ZoneOperations:list") @GET - @Path("/zones/{zone}/operations") @OAuthScopes(COMPUTE_READONLY_SCOPE) - @Consumes(MediaType.APPLICATION_JSON) @ResponseParser(ParseZoneOperations.class) @Transform(ParseZoneOperations.ToIteratorOfListPage.class) @Fallback(EmptyIteratorOnNotFoundOr404.class) - Iterator<ListPage<Operation>> listInZone(@PathParam("zone") String zone, ListOptions listOptions); + Iterator<ListPage<Operation>> list(ListOptions options); } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToIteratorOfListPage.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToIteratorOfListPage.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToIteratorOfListPage.java index 05cc6ee..66b9d75 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToIteratorOfListPage.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseToIteratorOfListPage.java @@ -20,6 +20,7 @@ import static com.google.common.base.Predicates.instanceOf; import static com.google.common.collect.Iterables.tryFind; import java.util.Iterator; +import java.util.List; import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.options.ListOptions; @@ -33,7 +34,7 @@ import com.google.common.base.Optional; import com.google.common.collect.Iterators; @Beta -public abstract class BaseToIteratorOfListPage<T, I extends BaseToIteratorOfListPage<T, I>> +abstract class BaseToIteratorOfListPage<T, I extends BaseToIteratorOfListPage<T, I>> implements Function<ListPage<T>, Iterator<ListPage<T>>>, InvocationContext<I> { private GeneratedHttpRequest request; @@ -44,16 +45,15 @@ public abstract class BaseToIteratorOfListPage<T, I extends BaseToIteratorOfList return Iterators.singletonIterator(input); } - Optional<Object> project = tryFind(request.getCaller().get().getArgs(), instanceOf(String.class)); + List<Object> callerArgs = request.getCaller().get().getArgs(); - Optional<Object> listOptions = tryFind(request.getInvocation().getArgs(), instanceOf(ListOptions.class)); + assert callerArgs.size() == 1 : String.format("programming error, method %s should have 1 arg: 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()); + Optional<Object> listOptions = tryFind(request.getInvocation().getArgs(), instanceOf(ListOptions.class)); return new AdvancingIterator<T>(input, - fetchNextPage(project.get().toString(), (ListOptions) listOptions.orNull())); + fetchNextPage((String) callerArgs.get(0), (ListOptions) listOptions.orNull())); } protected abstract Function<String, ListPage<T>> fetchNextPage(String projectName, ListOptions listOptions); http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionToIteratorOfListPage.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionToIteratorOfListPage.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionToIteratorOfListPage.java index e522dc0..eab19e6 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionToIteratorOfListPage.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithRegionToIteratorOfListPage.java @@ -20,6 +20,7 @@ import static com.google.common.base.Predicates.instanceOf; import static com.google.common.collect.Iterables.tryFind; import java.util.Iterator; +import java.util.List; import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.options.ListOptions; @@ -33,7 +34,7 @@ import com.google.common.base.Optional; import com.google.common.collect.Iterators; @Beta -public abstract class BaseWithRegionToIteratorOfListPage<T, I extends BaseWithRegionToIteratorOfListPage<T, I>> +abstract class BaseWithRegionToIteratorOfListPage<T, I extends BaseWithRegionToIteratorOfListPage<T, I>> implements Function<ListPage<T>, Iterator<ListPage<T>>>, InvocationContext<I> { private GeneratedHttpRequest request; @@ -42,20 +43,15 @@ public abstract class BaseWithRegionToIteratorOfListPage<T, I extends BaseWithRe if (input.nextPageToken() == null) return Iterators.singletonIterator(input); - Optional<Object> project = tryFind(request.getCaller().get().getArgs(), instanceOf(String.class)); + List<Object> callerArgs = request.getCaller().get().getArgs(); - Optional<Object> region = tryFind(request.getInvocation().getArgs(), instanceOf(String.class)); + assert callerArgs.size() == 2 : String.format("programming error, method %s should have 2 args: project, region", + request.getCaller().get().getInvokable()); 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 " - + "region", request.getCaller().get().getInvokable()); - return new AdvancingIterator<T>(input, - fetchNextPage(project.get().toString(), region.get().toString(), (ListOptions) listOptions.orNull())); + fetchNextPage((String) callerArgs.get(0), (String) callerArgs.get(1), (ListOptions) listOptions.orNull())); } protected abstract Function<String, ListPage<T>> fetchNextPage(String projectName, http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneToIteratorOfListPage.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneToIteratorOfListPage.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneToIteratorOfListPage.java index 4d4b576..16bc345 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneToIteratorOfListPage.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/BaseWithZoneToIteratorOfListPage.java @@ -20,6 +20,7 @@ import static com.google.common.base.Predicates.instanceOf; import static com.google.common.collect.Iterables.tryFind; import java.util.Iterator; +import java.util.List; import org.jclouds.googlecomputeengine.domain.ListPage; import org.jclouds.googlecomputeengine.options.ListOptions; @@ -33,7 +34,7 @@ import com.google.common.base.Optional; import com.google.common.collect.Iterators; @Beta -public abstract class BaseWithZoneToIteratorOfListPage<T, I extends BaseWithZoneToIteratorOfListPage<T, I>> +abstract class BaseWithZoneToIteratorOfListPage<T, I extends BaseWithZoneToIteratorOfListPage<T, I>> implements Function<ListPage<T>, Iterator<ListPage<T>>>, InvocationContext<I> { private GeneratedHttpRequest request; @@ -43,20 +44,15 @@ public abstract class BaseWithZoneToIteratorOfListPage<T, I extends BaseWithZone return Iterators.singletonIterator(input); } - Optional<Object> project = tryFind(request.getCaller().get().getArgs(), instanceOf(String.class)); + List<Object> callerArgs = request.getCaller().get().getArgs(); - Optional<Object> zone = tryFind(request.getInvocation().getArgs(), instanceOf(String.class)); + assert callerArgs.size() == 2 : String.format("programming error, method %s should have 2 args: project, zone", + request.getCaller().get().getInvokable()); 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 new AdvancingIterator<T>(input, - fetchNextPage(project.get().toString(), zone.get().toString(), (ListOptions) listOptions.orNull())); + fetchNextPage((String) callerArgs.get(0), (String) callerArgs.get(1), (ListOptions) listOptions.orNull())); } protected abstract Function<String, ListPage<T>> fetchNextPage(String projectName, http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java index 24245af..35dd2c1 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseAddresses.java @@ -47,7 +47,7 @@ public final class ParseAddresses extends ParseJson<ListPage<Address>> { final String regionName, final ListOptions options) { return new Function<String, ListPage<Address>>() { @Override public ListPage<Address> apply(String input) { - return api.getAddressApi(projectName).listAtMarkerInRegion(regionName, input, options); + return api.getAddressApi(projectName, regionName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java index 060460d..e9aa54f 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDiskTypes.java @@ -47,7 +47,7 @@ public final class ParseDiskTypes extends ParseJson<ListPage<DiskType>> { final String zoneName, final ListOptions options) { return new Function<String, ListPage<DiskType>>() { @Override public ListPage<DiskType> apply(String input) { - return api.getDiskTypeApi(projectName).listAtMarkerInZone(zoneName, input, options); + return api.getDiskTypeApi(projectName, zoneName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java index 02361e7..6a8173b 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseDisks.java @@ -48,7 +48,7 @@ public final class ParseDisks extends ParseJson<ListPage<Disk>> { return new Function<String, ListPage<Disk>>() { @Override public ListPage<Disk> apply(String input) { - return api.getDiskApi(projectName).listAtMarkerInZone(zoneName, input, options); + return api.getDiskApi(projectName, zoneName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java index 348d7a4..cfe8605 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseFirewalls.java @@ -47,7 +47,7 @@ public final class ParseFirewalls extends ParseJson<ListPage<Firewall>> { final ListOptions options) { return new Function<String, ListPage<Firewall>>() { @Override public ListPage<Firewall> apply(String input) { - return api.getFirewallApi(projectName).listAtMarker(input, options); + return api.getFirewallApi(projectName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java index e7e1826..e8fc15d 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseForwardingRules.java @@ -49,7 +49,7 @@ public final class ParseForwardingRules extends ParseJson<ListPage<ForwardingRul final ListOptions options) { return new Function<String, ListPage<ForwardingRule>>() { @Override public ListPage<ForwardingRule> apply(String input) { - return api.getForwardingRuleApi(projectName, regionName).list(options); + return api.getForwardingRuleApi(projectName, regionName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java index 99935e4..f45744f 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseGlobalOperations.java @@ -48,7 +48,7 @@ public final class ParseGlobalOperations extends ParseJson<ListPage<Operation>> final ListOptions options) { return new Function<String, ListPage<Operation>>() { @Override public ListPage<Operation> apply(String input) { - return api.getGlobalOperationApi(projectName).listAtMarker(input, options); + return api.getGlobalOperationApi(projectName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java index aba3d8d..da034e2 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseHttpHealthChecks.java @@ -50,7 +50,7 @@ public final class ParseHttpHealthChecks extends ParseJson<ListPage<HttpHealthCh return new Function<String, ListPage<HttpHealthCheck>>() { @Override public ListPage<HttpHealthCheck> apply(String input) { - return api.getHttpHealthCheckApi(projectName).list(options); + return api.getHttpHealthCheckApi(projectName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java index ada754b..dfdabc2 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseImages.java @@ -47,7 +47,7 @@ public final class ParseImages extends ParseJson<ListPage<Image>> { final ListOptions options) { return new Function<String, ListPage<Image>>() { @Override public ListPage<Image> apply(String input) { - return api.getImageApi(projectName).listAtMarker(input, options); + return api.getImageApi(projectName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java index 0e48546..284f7cc 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseMachineTypes.java @@ -35,8 +35,7 @@ public final class ParseMachineTypes extends ParseJson<ListPage<MachineType>> { }); } - public static class ToIteratorOfListPage - extends BaseWithZoneToIteratorOfListPage<MachineType, ToIteratorOfListPage> { + public static class ToIteratorOfListPage extends BaseWithZoneToIteratorOfListPage<MachineType, ToIteratorOfListPage> { private final GoogleComputeEngineApi api; @@ -49,7 +48,7 @@ public final class ParseMachineTypes extends ParseJson<ListPage<MachineType>> { return new Function<String, ListPage<MachineType>>() { @Override public ListPage<MachineType> apply(String input) { - return api.getMachineTypeApi(projectName).listAtMarkerInZone(zoneName, input, options); + return api.getMachineTypeApi(projectName, zoneName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java index 4d0a716..ad0837c 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseNetworks.java @@ -47,7 +47,7 @@ public final class ParseNetworks extends ParseJson<ListPage<Network>> { final ListOptions options) { return new Function<String, ListPage<Network>>() { @Override public ListPage<Network> apply(String input) { - return api.getNetworkApi(projectName).listAtMarker(input, options); + return api.getNetworkApi(projectName).listPage(input, options); } }; } http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/d7403236/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java ---------------------------------------------------------------------- diff --git a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java index 95a39d8..8b19bd4 100644 --- a/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java +++ b/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/internal/ParseRegionOperations.java @@ -48,7 +48,7 @@ public final class ParseRegionOperations extends ParseJson<ListPage<Operation>> final String regionName, final ListOptions options) { return new Function<String, ListPage<Operation>>() { @Override public ListPage<Operation> apply(String input) { - return api.getRegionOperationApi(projectName).listAtMarkerInRegion(regionName, input, options); + return api.getRegionOperationApi(projectName, regionName).listPage(input, options); } }; }
