* Change OAuthScopes into an interface as opposed to boilerplating annotations.

* Fixed errors because of boilerplating annotations.
This commit is contained in:
Adrian Cole 2014-11-11 20:15:56 -08:00
parent f3d2d3571c
commit 347926543e
41 changed files with 10 additions and 240 deletions

View File

@ -18,8 +18,6 @@ package org.jclouds.googlecomputeengine.compute.functions;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
@ -34,7 +32,6 @@ import org.jclouds.googlecomputeengine.domain.Instance;
import org.jclouds.googlecomputeengine.domain.Network;
import org.jclouds.googlecomputeengine.domain.Operation;
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.EndpointParam;
import org.jclouds.rest.annotations.Fallback;
@ -49,30 +46,26 @@ public interface Resources {
/** Returns an instance by self-link or null if not found. */
@Named("Instances:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class) @Nullable Instance instance(@EndpointParam URI selfLink);
/** Returns an network by self-link or null if not found. */
@Named("Networks:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class) @Nullable Network network(@EndpointParam URI selfLink);
/** Returns an operation by self-link or null if not found. */
@Named("Operations:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class) @Nullable Operation operation(@EndpointParam URI selfLink);
/** Deletes any resource by self-link and returns the operation in progress, or null if not found. */
@Named("Resources:delete")
@DELETE
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class) @Nullable Operation delete(@EndpointParam URI selfLink);
/** Hard-resets the instance by self-link and returns the operation in progres */
@Named("Instances:reset")
@POST
@Path("/reset")
@OAuthScopes(COMPUTE_SCOPE) Operation resetInstance(@EndpointParam URI selfLink);
Operation resetInstance(@EndpointParam URI selfLink);
}

View File

@ -22,7 +22,6 @@ import static java.util.concurrent.TimeUnit.SECONDS;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineProperties.PROJECT_NAME;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.rest.config.BinderUtils.bindHttpApi;
import java.net.URI;
@ -48,6 +47,7 @@ import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
import org.jclouds.location.Provider;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.config.OAuthScopes.ReadOrWriteScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
import org.jclouds.providers.ProviderMetadata;
import org.jclouds.rest.AuthorizationException;
@ -65,12 +65,14 @@ import com.google.inject.Provides;
@ConfiguresHttpApi
public final class GoogleComputeEngineHttpApiModule extends HttpApiModule<GoogleComputeEngineApi> {
public GoogleComputeEngineHttpApiModule() {
}
@Override protected void configure() {
super.configure();
bindHttpApi(binder(), UseApiToResolveProjectName.GetProject.class);
bind(OAuthScopes.class).toInstance(ReadOrWriteScopes.create( //
"https://www.googleapis.com/auth/compute.readonly", //
"https://www.googleapis.com/auth/compute" //
));
}
@Override protected void bindErrorHandlers() {
@ -118,7 +120,6 @@ public final class GoogleComputeEngineHttpApiModule extends HttpApiModule<Google
@SkipEncoding({ '/', '=' })
@RequestFilters(OAuthAuthenticationFilter.class)
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Consumes(APPLICATION_JSON)
interface GetProject {
@Named("Projects:get")

View File

@ -1,28 +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.config;
/** OAuth scopes needed for requests. */
public final class GoogleComputeEngineScopes {
public static final String COMPUTE_SCOPE = "https://www.googleapis.com/auth/compute";
public static final String COMPUTE_READONLY_SCOPE = "https://www.googleapis.com/auth/compute.readonly";
private GoogleComputeEngineScopes() {
}
}

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.util.Iterator;
@ -41,7 +39,6 @@ import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.MapBinder;
@ -63,7 +60,6 @@ public interface AddressApi {
@Named("Addresses:get")
@GET
@Path("/{address}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Address get(@PathParam("address") String address);
@ -78,7 +74,6 @@ public interface AddressApi {
@Named("Addresses:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation create(@PayloadParam("name") String address);
@ -86,7 +81,6 @@ public interface AddressApi {
@Named("Addresses:delete")
@DELETE
@Path("/{address}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("address") String address);
@ -102,20 +96,17 @@ public interface AddressApi {
*/
@Named("Addresses:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Address> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Addresses:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(AddressPages.class)
Iterator<ListPage<Address>> list();
/** @see #listPage(String, ListOptions) */
@Named("Addresses:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(AddressPages.class)
Iterator<ListPage<Address>> list(ListOptions options);

View File

@ -17,7 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import java.util.Iterator;
@ -35,7 +34,6 @@ import org.jclouds.googlecomputeengine.domain.MachineType;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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.RequestFilters;
import org.jclouds.rest.annotations.SkipEncoding;
@ -47,7 +45,6 @@ import com.google.common.base.Function;
@RequestFilters(OAuthAuthenticationFilter.class)
@Path("/aggregated")
@Consumes(APPLICATION_JSON)
@OAuthScopes(COMPUTE_READONLY_SCOPE)
public interface AggregatedListApi {
/**

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.util.Iterator;
@ -43,7 +41,6 @@ import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPa
import org.jclouds.googlecomputeengine.options.DiskCreationOptions;
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;
import org.jclouds.rest.annotations.MapBinder;
@ -65,7 +62,6 @@ public interface DiskApi {
@Named("Disks:get")
@GET
@Path("/{disk}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Disk get(@PathParam("disk") String disk);
@ -81,7 +77,6 @@ public interface DiskApi {
@Named("Disks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation create(@PayloadParam("name") String diskName, @PayloadParam("sizeGb") int sizeGb);
@ -97,7 +92,6 @@ public interface DiskApi {
@Named("Disks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(DiskCreationBinder.class)
Operation create(@PayloadParam("name") String diskName,
@PayloadParam("sizeGb") int sizeGb,
@ -107,7 +101,6 @@ public interface DiskApi {
@Named("Disks:delete")
@DELETE
@Path("/{disk}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("disk") String disk);
@ -124,7 +117,6 @@ public interface DiskApi {
@Named("Disks:createSnapshot")
@POST
@Path("/{disk}/createSnapshot")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation createSnapshot(@PathParam("disk") String diskName, @PayloadParam("name") String snapshotName);
@ -139,20 +131,17 @@ public interface DiskApi {
*/
@Named("Disks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Disk> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Disks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(DiskPages.class)
Iterator<ListPage<Disk>> list();
/** @see #listPage(String, ListOptions) */
@Named("Disks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(DiskPages.class)
Iterator<ListPage<Disk>> list(ListOptions options);

View File

@ -17,7 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import java.util.Iterator;
@ -36,7 +35,6 @@ import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.RequestFilters;
@ -49,7 +47,6 @@ import com.google.common.base.Function;
@RequestFilters(OAuthAuthenticationFilter.class)
@Path("/diskTypes")
@Consumes(APPLICATION_JSON)
@OAuthScopes(COMPUTE_READONLY_SCOPE)
public interface DiskTypeApi {
/** Returns a disk type by name or null if not found. */

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -46,7 +44,6 @@ import org.jclouds.googlecomputeengine.internal.PATCH;
import org.jclouds.googlecomputeengine.options.FirewallOptions;
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.BinderParam;
import org.jclouds.rest.annotations.Fallback;
@ -69,7 +66,6 @@ public interface FirewallApi {
@Named("Firewalls:get")
@GET
@Path("/{firewall}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Firewall get(@PathParam("firewall") String firewall);
@ -86,7 +82,6 @@ public interface FirewallApi {
@Named("Firewalls:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(FirewallBinder.class)
Operation createInNetwork(@PayloadParam("name") String name,
@PayloadParam("network") URI network,
@ -104,7 +99,6 @@ public interface FirewallApi {
@PUT
@Produces(APPLICATION_JSON)
@Path("/{firewall}")
@OAuthScopes(COMPUTE_SCOPE)
Operation update(@PathParam("firewall") String firewall,
@BinderParam(BindToJsonPayload.class) FirewallOptions firewallOptions);
@ -120,7 +114,6 @@ public interface FirewallApi {
@PATCH
@Produces(APPLICATION_JSON)
@Path("/{firewall}")
@OAuthScopes(COMPUTE_SCOPE)
Operation patch(@PathParam("firewall") String firewall,
@BinderParam(BindToJsonPayload.class) FirewallOptions firewallOptions);
@ -128,7 +121,6 @@ public interface FirewallApi {
@Named("Firewalls:delete")
@DELETE
@Path("/{firewall}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
Operation delete(@PathParam("firewall") String firewall);
@ -143,20 +135,17 @@ public interface FirewallApi {
*/
@Named("Firewalls:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Firewall> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Firewalls:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(FirewallPages.class)
Iterator<ListPage<Firewall>> list();
/** @see #listPage(String, ListOptions) */
@Named("Firewalls:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(FirewallPages.class)
Iterator<ListPage<Firewall>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -44,7 +42,6 @@ import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPa
import org.jclouds.googlecomputeengine.options.ForwardingRuleCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
@ -66,7 +63,6 @@ public interface ForwardingRuleApi {
@Named("ForwardingRules:get")
@GET
@Path("/{forwardingRule}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
ForwardingRule get(@PathParam("forwardingRule") String forwardingRule);
@ -81,7 +77,6 @@ public interface ForwardingRuleApi {
@Named("ForwardingRules:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(ForwardingRuleCreationBinder.class)
Operation create(@PayloadParam("name") String forwardingRuleName,
@PayloadParam("options") ForwardingRuleCreationOptions options);
@ -91,7 +86,6 @@ public interface ForwardingRuleApi {
@Named("ForwardingRules:delete")
@DELETE
@Path("/{forwardingRule}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("forwardingRule") String forwardingRule);
@ -109,7 +103,6 @@ public interface ForwardingRuleApi {
@Named("ForwardingRules:setTarget")
@POST
@Path("/{forwardingRule}/setTarget")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@MapBinder(BindToJsonPayload.class)
@Nullable
@ -126,20 +119,17 @@ public interface ForwardingRuleApi {
*/
@Named("ForwardingRules:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<ForwardingRule> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("ForwardingRules:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ForwardingRulePages.class)
Iterator<ListPage<ForwardingRule>> list();
/** @see #listPage(String, ListOptions) */
@Named("ForwardingRules:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ForwardingRulePages.class)
Iterator<ListPage<ForwardingRule>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.util.Iterator;
@ -44,7 +42,6 @@ import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.HttpHealthCheckCreationOptions;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
@ -67,7 +64,6 @@ public interface HttpHealthCheckApi {
@Named("HttpHealthChecks:get")
@GET
@Path("/{httpHealthCheck}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
HttpHealthCheck get(@PathParam("httpHealthCheck") String httpHealthCheck);
@ -82,7 +78,6 @@ public interface HttpHealthCheckApi {
@Named("HttpHealthChecks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation insert(@PayloadParam("name") String httpHealthCheckName);
@ -96,7 +91,6 @@ public interface HttpHealthCheckApi {
@Named("HttpHealthChecks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(HttpHealthCheckCreationBinder.class)
Operation insert(@PayloadParam("name") String name, @PayloadParam("options") HttpHealthCheckCreationOptions options);
@ -104,7 +98,6 @@ public interface HttpHealthCheckApi {
@Named("HttpHealthChecks:delete")
@DELETE
@Path("/{httpHealthCheck}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("httpHealthCheck") String httpHealthCheck);
@ -121,7 +114,6 @@ public interface HttpHealthCheckApi {
@Named("HttpHealthChecks:patch")
@PATCH
@Path("/{httpHealthCheck}")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(HttpHealthCheckCreationBinder.class)
@Nullable
Operation patch(@PathParam("httpHealthCheck") @PayloadParam("name") String name,
@ -140,7 +132,6 @@ public interface HttpHealthCheckApi {
@PUT
@Path("/{httpHealthCheck}")
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(HttpHealthCheckCreationBinder.class)
Operation update(@PathParam("httpHealthCheck") @PayloadParam("name") String name,
@PayloadParam("options") HttpHealthCheckCreationOptions options);
@ -156,20 +147,17 @@ public interface HttpHealthCheckApi {
*/
@Named("HttpHealthChecks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<HttpHealthCheck> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("HttpHealthChecks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(HttpHealthCheckPages.class)
Iterator<ListPage<HttpHealthCheck>> list();
/** @see #listPage(String, ListOptions) */
@Named("HttpHealthChecks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(HttpHealthCheckPages.class)
Iterator<ListPage<HttpHealthCheck>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -44,7 +42,6 @@ import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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.Endpoint;
import org.jclouds.rest.annotations.EndpointParam;
@ -66,7 +63,6 @@ public interface ImageApi {
/** Returns an image by self-link or null if not found. */
@Named("Images:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Image get(@EndpointParam URI selfLink);
@ -76,7 +72,6 @@ public interface ImageApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/images/{image}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Image get(@PathParam("image") String image);
@ -86,7 +81,6 @@ public interface ImageApi {
@DELETE
@Endpoint(CurrentProject.class)
@Path("/global/images/{image}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("image") String image);
@ -104,7 +98,6 @@ public interface ImageApi {
@Endpoint(CurrentProject.class)
@Path("/global/images")
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation createFromDisk(@PayloadParam("name") String image, @PayloadParam("sourceDisk") String sourceDisk);
@ -121,7 +114,6 @@ public interface ImageApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Image> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@ -129,7 +121,6 @@ public interface ImageApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ImagePages.class)
Iterator<ListPage<Image>> list();
@ -138,7 +129,6 @@ public interface ImageApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ImagePages.class)
Iterator<ListPage<Image>> list(ListOptions options);
@ -171,7 +161,6 @@ public interface ImageApi {
@Named("Images:list")
@GET
@Path("/projects/{project}/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Image> listPageInProject(@PathParam("project") String projectName,
@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
@ -181,7 +170,6 @@ public interface ImageApi {
@Named("Images:list")
@GET
@Path("/projects/{project}/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ImagePagesInProject.class)
Iterator<ListPage<Image>> listInProject(@PathParam("project") String projectName);
@ -191,7 +179,6 @@ public interface ImageApi {
@Named("Images:list")
@GET
@Path("/projects/{project}/global/images")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(ImagePagesInProject.class)
Iterator<ListPage<Image>> listInProject(@PathParam("project") String projectName, ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.jclouds.googlecomputeengine.domain.Instance.NetworkInterface.AccessConfig;
import static org.jclouds.googlecomputeengine.domain.Instance.SerialPortOutput;
@ -46,7 +44,6 @@ import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPa
import org.jclouds.googlecomputeengine.options.AttachDiskOptions;
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.BinderParam;
import org.jclouds.rest.annotations.Fallback;
@ -69,7 +66,6 @@ public interface InstanceApi {
@Named("Instances:get")
@GET
@Path("/{instance}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Instance get(@PathParam("instance") String instance);
@ -84,14 +80,12 @@ public interface InstanceApi {
@Named("Instances:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
Operation create(@BinderParam(BindToJsonPayload.class) NewInstance template);
/** Deletes an instance by name and returns the operation in progress, or null if not found. */
@Named("Instances:delete")
@DELETE
@Path("/{instance}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("instance") String instance);
@ -109,7 +103,6 @@ public interface InstanceApi {
@POST
@Produces(APPLICATION_JSON)
@Path("/{instance}/addAccessConfig")
@OAuthScopes(COMPUTE_SCOPE)
Operation addAccessConfigToNic(@PathParam("instance") String instance,
@BinderParam(BindToJsonPayload.class)
AccessConfig accessConfig,
@ -127,7 +120,6 @@ public interface InstanceApi {
@Named("Instances:deleteAccessConfig")
@DELETE
@Path("/{instance}/deleteAccessConfig")
@OAuthScopes(COMPUTE_SCOPE)
Operation deleteAccessConfigFromNic(@PathParam("instance") String instance,
@QueryParam("access_config") String accessConfigName,
@QueryParam("network_interface") String networkInterfaceName);
@ -141,7 +133,6 @@ public interface InstanceApi {
@Named("Instances:serialPort")
@GET
@Path("/{instance}/serialPort")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
SerialPortOutput getSerialPortOutput(@PathParam("instance") String instance);
/**
@ -154,7 +145,6 @@ public interface InstanceApi {
@Named("Instances:reset")
@POST
@Path("/{instance}/reset")
@OAuthScopes(COMPUTE_SCOPE)
Operation reset(@PathParam("instance") String instance);
/**
@ -170,7 +160,6 @@ public interface InstanceApi {
@POST
@Produces(APPLICATION_JSON)
@Path("/{instance}/attachDisk")
@OAuthScopes(COMPUTE_SCOPE)
Operation attachDisk(@PathParam("instance") String instance,
@BinderParam(BindToJsonPayload.class) AttachDiskOptions attachDiskOptions);
@ -186,7 +175,6 @@ public interface InstanceApi {
@Named("Instances:detachDisk")
@POST
@Path("/{instance}/detachDisk")
@OAuthScopes(COMPUTE_SCOPE)
Operation detachDisk(@PathParam("instance") String instance, @QueryParam("deviceName") String deviceName);
/**
@ -209,8 +197,6 @@ public interface InstanceApi {
@Named("Instances:setMetadata")
@POST
@Path("/{instance}/setMetadata")
@OAuthScopes(COMPUTE_SCOPE)
@Produces(APPLICATION_JSON)
Operation setMetadata(@PathParam("instance") String instance,
@BinderParam(BindToJsonPayload.class) Metadata metadata);
@ -226,7 +212,6 @@ public interface InstanceApi {
@Named("Instances:setTags")
@POST
@Path("/{instance}/setTags")
@OAuthScopes(COMPUTE_SCOPE)
@Produces(APPLICATION_JSON)
@MapBinder(BindToJsonPayload.class)
Operation setTags(@PathParam("instance") String instance,
@ -244,20 +229,17 @@ public interface InstanceApi {
*/
@Named("Instances:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Instance> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Instances:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(InstancePages.class)
Iterator<ListPage<Instance>> list();
/** @see #listPage(String, ListOptions) */
@Named("Instances:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(InstancePages.class)
Iterator<ListPage<Instance>> list(ListOptions options);

View File

@ -17,7 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import java.util.Iterator;
@ -36,7 +35,6 @@ import org.jclouds.googlecomputeengine.domain.MachineType;
import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.RequestFilters;
@ -55,7 +53,6 @@ public interface MachineTypeApi {
@Named("MachineTypes:get")
@GET
@Path("/{machineType}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
MachineType get(@PathParam("machineType") String machineType);
@ -70,20 +67,17 @@ public interface MachineTypeApi {
*/
@Named("MachineTypes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<MachineType> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("MachineTypes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(MachineTypePages.class)
Iterator<ListPage<MachineType>> list();
/** @see #listPage(String, ListOptions) */
@Named("MachineTypes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(MachineTypePages.class)
Iterator<ListPage<MachineType>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.util.Iterator;
@ -41,7 +39,6 @@ import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.MapBinder;
@ -63,7 +60,6 @@ public interface NetworkApi {
@Named("Networks:get")
@GET
@Path("/{network}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
Network get(@PathParam("network") String networkName);
@ -78,7 +74,6 @@ public interface NetworkApi {
@Named("Networks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation createInIPv4Range(@PayloadParam("name") String networkName,
@PayloadParam("IPv4Range") String IPv4Range);
@ -95,7 +90,6 @@ public interface NetworkApi {
@Named("Networks:insert")
@POST
@Produces(APPLICATION_JSON)
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
Operation createInIPv4RangeWithGateway(@PayloadParam("name") String networkName,
@PayloadParam("IPv4Range") String IPv4Range,
@ -105,7 +99,6 @@ public interface NetworkApi {
@Named("Networks:delete")
@DELETE
@Path("/{network}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
Operation delete(@PathParam("network") String networkName);
@ -120,20 +113,17 @@ public interface NetworkApi {
*/
@Named("Networks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Network> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Networks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(NetworkPages.class)
Iterator<ListPage<Network>> list();
/** @see #listPage(String, ListOptions) */
@Named("Networks:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(NetworkPages.class)
Iterator<ListPage<Network>> list(ListOptions options);

View File

@ -18,8 +18,6 @@ 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.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -42,7 +40,6 @@ import org.jclouds.googlecomputeengine.internal.BaseArg0ToIteratorOfListPage;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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.Endpoint;
import org.jclouds.rest.annotations.EndpointParam;
@ -61,7 +58,6 @@ public interface OperationApi {
/** Returns an operation by self-link or null if not found. */
@Named("Operations:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation get(@EndpointParam URI operation);
@ -69,7 +65,6 @@ public interface OperationApi {
/** Deletes an operation by name. */
@Named("Operations:delete")
@DELETE
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(VoidOnNotFoundOr404.class)
void delete(@EndpointParam URI operation);
@ -86,7 +81,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Operation> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@ -94,7 +88,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPages.class)
Iterator<ListPage<Operation>> list();
@ -103,7 +96,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/global/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPages.class)
Iterator<ListPage<Operation>> list(ListOptions options);
@ -137,7 +129,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/regions/{region}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Operation> listPageInRegion(@PathParam("region") String region,
@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
@ -146,7 +137,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/regions/{region}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPagesInRegion.class)
Iterator<ListPage<Operation>> listInRegion(@PathParam("region") String region);
@ -155,7 +145,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/regions/{region}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPagesInRegion.class)
Iterator<ListPage<Operation>> listInRegion(@PathParam("region") String region, ListOptions options);
@ -191,7 +180,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/zones/{zone}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Operation> listPageInZone(@PathParam("zone") String zone,
@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
@ -200,7 +188,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/zones/{zone}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPagesInZone.class)
Iterator<ListPage<Operation>> listInZone(@PathParam("zone") String zone);
@ -209,7 +196,6 @@ public interface OperationApi {
@GET
@Endpoint(CurrentProject.class)
@Path("/zones/{zone}/operations")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(OperationPagesInZone.class)
Iterator<ListPage<Operation>> listInZone(@PathParam("zone") String zone, ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import javax.inject.Named;
import javax.ws.rs.Consumes;
@ -31,7 +29,6 @@ import org.jclouds.googlecomputeengine.GoogleComputeEngineFallbacks.NullOn400or4
import org.jclouds.googlecomputeengine.domain.Metadata;
import org.jclouds.googlecomputeengine.domain.Operation;
import org.jclouds.googlecomputeengine.domain.Project;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticationFilter;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Fallback;
@ -47,7 +44,6 @@ public interface ProjectApi {
/** Get the current project. */
@Named("Projects:get")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOn400or404.class)
Project get();
@ -69,7 +65,6 @@ public interface ProjectApi {
@Named("Projects:setCommonInstanceMetadata")
@POST
@Path("/setCommonInstanceMetadata")
@OAuthScopes(COMPUTE_SCOPE)
@Produces(APPLICATION_JSON)
Operation setCommonInstanceMetadata(@BinderParam(BindToJsonPayload.class) Metadata metadata);
}

View File

@ -17,7 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import java.util.Iterator;
@ -36,7 +35,6 @@ import org.jclouds.googlecomputeengine.domain.Region;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.RequestFilters;
@ -49,7 +47,6 @@ import com.google.common.base.Function;
@RequestFilters(OAuthAuthenticationFilter.class)
@Path("/regions")
@Consumes(APPLICATION_JSON)
@OAuthScopes(COMPUTE_READONLY_SCOPE)
public interface RegionApi {
/** Returns a region by name or null if not found. */

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -44,7 +42,6 @@ import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.RouteOptions;
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;
import org.jclouds.rest.annotations.MapBinder;
@ -65,16 +62,13 @@ public interface RouteApi {
@Named("Routes:get")
@GET
@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);
@ -90,9 +84,7 @@ public interface RouteApi {
*/
@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,
@ -109,20 +101,17 @@ public interface RouteApi {
*/
@Named("Routes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Route> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Routes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(RoutePages.class)
Iterator<ListPage<Route>> list();
/** @see #listPage(String, ListOptions) */
@Named("Routes:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(RoutePages.class)
Iterator<ListPage<Route>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.util.Iterator;
@ -39,7 +37,6 @@ import org.jclouds.googlecomputeengine.domain.Snapshot;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.RequestFilters;
@ -58,7 +55,6 @@ public interface SnapshotApi {
@Named("Snapshots:get")
@GET
@Path("/{snapshot}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Snapshot get(@PathParam("snapshot") String snapshot);
@ -67,7 +63,6 @@ public interface SnapshotApi {
@Named("Snapshots:delete")
@DELETE
@Path("/{snapshot}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("snapshot") String snapshot);
@ -83,20 +78,17 @@ public interface SnapshotApi {
*/
@Named("Snapshots:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<Snapshot> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("Snapshots:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(SnapshotPages.class)
Iterator<ListPage<Snapshot>> list();
/** @see #listPage(String, ListOptions) */
@Named("Snapshots:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(SnapshotPages.class)
Iterator<ListPage<Snapshot>> list(ListOptions options);

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import java.net.URI;
import java.util.Iterator;
@ -47,7 +45,6 @@ import org.jclouds.googlecomputeengine.internal.BaseCallerArg0ToIteratorOfListPa
import org.jclouds.googlecomputeengine.options.ListOptions;
import org.jclouds.googlecomputeengine.options.TargetPoolCreationOptions;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.oauth.v2.config.OAuthScopes;
import org.jclouds.oauth.v2.filters.OAuthAuthenticator;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.MapBinder;
@ -69,7 +66,6 @@ public interface TargetPoolApi {
@Named("TargetPools:get")
@GET
@Path("/{targetPool}")
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
TargetPool get(@PathParam("targetPool") String targetPool);
@ -85,8 +81,6 @@ public interface TargetPoolApi {
@Named("TargetPools:insert")
@POST
@Produces(APPLICATION_JSON)
@Path("")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolCreationBinder.class)
Operation create(@PayloadParam("name") String name, @PayloadParam("options") TargetPoolCreationOptions options);
@ -94,7 +88,6 @@ public interface TargetPoolApi {
@Named("TargetPools:delete")
@DELETE
@Path("/{targetPool}")
@OAuthScopes(COMPUTE_SCOPE)
@Fallback(NullOnNotFoundOr404.class)
@Nullable
Operation delete(@PathParam("targetPool") String targetPool);
@ -111,7 +104,6 @@ public interface TargetPoolApi {
@Named("TargetPools:addInstance")
@POST
@Path("/{targetPool}/addInstance")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeInstancesBinder.class)
@Nullable
Operation addInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
@ -128,7 +120,6 @@ public interface TargetPoolApi {
@Named("TargetPools:removeInstance")
@POST
@Path("/{targetPool}/removeInstance")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeInstancesBinder.class)
@Nullable
Operation removeInstance(@PathParam("targetPool") String targetPool, @PayloadParam("instances") List<URI> instances);
@ -145,7 +136,6 @@ public interface TargetPoolApi {
@Named("TargetPools:addHealthCheck")
@POST
@Path("/{targetPool}/addHealthCheck")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
Operation addHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
@ -163,7 +153,6 @@ public interface TargetPoolApi {
@Named("TargetPools:removeHealthChek")
@POST
@Path("/{targetPool}/removeHealthCheck")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(TargetPoolChangeHealthChecksBinder.class)
@Nullable
Operation removeHealthCheck(@PathParam("targetPool") String targetPool, @PayloadParam("healthChecks") List<URI> healthChecks);
@ -184,7 +173,6 @@ public interface TargetPoolApi {
@Named("TargetPools:setBackup")
@POST
@Path("/{targetPool}/setBackup")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
@Nullable
Operation setBackup(@PathParam("targetPool") String targetPool, @PayloadParam("target") URI target);
@ -201,7 +189,6 @@ public interface TargetPoolApi {
@Named("TargetPools:setBackup")
@POST
@Path("/{targetPool}/setBackup")
@OAuthScopes(COMPUTE_SCOPE)
@MapBinder(BindToJsonPayload.class)
@Nullable
Operation setBackup(@PathParam("targetPool") String targetPool, @QueryParam("failoverRatio") Float failoverRatio, @PayloadParam("target") URI target);
@ -217,20 +204,17 @@ public interface TargetPoolApi {
*/
@Named("TargetPools:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
ListPage<TargetPool> listPage(@Nullable @QueryParam("pageToken") String pageToken, ListOptions listOptions);
/** @see #listPage(String, ListOptions) */
@Named("TargetPools:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(TargetPoolPages.class)
Iterator<ListPage<TargetPool>> list();
/** @see #listPage(String, ListOptions) */
@Named("TargetPools:list")
@GET
@OAuthScopes(COMPUTE_READONLY_SCOPE)
@Transform(TargetPoolPages.class)
Iterator<ListPage<TargetPool>> list(ListOptions options);

View File

@ -17,7 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import java.util.Iterator;
@ -36,7 +35,6 @@ import org.jclouds.googlecomputeengine.domain.Zone;
import org.jclouds.googlecomputeengine.internal.BaseToIteratorOfListPage;
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;
import org.jclouds.rest.annotations.RequestFilters;
@ -49,7 +47,6 @@ import com.google.common.base.Function;
@RequestFilters(OAuthAuthenticationFilter.class)
@Path("/zones")
@Consumes(APPLICATION_JSON)
@OAuthScopes(COMPUTE_READONLY_SCOPE)
public interface ZoneApi {
/** Returns a zone by name or null if not found. */

View File

@ -18,7 +18,6 @@ package org.jclouds.googlecomputeengine;
import java.util.Properties;
import org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes;
import org.jclouds.googlecomputeengine.internal.TestProperties;
import org.jclouds.oauth.v2.internal.BaseOAuthAuthenticatedApiLiveTest;
import org.testng.annotations.Test;
@ -32,7 +31,7 @@ public class GoogleComputeEngineAuthenticatedRestContextLiveTest extends BaseOAu
@Override
public String getScopes() {
return GoogleComputeEngineScopes.COMPUTE_SCOPE;
return "https://www.googleapis.com/auth/compute";
}
@Override protected Properties setupProperties() {

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,7 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.maxResults;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;

View File

@ -19,8 +19,6 @@ package org.jclouds.googlecomputeengine.features;
import static com.google.common.base.Joiner.on;
import static com.google.common.collect.Iterables.transform;
import static java.lang.String.format;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.jclouds.io.Payloads.newStringPayload;
import static org.jclouds.util.Strings2.toStringAndClose;
import static org.testng.Assert.assertEquals;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.jclouds.googlecomputeengine.features.ProjectApiExpectTest.GET_PROJECT_REQUEST;
import static org.jclouds.googlecomputeengine.features.ProjectApiExpectTest.GET_PROJECT_RESPONSE;
import static org.testng.Assert.assertEquals;

View File

@ -16,7 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.filter;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;

View File

@ -17,8 +17,6 @@
package org.jclouds.googlecomputeengine.features;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;

View File

@ -16,7 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,7 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;

View File

@ -16,8 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.AssertJUnit.assertNull;

View File

@ -16,7 +16,6 @@
*/
package org.jclouds.googlecomputeengine.features;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;

View File

@ -40,6 +40,8 @@ import com.google.common.base.Joiner;
import com.google.inject.Module;
public class BaseGoogleComputeEngineExpectTest<T> extends BaseRestApiExpectTest<T> {
protected static final String COMPUTE_SCOPE = "https://www.googleapis.com/auth/compute";
protected static final String COMPUTE_READONLY_SCOPE = "https://www.googleapis.com/auth/compute.readonly";
protected static final String BASE_URL = "https://www.googleapis.com/compute/v1/projects";
private static final String header = "{\"alg\":\"none\",\"typ\":\"JWT\"}";

View File

@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.googlecomputeengine.functions.internal;
package org.jclouds.googlecomputeengine.internal;
import static org.jclouds.googlecomputeengine.config.GoogleComputeEngineScopes.COMPUTE_READONLY_SCOPE;
import static org.jclouds.googlecomputeengine.options.ListOptions.Builder.maxResults;
import static org.testng.Assert.assertEquals;
@ -32,7 +31,6 @@ import org.jclouds.googlecomputeengine.domain.ListPage;
import org.jclouds.googlecomputeengine.features.AddressApi;
import org.jclouds.googlecomputeengine.features.ImageApi;
import org.jclouds.googlecomputeengine.features.InstanceApi;
import org.jclouds.googlecomputeengine.internal.BaseGoogleComputeEngineExpectTest;
import org.jclouds.googlecomputeengine.parse.ParseAddressTest;
import org.jclouds.googlecomputeengine.parse.ParseImageTest;
import org.jclouds.googlecomputeengine.parse.ParseInstanceTest;