http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java deleted file mode 100644 index 8636625..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/BucketApi.java +++ /dev/null @@ -1,281 +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.googlecloudstorage.features; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; - -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.blobstore.BlobStoreFallbacks.NullOnKeyAlreadyExists; -import org.jclouds.googlecloud.domain.ListPage; -import org.jclouds.googlecloudstorage.GoogleCloudStorageFallbacks.NullOnBucketAlreadyExists; -import org.jclouds.googlecloudstorage.domain.Bucket; -import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate; -import org.jclouds.googlecloudstorage.options.DeleteBucketOptions; -import org.jclouds.googlecloudstorage.options.GetBucketOptions; -import org.jclouds.googlecloudstorage.options.InsertBucketOptions; -import org.jclouds.googlecloudstorage.options.ListOptions; -import org.jclouds.googlecloudstorage.options.UpdateBucketOptions; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.oauth.v2.filters.OAuthFilter; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.PATCH; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.binders.BindToJsonPayload; - -/** - * Provides access to Bucket entities via their REST API. - * - * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/buckets"/> - */ - -@SkipEncoding({ '/', '=' }) -@RequestFilters(OAuthFilter.class) -@Consumes(APPLICATION_JSON) -public interface BucketApi { - - /** - * Check the existence of a bucket - * - * @param bucketName - * Name of the bucket - * - * @return a {@link Bucket} true if bucket exist - */ - @Named("Bucket:get") - @GET - @Path("/b/{bucket}") - @Fallback(FalseOnNotFoundOr404.class) - boolean bucketExist(@PathParam("bucket") String bucketName); - - /** - * Returns metadata for the specified bucket. - * - * @param bucketName - * Name of the bucket - * - * @return a {@link Bucket} resource - */ - @Named("Bucket:get") - @GET - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Bucket getBucket(@PathParam("bucket") String bucketName); - - /** - * Returns metadata for the specified bucket - * - * @param bucketName - * Name of the bucket - * @param options - * Supply {@link GetBucketOptions} with optional query parameters - * - * @return a {@link Bucket} resource - */ - @Named("Bucket:get") - @GET - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - Bucket getBucket(@PathParam("bucket") String bucketName, GetBucketOptions options); - - /** - * Creates a new bucket - * - * @param projectId - * A valid API project identifier - * @param bucketTemplate - * supply a {@link BucketTemplate} resource - * - * @return If successful, this method returns a {@link Bucket} resource. - */ - @Named("Bucket:insert") - @POST - @Path("/b") - @Fallback(NullOnBucketAlreadyExists.class) - Bucket createBucket(@QueryParam("project") String projectId, @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate); - - /** - * Creates a new Bucket - * - * @param projectId - * A valid API project identifier - * - * @param bucketTemplate - * Supply a {@link BucketTemplate} resource - * @param options - * Supply {@link InsertBucketOptions} with optional query parameters - * - * @return If successful, this method returns a {@link Bucket} resource. - */ - @Named("Bucket:insert") - @POST - @Path("/b") - @Fallback(NullOnKeyAlreadyExists.class) - Bucket createBucket(@QueryParam("project") String projectId, - @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, InsertBucketOptions options); - - /** - * Permanently deletes an empty Bucket.If bucket is not empty 409 error to indicate the conflict. - * - * @param bucketName - * Name of the bucket - */ - @Named("Bucket:delete") - @DELETE - @Path("/b/{bucket}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteBucket(@PathParam("bucket") String bucketName); - - /** - * Permanently deletes an empty Bucket.If bucket is not empty 409 error to indicate the conflict. - * - * @param bucketName - * Name of the bucket - * @param options - * Supply {@link DeleteBucketOptions} with optional query parameters - */ - @Named("Bucket:delete") - @DELETE - @Path("/b/{bucket}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteBucket(@PathParam("bucket") String bucketName, DeleteBucketOptions options); - - /** - * Retrieves a list of buckets for a given project - * - * @param projectId - * A valid API project identifier - * - * @return a {@link ListPage<Bucket>} - */ - @Named("Bucket:list") - @GET - @Produces(APPLICATION_JSON) - @Path("/b") - ListPage<Bucket> listBucket(@QueryParam("project") String projectId); - - /** - * Retrieves a list of buckets for a given project - * - * @param projectId - * A valid API project identifier - * @param options - * Supply {@link ListOptions} with optional query parameters - */ - @Named("Bucket:list") - @GET - @Produces(APPLICATION_JSON) - @Path("/b") - ListPage<Bucket> listBucket(@QueryParam("project") String projectId, ListOptions options); - - /** - * Updates a bucket - * - * @param bucketName - * Name of the bucket - * @param bucketTemplate - * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls} - * - * @return If successful, this method returns the updated {@link Bucket} resource. - */ - @Named("Bucket:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - Bucket updateBucket(@PathParam("bucket") String bucketName, - @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate); - - /** - * Updates a bucket - * - * @param bucketName - * Name of the bucket - * @param bucketTemplate - * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls} - * @param options - * Supply {@link UpdateBucketOptions} with optional query parameters - * - * @return If successful,this method returns the updated {@link Bucket} resource. - */ - @Named("Bucket:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - Bucket updateBucket(@PathParam("bucket") String bucketName, - @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, UpdateBucketOptions options); - - /** - * Updates a bucket supporting patch semantics. - * - * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/how-tos/performance#patch"/> - * - * @param bucketName - * Name of the bucket - * @param bucketTemplate - * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls} - * - * @return If successful, this method returns the updated {@link Bucket} resource. - */ - @Named("Bucket:patch") - @PATCH - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - Bucket patchBucket(@PathParam("bucket") String bucketName, - @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate); - - /** - * Updates a bucket supporting patch semantics. - * - * @see <a href = "https://developers.google.com/storage/docs/json_api/v1/how-tos/performance#patch"/> - * - * @param bucketName - * Name of the bucket - * @param bucketTemplate - * Supply a {@link BucketTemplate} resource with list of {@link BucketAccessControls} - * @param options - * Supply {@link UpdateBucketOptions} with optional query parameters - * - * @return If successful, this method returns the updated {@link Bucket} resource. - */ - @Named("Bucket:patch") - @PATCH - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}") - @Fallback(NullOnNotFoundOr404.class) - Bucket patchBucket(@PathParam("bucket") String bucketName, - @BinderParam(BindToJsonPayload.class) BucketTemplate bucketTemplate, UpdateBucketOptions options); -}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java deleted file mode 100644 index 8ec7e6a..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/DefaultObjectAccessControlsApi.java +++ /dev/null @@ -1,180 +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.googlecloudstorage.features; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -import java.util.List; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole; -import org.jclouds.googlecloudstorage.domain.ObjectAccessControls; -import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate; -import org.jclouds.http.HttpResponse; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.oauth.v2.filters.OAuthFilter; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.PATCH; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.binders.BindToJsonPayload; - -/** - * Provides access to DefaultObjectAccessControl entities via their REST API. - * - * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/defaultObjectAccessControls"/> - */ - -@SkipEncoding({ '/', '=' }) -@RequestFilters(OAuthFilter.class) -@Consumes(APPLICATION_JSON) -public interface DefaultObjectAccessControlsApi { - - /** - * Returns the ACL entry for the specified entity on the specified object. - * - * @param bucketName - * Name of the bucket which contains the object - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * - * @return an DefaultObjectAccessControls resource - */ - @Named("DefaultObjectAccessControls:get") - @GET - @Path("/b/{bucket}/defaultObjectAcl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - ObjectAccessControls getDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("entity") String entity); - - /** - * Creates a new ACL entry for specified object - * - * @param bucketName - * Name of the bucket of that ACL to be created In the request body, supply a DefaultObjectAccessControls - * resource with the following properties - * - * @return If successful, this method returns a DefaultObjectAccessControls resource - */ - @Named("DefaultObjectAccessControls:insert") - @POST - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/defaultObjectAcl") - ObjectAccessControls createDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template); - - /** - * Permanently deletes the DefaultObjectAcessControl entry for the specified entity on the specified bucket. - * - * @param bucketName - * Name of the bucket which contains the object - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * - * @return If successful, this method returns an empty response body - */ - @Named("DefaultObjectAccessControls:delete") - @DELETE - @Path("/b/{bucket}/defaultObjectAcl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - HttpResponse deleteDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("entity") String entity); - - /** - * Retrieves ACL entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - * - * @return ListObjectAccessControls resource - * - */ - @Named("DefaultObjectAccessControls:list") - @GET - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/defaultObjectAcl") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - @SelectJson("items") - List<ObjectAccessControls> listDefaultObjectAccessControls(@PathParam("bucket") String bucketName); - - /** - * Retrieves ACL entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - * - * @return DefaultObjectAccessControls resource - * - */ - @Named("DefaultObjectAccessControls:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/defaultObjectAcl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - ObjectAccessControls updateDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload); - - /** - * Retrieves ACL entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - */ - @Named("DefaultObjectAccessControls:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/defaultObjectAcl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - ObjectAccessControls updateDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload, - @QueryParam("role") ObjectRole role); - - /** - * Retrieves ACL entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - */ - @Named("DefaultObjectAccessControls:patch") - @PATCH - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/defaultObjectAcl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - ObjectAccessControls patchDefaultObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControls payload); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java deleted file mode 100644 index 32b5e7c..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectAccessControlsApi.java +++ /dev/null @@ -1,317 +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.googlecloudstorage.features; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -import java.util.List; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.Encoded; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.googlecloudstorage.domain.ObjectAccessControls; -import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.oauth.v2.filters.OAuthFilter; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.PATCH; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.binders.BindToJsonPayload; - -/** - * Provides access to ObjectAccessControl entities via their REST API. - * - * @see <a href = " https://developers.google.com/storage/docs/json_api/v1/objectAccessControls "/> - */ -@RequestFilters(OAuthFilter.class) -@Consumes(APPLICATION_JSON) -public interface ObjectAccessControlsApi { - - /** - * Returns the acl entry for the specified entity on the specified object. - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the bucket of that acl is related - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * - * @return an {@link ObjectAccessControls } - */ - - @Named("ObjectAccessControls:get") - @GET - @Path("/b/{bucket}/o/{object}/acl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - ObjectAccessControls getObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity); - - /** - * Returns the acl entry for the specified entity on the specified object. - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the object of that acl is related - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * @param generation - * If present, selects a specific revision of this object - * - * @return an {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:get") - @GET - @Path("/b/{bucket}/o/{object}/acl/{entity}") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - ObjectAccessControls getObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @QueryParam("generation") Long generation); - - /** - * Creates a new acl entry for specified object - * - * @param bucketName - * Name of the bucket of that acl to be created In the request body, supply a ObjectAccessControls resource - * with the following properties - * @param objectName - * Name of the bucket of that acl is related - * - * @return an {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:insert") - @POST - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl") - ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template); - - /** - * Creates a new acl entry for specified object - * - * @param bucketName - * Name of the bucket of that acl to be created In the request body, supply a ObjectAccessControls resource - * with the following properties - * @param objectName - * Name of the bucket of that acl is related - * @param generation - * If present, selects a specific revision of this object - * - * @return an {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:insert") - @POST - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl") - ObjectAccessControls createObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template, - @QueryParam("generation") Long generation); - - /** - * Permanently deletes the acl entry for the specified entity on the specified bucket. - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the bucket of which acl is related - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - */ - @Named("ObjectAccessControls:delete") - @DELETE - @Path("/b/{bucket}/o/{object}/acl/{entity}") - void deleteObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity); - - /** - * Permanently deletes the acl entry for the specified entity on the specified bucket. - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the bucket of that acl is related - * @param generation - * If present, selects a specific revision of this object - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - */ - @Named("ObjectAccessControls:delete") - @DELETE - @Path("/b/{bucket}/o/{object}/acl/{entity}") - void deleteObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @QueryParam("generation") Long generation); - - /** - * Retrieves acl entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the bucket of that acl is related - */ - @Named("ObjectAccessControls:list") - @GET - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl") - @SelectJson("items") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - List<ObjectAccessControls> listObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName); - - /** - * Retrieves acl entries on a specified object - * - * @param bucketName - * Name of the bucket which contains the object - * @param objectName - * Name of the bucket of that acl is related - * @param generation - * If present, selects a specific revision of this object - * - */ - @Named("ObjectAccessControls:list") - @GET - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl") - @SelectJson("items") - @Fallback(NullOnNotFoundOr404.class) - @Nullable - List<ObjectAccessControls> listObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @QueryParam("generation") Long generation); - - /** - * Updates an acl entry on the specified object - * - * @param bucketName - * Name of the bucket of which contains the object - * @param objectName - * Name of the object which acl is related - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers. - * @param template - * Supply an {@link ObjectAccessControlsTemplate} - * - * @return an {@link ObjectAccessControls } - */ - - @Named("ObjectAccessControls:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl/{entity}") - ObjectAccessControls updateObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template); - - /** - * Updates an acl entry on the specified object - * - * @param bucketName - * Name of the bucket of which contains the object - * @param objectName - * Name of the object which acl is related * - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * @param template - * Supply an {@link ObjectAccessControlsTemplate} - * @param generation - * If present, selects a specific revision of this object - * - * @return {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:update") - @PUT - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl/{entity}") - ObjectAccessControls updateObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template, - @QueryParam("generation") Long generation); - - /** - * Updates an acl entry on the specified object - * - * @param bucketName - * Name of the bucket of which contains the object - * @param objectName - * Name of the object which acl is related - * @param template - * Supply an {@link ObjectAccessControlsTemplate} - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers. - * - * @return an {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:patch") - @PATCH - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl/{entity}") - ObjectAccessControls patchObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template); - - /** - * Updates an acl entry on the specified object - * - * @param bucketName - * Name of the bucket of which contains the object - * @param objectName - * Name of the object which acl is related - * @param entity - * The entity holding the permission. Can be user-userId, user-emailAddress, group-groupId, - * group-emailAddress, allUsers, or allAuthenticatedUsers - * @param template - * Supply an {@link ObjectAccessControlsTemplate} - * @param generation - * If present, selects a specific revision of this object - * - * @return {@link ObjectAccessControls } - */ - @Named("ObjectAccessControls:patch") - @PATCH - @Produces(APPLICATION_JSON) - @Path("/b/{bucket}/o/{object}/acl/{entity}") - ObjectAccessControls patchObjectAccessControls(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, @PathParam("entity") String entity, - @BinderParam(BindToJsonPayload.class) ObjectAccessControlsTemplate template, - @QueryParam("generation") Long generation); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java deleted file mode 100644 index b750406..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ObjectApi.java +++ /dev/null @@ -1,532 +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.googlecloudstorage.features; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.Encoded; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; - -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.googlecloudstorage.binders.MultipartUploadBinder; -import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject; -import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes; -import org.jclouds.googlecloudstorage.domain.RewriteResponse; -import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate; -import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate; -import org.jclouds.googlecloudstorage.options.ComposeObjectOptions; -import org.jclouds.googlecloudstorage.options.CopyObjectOptions; -import org.jclouds.googlecloudstorage.options.DeleteObjectOptions; -import org.jclouds.googlecloudstorage.options.GetObjectOptions; -import org.jclouds.googlecloudstorage.options.InsertObjectOptions; -import org.jclouds.googlecloudstorage.options.ListObjectOptions; -import org.jclouds.googlecloudstorage.options.RewriteObjectOptions; -import org.jclouds.googlecloudstorage.options.UpdateObjectOptions; -import org.jclouds.googlecloudstorage.parser.ParseToPayloadEnclosing; -import org.jclouds.http.options.HttpRequestOptions; -import org.jclouds.io.Payload; -import org.jclouds.io.PayloadEnclosing; -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.oauth.v2.filters.OAuthFilter; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PATCH; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.binders.BindToJsonPayload; - -/** - * Provides access to Object entities via their REST API. - * - * @see <a href="https://developers.google.com/storage/docs/json_api/v1/objects"/> - */ -@RequestFilters(OAuthFilter.class) -public interface ObjectApi { - - /** - * Check the existence of an object - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * - * @return a {@link Object} true if object exists - */ - @Named("Object:Exist") - @GET - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(FalseOnNotFoundOr404.class) - boolean objectExists(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName); - - /** - * Retrieve an object metadata - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * - * @return a {@link Object} resource - */ - @Named("Object:get") - @GET - @Path("storage/v1/b/{bucket}/o/{object}") - @Consumes(APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - @Nullable - GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName); - - /** - * Retrieves objects metadata - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param options - * A class that implements {@link HttpRequestOptions} - * such as {@link GetObjectOptions} with optional query parameters - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:get") - @GET - @Path("storage/v1/b/{bucket}/o/{object}") - @Consumes(APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - @Nullable - GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, HttpRequestOptions options); - - /** - * Retrieve an object or their metadata - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * - * @return a {@link Object} resource - */ - @Named("Object:get") - @GET - @QueryParams(keys = "alt", values = "media") - @Path("storage/v1/b/{bucket}/o/{object}") - @ResponseParser(ParseToPayloadEnclosing.class) - @Fallback(NullOnNotFoundOr404.class) - @Nullable - PayloadEnclosing download(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName); - - /** - * Retrieves objects - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param options - * A class that implements {@link HttpRequestOptions} - * such as {@link GetObjectOptions} with optional query parameters - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:get") - @GET - @QueryParams(keys = "alt", values = "media") - @Path("storage/v1/b/{bucket}/o/{object}") - @ResponseParser(ParseToPayloadEnclosing.class) - @Fallback(NullOnNotFoundOr404.class) - @Nullable - PayloadEnclosing download(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName, - HttpRequestOptions options); - - /** - * Stores a new object. Object metadata setting is not supported with simple uploads - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#simple - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param options - * Supply an {@link InsertObjectOptions}. 'name' should not null. - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:simpleUpload") - @POST - @QueryParams(keys = "uploadType", values = "media") - @Consumes(APPLICATION_JSON) - @Path("/upload/storage/v1/b/{bucket}/o") - GoogleCloudStorageObject simpleUpload(@PathParam("bucket") String bucketName, @HeaderParam("Content-Type") String contentType, - @HeaderParam("Content-Length") Long contentLength, @PayloadParam("payload") Payload payload, - InsertObjectOptions options); - - /** - * Deletes an object and its metadata. Deletions are permanent if versioning is not enabled. - * - * @param bucketName - * Name of the bucket in which the object to be deleted resides - * @param objectName - * Name of the object - */ - @Named("Object:delete") - @DELETE - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteObject(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName); - - /** - * Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the - * generation parameter is used. - * - * @param bucketName - * Name of the bucket in which the object to be deleted resides - * @param objectName - * Name of the object - * @param options - * Supply {@link DeleteObjectOptions} with optional query parameters - */ - @Named("Object:delete") - @DELETE - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(FalseOnNotFoundOr404.class) - boolean deleteObject(@PathParam("bucket") String bucketName, @PathParam("object") @Encoded String objectName, - DeleteObjectOptions options); - - /** - * Retrieves a list of objects matching the criteria. - * - * @param bucketName - * Name of the bucket in which to look for objects. - */ - @Named("Object:list") - @GET - @Consumes(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o") - @Fallback(NullOnNotFoundOr404.class) - ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName); - - /** - * Retrieves a list of objects matching the criteria. - * - * @param bucketName - * Name of the bucket in which to look for objects. - * @param options - * Supply {@link ListObjectOptions} - * @return a {@link ListPage<GoogleCloudStorageObject>} - */ - @Named("Object:list") - @GET - @Consumes(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o") - @Fallback(NullOnNotFoundOr404.class) - ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName, ListObjectOptions options); - - /** - * Updates an object metadata - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param objectTemplate - * Supply an {@link ObjectTemplate} - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:update") - @PUT - @Consumes(APPLICATION_JSON) - @Produces(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(NullOnNotFoundOr404.class) - GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate); - - /** - * Updates an object - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param objectTemplate - * Supply an{@link ObjectTemplate} - * @param options - * Supply {@link UpdateObjectOptions} with optional query parameters - * - * @return a {@link GoogleCloudStorageObject} . - */ - @Named("Object:update") - @PUT - @Consumes(APPLICATION_JSON) - @Produces(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(NullOnNotFoundOr404.class) - GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options); - - /** - * Updates an object according to patch semantics - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param objectTemplate - * Supply {@link ObjectTemplate} with optional query parameters - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:patch") - @PATCH - @Consumes(APPLICATION_JSON) - @Produces(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(NullOnNotFoundOr404.class) - GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate); - - /** - * Updates an object according to patch semantics - * - * @param bucketName - * Name of the bucket in which the object resides - * @param objectName - * Name of the object - * @param objectTemplate - * Supply {@link ObjectTemplate} with optional query parameters - * @param options - * Supply {@link UpdateObjectOptions} with optional query parameters - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:patch") - @PUT - @Consumes(APPLICATION_JSON) - @Produces(APPLICATION_JSON) - @Path("storage/v1/b/{bucket}/o/{object}") - @Fallback(NullOnNotFoundOr404.class) - GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName, - @PathParam("object") @Encoded String objectName, - @BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options); - - /** - * Concatenates a list of existing objects into a new object in the same bucket. - * - * @param destinationBucket - * Name of the bucket in which the object to be stored - * @param destinationObject - * The type of upload request. - * @param composeObjectTemplate - * Supply a {@link ComposeObjectTemplate} - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:compose") - @POST - @Consumes(APPLICATION_JSON) - @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose") - GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate); - - /** - * Concatenates a list of existing objects into a new object in the same bucket. - * - * @param destinationBucket - * Name of the bucket in which the object to be stored - * @param destinationObject - * The type of upload request. - * @param composeObjectTemplate - * Supply a {@link ComposeObjectTemplate} - * @param options - * Supply an {@link ComposeObjectOptions} - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:compose") - @POST - @Consumes(APPLICATION_JSON) - @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose") - GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate, - ComposeObjectOptions options); - - /** - * Copies an object to a specified location. - * - * @param destinationBucket - * Name of the bucket in which to store the new object - * @param destinationObject - * Name of the new object. - * @param sourceBucket - * Name of the bucket in which to find the source object - * @param sourceObject - * Name of the source object - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:copy") - @POST - @Consumes(APPLICATION_JSON) - @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}") - GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @PathParam("sourceBucket") String sourceBucket, - @PathParam("sourceObject") @Encoded String sourceObject); - - /** - * Copies an object to a specified location with updated metadata. - * - * @param destinationBucket - * Name of the bucket in which to store the new object - * @param destinationObject - * Name of the new object. - * @param sourceBucket - * Name of the bucket in which to find the source object - * @param sourceObject - * Name of the source object - * @param template - * Supply a {@link CopyObjectOptions} - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:copy") - @POST - @Consumes(APPLICATION_JSON) - @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}") - GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @PathParam("sourceBucket") String sourceBucket, - @PathParam("sourceObject") @Encoded String sourceObject, - @BinderParam(BindToJsonPayload.class) ObjectTemplate template); - - /** - * Copies an object to a specified location. Optionally overrides metadata. - * - * @param destinationBucket - * Name of the bucket in which to store the new object - * @param destinationObject - * Name of the new object. - * @param sourceBucket - * Name of the bucket in which to find the source object - * @param sourceObject - * Name of the source object - * @param options - * Supply a {@link CopyObjectOptions} - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:copy") - @POST - @Consumes(APPLICATION_JSON) - @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}") - GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @PathParam("sourceBucket") String sourceBucket, - @PathParam("sourceObject") @Encoded String sourceObject, CopyObjectOptions options); - - /** - * Stores a new object with metadata. - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#multipart - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param objectTemplate - * Supply an {@link ObjectTemplate}. - * - * @return a {@link GoogleCloudStorageObject} - */ - @Named("Object:multipartUpload") - @POST - @QueryParams(keys = "uploadType", values = "multipart") - @Consumes(APPLICATION_JSON) - @Path("/upload/storage/v1/b/{bucket}/o") - @MapBinder(MultipartUploadBinder.class) - GoogleCloudStorageObject multipartUpload(@PathParam("bucket") String bucketName, - @PayloadParam("template") ObjectTemplate objectTemplate, - @PayloadParam("payload") Payload payload); - - /** - * Rewrites a source object to a destination object. - * - * @param destinationBucket - * Name of the bucket in which the object to be stored - * @param destinationObject - * Name of the new object. - * @param sourceBucket - * Name of the bucket in which to find the source object. - * @param sourceObject - * Name of the source object. - * - * @return a {@link RewriteResponse} - */ - @Named("Object:rewrite") - @POST - @Consumes(APPLICATION_JSON) - @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}") - RewriteResponse rewriteObjects(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @PathParam("sourceBucket") String sourceBucket, @PathParam("sourceObject") @Encoded String sourceObject); - - /** - * Rewrites a source object to a destination object. - * - * @param destinationBucket - * Name of the bucket in which the object to be stored - * @param destinationObject - * Name of the new object. - * @param sourceBucket - * Name of the bucket in which to find the source object. - * @param sourceObject - * Name of the source object. - * @param options - * Supply an {@link RewriteObjectOptions} - * - * @return a {@link RewriteResponse} - */ - @Named("Object:rewrite") - @POST - @Consumes(APPLICATION_JSON) - @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}") - RewriteResponse rewriteObjects(@PathParam("destinationBucket") String destinationBucket, - @PathParam("destinationObject") @Encoded String destinationObject, - @PathParam("sourceBucket") String sourceBucket, - @PathParam("sourceObject") @Encoded String sourceObject, - RewriteObjectOptions options); -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java deleted file mode 100644 index 9ec41ab..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/features/ResumableUploadApi.java +++ /dev/null @@ -1,185 +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.googlecloudstorage.features; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; - -import org.jclouds.googlecloudstorage.binders.UploadBinder; -import org.jclouds.googlecloudstorage.domain.ResumableUpload; -import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate; -import org.jclouds.googlecloudstorage.options.InsertObjectOptions; -import org.jclouds.googlecloudstorage.parser.ParseToResumableUpload; -import org.jclouds.io.Payload; -import org.jclouds.oauth.v2.filters.OAuthFilter; -import org.jclouds.rest.annotations.BinderParam; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.QueryParams; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SkipEncoding; -import org.jclouds.rest.binders.BindToJsonPayload; - -/** - * Provides Resumable Upload support via Rest API - * - * @see <a href="https://developers.google.com/storage/docs/json_api/v1/objects"/> - * @see <a href="https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable"/> - */ -@SkipEncoding({ '/', '=' }) -@RequestFilters(OAuthFilter.class) -@Consumes(APPLICATION_JSON) -public interface ResumableUploadApi { - - /** - * initiate a Resumable Upload Session - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param objectName - * Name of the object to upload - * @param contentType - * Content type of the uploaded data - * @param contentLength - * ContentLength of the uploaded object (Media part) - * - * @return a {@link ResumableUpload} - */ - @Named("Object:initResumableUpload") - @POST - @QueryParams(keys = "uploadType", values = "resumable") - @Path("/upload/storage/v1/b/{bucket}/o") - @ResponseParser(ParseToResumableUpload.class) - ResumableUpload initResumableUpload(@PathParam("bucket") String bucketName, @QueryParam("name") String objectName, - @HeaderParam("X-Upload-Content-Type") String contentType, - @HeaderParam("X-Upload-Content-Length") String contentLength); - - /** - * initiate a Resumable Upload Session - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#simple - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param contentType - * Content type of the uploaded data (Media part) - * @param contentLength - * Content length of the uploaded data (Media part) - * @param metada - * Supply an {@link ObjectTemplate} - * - * @return a {@link ResumableUpload} - */ - @Named("Object:resumableUpload") - @POST - @QueryParams(keys = "uploadType", values = "resumable") - @Path("/upload/storage/v1/b/{bucket}/o") - @ResponseParser(ParseToResumableUpload.class) - ResumableUpload initResumableUpload(@PathParam("bucket") String bucketName, - @HeaderParam("X-Upload-Content-Type") String contentType, - @HeaderParam("X-Upload-Content-Length") Long contentLength, - @BinderParam(BindToJsonPayload.class) ObjectTemplate metadata); - - /** - * Stores a new object - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param options - * Supply {@link InsertObjectOptions} with optional query parameters. 'name' is mandatory. - * - * @return If successful, this method returns a {@link GoogleCloudStorageObject} resource. - */ - @Named("Object:resumableUpload") - @PUT - @QueryParams(keys = "uploadType", values = "resumable") - @Path("/upload/storage/v1/b/{bucket}/o") - @MapBinder(UploadBinder.class) - @ResponseParser(ParseToResumableUpload.class) - ResumableUpload upload(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Content-Length") String contentLength, - @PayloadParam("payload") Payload payload); - - /** - * Facilitate to use resumable upload operation to upload files in chunks - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param uploadId - * uploadId returned from initResumableUpload operation - * @param contentType - * Content type of the uploaded data - * @param contentLength - * Content length of the uploaded data - * @param contentRange - * Range in {bytes StartingByte - Endingbyte/Totalsize } format ex: bytes 0 - 1213/2000 - * @param payload - * a {@link Payload} with actual data to upload - * - * @return a {@link ResumableUpload} - */ - @Named("Object:Upload") - @PUT - @QueryParams(keys = "uploadType", values = "resumable") - @Path("/upload/storage/v1/b/{bucket}/o") - @MapBinder(UploadBinder.class) - @ResponseParser(ParseToResumableUpload.class) - ResumableUpload chunkUpload(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId, - @HeaderParam("Content-Type") String contentType, @HeaderParam("Content-Length") Long contentLength, - @HeaderParam("Content-Range") String contentRange, @PayloadParam("payload") Payload payload); - - /** - * Check the status of a resumable upload - * - * @see https://developers.google.com/storage/docs/json_api/v1/how-tos/upload#resumable - * - * @param bucketName - * Name of the bucket in which the object to be stored - * @param uploadId - * uploadId returned from initResumableUpload operation - * @param contentRange - * Range in {bytes StartingByte - Endingbyte/Totalsize } format ex: bytes 0 - 1213/2000 - * - * @return a {@link ResumableUpload} - */ - - @Named("Object:Upload") - @PUT - @DefaultValue("0") - @QueryParams(keys = "uploadType", values = "resumable") - @Path("/upload/storage/v1/b/{bucket}/o") - @ResponseParser(ParseToResumableUpload.class) - ResumableUpload checkStatus(@PathParam("bucket") String bucketName, @QueryParam("upload_id") String uploadId, - @HeaderParam("Content-Range") String contentRange); - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java deleted file mode 100644 index d330146..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageErrorHandler.java +++ /dev/null @@ -1,75 +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.googlecloudstorage.handlers; - -import static org.jclouds.http.HttpUtils.closeClientButKeepContentStream; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.HttpResponseException; -import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.ResourceNotFoundException; - -/** - * This will parse and set an appropriate exception on the command object. - */ -@Singleton -public class GoogleCloudStorageErrorHandler implements HttpErrorHandler { - public void handleError(HttpCommand command, HttpResponse response) { - // it is important to always read fully and close streams - byte[] data = closeClientButKeepContentStream(response); - String message = data != null ? new String(data) : null; - - Exception exception = message != null ? new HttpResponseException(command, response, message) - : new HttpResponseException(command, response); - message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(), - response.getStatusLine()); - - String message411 = "MissingContentLength: You must provide the Content-Length HTTP header.\n"; - String message412 = "PreconditionFailed: At least one of the pre-conditions you specified did not hold.\n"; - - switch (response.getStatusCode()) { - case 308: - return; - case 400: - if (message.indexOf("<Code>ExpiredToken</Code>") != -1) { - exception = new AuthorizationException(message, exception); - } - break; - case 401: - case 403: - exception = new AuthorizationException(message, exception); - break; - case 404: - exception = new ResourceNotFoundException(message, exception); - break; - case 409: - exception = new IllegalStateException(message, exception); - break; - case 411: - exception = new IllegalStateException(message411 + message, exception); - break; - case 412: - exception = new IllegalStateException(message412 + message, exception); - break; - } - command.setException(exception); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java deleted file mode 100644 index b7c236b..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/handlers/GoogleCloudStorageRedirectRetryHandler.java +++ /dev/null @@ -1,48 +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.googlecloudstorage.handlers; - -import javax.inject.Singleton; - -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpResponse; -import org.jclouds.http.handlers.BackoffLimitedRetryHandler; -import org.jclouds.http.handlers.RedirectionRetryHandler; - -import com.google.inject.Inject; - -/** - * This will parse and set an appropriate exception on the command object. - */ -@Singleton -public class GoogleCloudStorageRedirectRetryHandler extends RedirectionRetryHandler { - - @Inject - protected GoogleCloudStorageRedirectRetryHandler(BackoffLimitedRetryHandler backoffHandler) { - super(backoffHandler); - } - - @Override - public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { - if (response.getStatusCode() == 308) { - return false; - } else { - return super.shouldRetryRequest(command, response); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java deleted file mode 100644 index fb9eeb5..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/ComposeObjectOptions.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jclouds.googlecloudstorage.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl; -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and destinationPredefinedAcl when - * ComposingObjects operation. - */ -public class ComposeObjectOptions extends BaseHttpRequestOptions { - - public ComposeObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch") - + ""); - return this; - } - - public ComposeObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - this.queryParameters.put("ifMetagenerationNotMatch", - checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + ""); - return this; - } - - public ComposeObjectOptions destinationPredefinedAcl(DestinationPredefinedAcl destinationPredefinedAcl) { - this.queryParameters.put("destinationPredefinedAcl", - checkNotNull(destinationPredefinedAcl, "destinationPredefinedAcl").toString()); - return this; - } - - public static class Builder { - - public ComposeObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - return new ComposeObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch); - } - - public ComposeObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - return new ComposeObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch); - } - - public ComposeObjectOptions destinationPredefinedAcl(DestinationPredefinedAcl destinationPredefinedAcl) { - return new ComposeObjectOptions().destinationPredefinedAcl(destinationPredefinedAcl); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java deleted file mode 100644 index a003686..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/CopyObjectOptions.java +++ /dev/null @@ -1,153 +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.googlecloudstorage.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl; -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection; -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket - */ -public class CopyObjectOptions extends BaseHttpRequestOptions { - - public CopyObjectOptions contentEncoding(String contentEncoding) { - this.queryParameters.put("contentEncoding", checkNotNull(contentEncoding, "contentEncoding") + ""); - return this; - } - - public CopyObjectOptions name(String name) { - this.queryParameters.put("name", checkNotNull(name, "name") + ""); - return this; - } - - public CopyObjectOptions ifGenerationMatch(Long ifGenerationMatch) { - this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + ""); - return this; - } - - public CopyObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) { - this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + ""); - return this; - } - - public CopyObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch") - + ""); - return this; - } - - public CopyObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - this.queryParameters.put("ifMetagenerationNotMatch", - checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + ""); - return this; - } - public CopyObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) { - this.queryParameters.put("ifSourceGenerationMatch", checkNotNull(ifSourceGenerationMatch, "ifSourceGenerationMatch") + ""); - return this; - } - - public CopyObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) { - this.queryParameters.put("ifSourceGenerationNotMatch", checkNotNull(ifSourceGenerationNotMatch, "ifSourceGenerationNotMatch") + ""); - return this; - } - - public CopyObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) { - this.queryParameters.put("ifSourceMetagenerationMatch", checkNotNull(ifSourceMetagenerationMatch, "ifSourceMetagenerationMatch") - + ""); - return this; - } - - public CopyObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) { - this.queryParameters.put("ifSourceMetagenerationNotMatch", - checkNotNull(ifSourceMetagenerationNotMatch, "ifSourceMetagenerationNotMatch") + ""); - return this; - } - - public CopyObjectOptions sourceGeneration(Long sourceGeneration) { - this.queryParameters.put("sourceGeneration", checkNotNull(sourceGeneration, "sourceGeneration") + ""); - return this; - } - - public CopyObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) { - this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString()); - return this; - } - - public CopyObjectOptions projection(Projection projection) { - this.queryParameters.put("projection", checkNotNull(projection, "projection").toString()); - return this; - } - - public static class Builder { - - public CopyObjectOptions contentEncoding(String contentEncoding) { - return new CopyObjectOptions().contentEncoding(contentEncoding); - } - - public CopyObjectOptions name(String name) { - return new CopyObjectOptions().name(name); - } - - public CopyObjectOptions ifGenerationMatch(Long ifGenerationMatch) { - return new CopyObjectOptions().ifGenerationMatch(ifGenerationMatch); - } - - public CopyObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) { - return new CopyObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch); - } - - public CopyObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - return new CopyObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch); - } - - public CopyObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - return new CopyObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch); - } - - public CopyObjectOptions ifSourceGenerationMatch(Long ifSourceGenerationMatch) { - return new CopyObjectOptions().ifSourceGenerationMatch(ifSourceGenerationMatch); - } - - public CopyObjectOptions ifSourceGenerationNotMatch(Long ifSourceGenerationNotMatch) { - return new CopyObjectOptions().ifSourceGenerationNotMatch(ifSourceGenerationNotMatch); - } - - public CopyObjectOptions ifSourceMetagenerationMatch(Long ifSourceMetagenerationMatch) { - return new CopyObjectOptions().ifSourceMetagenerationMatch(ifSourceMetagenerationMatch); - } - - public CopyObjectOptions ifSourceMetagenerationNotMatch(Long ifSourceMetagenerationNotMatch) { - return new CopyObjectOptions().ifSourceMetagenerationNotMatch(ifSourceMetagenerationNotMatch); - } - - - public CopyObjectOptions sourceGeneration(Long sourceGeneration) { - return new CopyObjectOptions().sourceGeneration(sourceGeneration); - } - - public CopyObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) { - return new CopyObjectOptions().predefinedAcl(predefinedAcl); - } - - public UpdateObjectOptions projection(Projection projection) { - return new UpdateObjectOptions().projection(projection); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java deleted file mode 100644 index e6bcb73..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteBucketOptions.java +++ /dev/null @@ -1,51 +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.googlecloudstorage.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket - */ -public class DeleteBucketOptions extends BaseHttpRequestOptions { - - public DeleteBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch") - + ""); - return this; - } - - public DeleteBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - this.queryParameters.put("ifMetagenerationNotMatch", - checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + ""); - return this; - } - - public static class Builder { - - public DeleteBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - return new DeleteBucketOptions().ifMetagenerationMatch(ifMetagenerationMatch); - } - - public DeleteBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - return new DeleteBucketOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch); - } - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java deleted file mode 100644 index d2c0d01..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/DeleteObjectOptions.java +++ /dev/null @@ -1,88 +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.googlecloudstorage.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.PredefinedAcl; -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket - */ -public class DeleteObjectOptions extends BaseHttpRequestOptions { - - public DeleteObjectOptions ifGenerationMatch(Long ifGenerationMatch) { - this.queryParameters.put("ifGenerationMatch", checkNotNull(ifGenerationMatch, "ifGenerationMatch") + ""); - return this; - } - - public DeleteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) { - this.queryParameters.put("ifGenerationNotMatch", checkNotNull(ifGenerationNotMatch, "ifGenerationNotMatch") + ""); - return this; - } - - public DeleteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch") - + ""); - return this; - } - - public DeleteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - this.queryParameters.put("ifMetagenerationNotMatch", - checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + ""); - return this; - } - - public DeleteObjectOptions generation(Long generation) { - this.queryParameters.put("generation", checkNotNull(generation, "generation").toString()); - return this; - } - - public DeleteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) { - this.queryParameters.put("predefinedAcl", checkNotNull(predefinedAcl, "predefinedAcl").toString()); - return this; - } - - public static class Builder { - - public DeleteObjectOptions ifGenerationMatch(Long ifGenerationMatch) { - return new DeleteObjectOptions().ifGenerationMatch(ifGenerationMatch); - } - - public DeleteObjectOptions ifGenerationNotMatch(Long ifGenerationNotMatch) { - return new DeleteObjectOptions().ifGenerationNotMatch(ifGenerationNotMatch); - } - - public DeleteObjectOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - return new DeleteObjectOptions().ifMetagenerationMatch(ifMetagenerationMatch); - } - - public DeleteObjectOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - return new DeleteObjectOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch); - } - - public DeleteObjectOptions generation(Long generation) { - return new DeleteObjectOptions().generation(generation); - } - - public DeleteObjectOptions predefinedAcl(PredefinedAcl predefinedAcl) { - return new DeleteObjectOptions().predefinedAcl(predefinedAcl); - } - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/a4acb11f/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java ---------------------------------------------------------------------- diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java deleted file mode 100644 index 9d992fa..0000000 --- a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/options/GetBucketOptions.java +++ /dev/null @@ -1,61 +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.googlecloudstorage.options; - -import static com.google.common.base.Preconditions.checkNotNull; - -import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection; -import org.jclouds.http.options.BaseHttpRequestOptions; - -/** - * Allows to optionally specify ifMetagenerationMatch,ifMetagenerationNotMatch and projection which used in Bucket - */ -public class GetBucketOptions extends BaseHttpRequestOptions { - - public GetBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - this.queryParameters.put("ifMetagenerationMatch", checkNotNull(ifMetagenerationMatch, "ifMetagenerationMatch") - + ""); - return this; - } - - public GetBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - this.queryParameters.put("ifMetagenerationNotMatch", - checkNotNull(ifMetagenerationNotMatch, "ifMetagenerationNotMatch") + ""); - return this; - } - - public GetBucketOptions projection(Projection projection) { - this.queryParameters.put("projection", checkNotNull(projection, "projection").toString()); - return this; - } - - public static class Builder { - - public GetBucketOptions ifMetagenerationMatch(Long ifMetagenerationMatch) { - return new GetBucketOptions().ifMetagenerationMatch(ifMetagenerationMatch); - } - - public GetBucketOptions ifMetagenerationNotMatch(Long ifMetagenerationNotMatch) { - return new GetBucketOptions().ifMetagenerationNotMatch(ifMetagenerationNotMatch); - } - - public GetBucketOptions projection(Projection projection) { - return new GetBucketOptions().projection(projection); - } - - } -}
