mirror of https://github.com/apache/jclouds.git
Be consistent in naming, as opposed to GCS here and GoogleCloudStorage there.
This commit is contained in:
parent
6e30fc611a
commit
f1f16bcd68
|
@ -67,13 +67,11 @@ public interface GoogleCloudStorageApi extends Closeable {
|
||||||
* Provides access to Google Cloud Storage Object features
|
* Provides access to Google Cloud Storage Object features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
@Path("")
|
|
||||||
ObjectApi getObjectApi();
|
ObjectApi getObjectApi();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to Google Cloud Storage ResumableUpload features
|
* Provides access to Google Cloud Storage ResumableUpload features
|
||||||
*/
|
*/
|
||||||
@Delegate
|
@Delegate
|
||||||
@Path("")
|
|
||||||
ResumableUploadApi getResumableUploadApi();
|
ResumableUploadApi getResumableUploadApi();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ import org.jclouds.googlecloudstorage.blobstore.functions.ObjectToBlobMetadata;
|
||||||
import org.jclouds.googlecloudstorage.blobstore.strategy.internal.MultipartUploadStrategy;
|
import org.jclouds.googlecloudstorage.blobstore.strategy.internal.MultipartUploadStrategy;
|
||||||
import org.jclouds.googlecloudstorage.domain.Bucket;
|
import org.jclouds.googlecloudstorage.domain.Bucket;
|
||||||
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences;
|
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.ObjectAccessControlsTemplate;
|
||||||
|
@ -71,7 +71,7 @@ import com.google.common.collect.Iterables;
|
||||||
import com.google.common.hash.HashCode;
|
import com.google.common.hash.HashCode;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
|
|
||||||
public final class GCSBlobStore extends BaseBlobStore {
|
public final class GoogleCloudStorageBlobStore extends BaseBlobStore {
|
||||||
|
|
||||||
private final GoogleCloudStorageApi api;
|
private final GoogleCloudStorageApi api;
|
||||||
private final BucketToStorageMetadata bucketToStorageMetadata;
|
private final BucketToStorageMetadata bucketToStorageMetadata;
|
||||||
|
@ -83,7 +83,7 @@ public final class GCSBlobStore extends BaseBlobStore {
|
||||||
private final MultipartUploadStrategy multipartUploadStrategy;
|
private final MultipartUploadStrategy multipartUploadStrategy;
|
||||||
private final Supplier<String> projectId;
|
private final Supplier<String> projectId;
|
||||||
|
|
||||||
@Inject GCSBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
|
@Inject GoogleCloudStorageBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier<Location> defaultLocation,
|
||||||
@Memoized Supplier<Set<? extends Location>> locations, GoogleCloudStorageApi api,
|
@Memoized Supplier<Set<? extends Location>> locations, GoogleCloudStorageApi api,
|
||||||
BucketToStorageMetadata bucketToStorageMetadata, ObjectToBlobMetadata objectToBlobMetadata,
|
BucketToStorageMetadata bucketToStorageMetadata, ObjectToBlobMetadata objectToBlobMetadata,
|
||||||
ObjectListToStorageMetadata objectListToStorageMetadata,
|
ObjectListToStorageMetadata objectListToStorageMetadata,
|
||||||
|
@ -153,7 +153,7 @@ public final class GCSBlobStore extends BaseBlobStore {
|
||||||
/** Returns list of of all the objects */
|
/** Returns list of of all the objects */
|
||||||
@Override
|
@Override
|
||||||
public PageSet<? extends StorageMetadata> list(String container) {
|
public PageSet<? extends StorageMetadata> list(String container) {
|
||||||
ListPageWithPrefixes<GCSObject> gcsList = api.getObjectApi().listObjects(container);
|
ListPageWithPrefixes<GoogleCloudStorageObject> gcsList = api.getObjectApi().listObjects(container);
|
||||||
PageSet<? extends StorageMetadata> list = objectListToStorageMetadata.apply(gcsList);
|
PageSet<? extends StorageMetadata> list = objectListToStorageMetadata.apply(gcsList);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public final class GCSBlobStore extends BaseBlobStore {
|
||||||
public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) {
|
public PageSet<? extends StorageMetadata> list(String container, ListContainerOptions options) {
|
||||||
if (options != null && options != ListContainerOptions.NONE) {
|
if (options != null && options != ListContainerOptions.NONE) {
|
||||||
ListObjectOptions listOptions = listContainerOptionsToListObjectOptions.apply(options);
|
ListObjectOptions listOptions = listContainerOptionsToListObjectOptions.apply(options);
|
||||||
ListPageWithPrefixes<GCSObject> gcsList = api.getObjectApi().listObjects(container, listOptions);
|
ListPageWithPrefixes<GoogleCloudStorageObject> gcsList = api.getObjectApi().listObjects(container, listOptions);
|
||||||
PageSet<? extends StorageMetadata> list = objectListToStorageMetadata.apply(gcsList);
|
PageSet<? extends StorageMetadata> list = objectListToStorageMetadata.apply(gcsList);
|
||||||
return options.isDetailed() ? fetchBlobMetadataProvider.get().setContainerName(container).apply(list) : list;
|
return options.isDetailed() ? fetchBlobMetadataProvider.get().setContainerName(container).apply(list) : list;
|
||||||
} else {
|
} else {
|
||||||
|
@ -216,7 +216,7 @@ public final class GCSBlobStore extends BaseBlobStore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Blob getBlob(String container, String name, GetOptions options) {
|
public Blob getBlob(String container, String name, GetOptions options) {
|
||||||
GCSObject gcsObject = api.getObjectApi().getObject(container, name);
|
GoogleCloudStorageObject gcsObject = api.getObjectApi().getObject(container, name);
|
||||||
if (gcsObject == null) {
|
if (gcsObject == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ public final class GCSBlobStore extends BaseBlobStore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean deleteAndVerifyContainerGone(String container) {
|
protected boolean deleteAndVerifyContainerGone(String container) {
|
||||||
ListPageWithPrefixes<GCSObject> list = api.getObjectApi().listObjects(container);
|
ListPageWithPrefixes<GoogleCloudStorageObject> list = api.getObjectApi().listObjects(container);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
return api.getBucketApi().deleteBucket(container);
|
return api.getBucketApi().deleteBucket(container);
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@ package org.jclouds.googlecloudstorage.blobstore.config;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStore;
|
import org.jclouds.blobstore.BlobStore;
|
||||||
import org.jclouds.blobstore.attr.ConsistencyModel;
|
import org.jclouds.blobstore.attr.ConsistencyModel;
|
||||||
import org.jclouds.googlecloudstorage.blobstore.GCSBlobStore;
|
import org.jclouds.googlecloudstorage.blobstore.GoogleCloudStorageBlobStore;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Scopes;
|
import com.google.inject.Scopes;
|
||||||
|
@ -28,6 +28,6 @@ public class GoogleCloudStorageBlobStoreContextModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
|
bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL);
|
||||||
bind(BlobStore.class).to(GCSBlobStore.class).in(Scopes.SINGLETON);
|
bind(BlobStore.class).to(GoogleCloudStorageBlobStore.class).in(Scopes.SINGLETON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.blobstore.domain.StorageMetadata;
|
||||||
import org.jclouds.blobstore.domain.StorageType;
|
import org.jclouds.blobstore.domain.StorageType;
|
||||||
import org.jclouds.blobstore.domain.internal.PageSetImpl;
|
import org.jclouds.blobstore.domain.internal.PageSetImpl;
|
||||||
import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
|
import org.jclouds.blobstore.domain.internal.StorageMetadataImpl;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -34,14 +34,14 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
public class ObjectListToStorageMetadata
|
public class ObjectListToStorageMetadata
|
||||||
implements Function<ListPageWithPrefixes<GCSObject>, PageSet<? extends StorageMetadata>> {
|
implements Function<ListPageWithPrefixes<GoogleCloudStorageObject>, PageSet<? extends StorageMetadata>> {
|
||||||
private final ObjectToBlobMetadata object2blobMd;
|
private final ObjectToBlobMetadata object2blobMd;
|
||||||
|
|
||||||
@Inject public ObjectListToStorageMetadata(ObjectToBlobMetadata object2blobMd) {
|
@Inject public ObjectListToStorageMetadata(ObjectToBlobMetadata object2blobMd) {
|
||||||
this.object2blobMd = object2blobMd;
|
this.object2blobMd = object2blobMd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageSet<? extends StorageMetadata> apply(ListPageWithPrefixes<GCSObject> from) {
|
public PageSet<? extends StorageMetadata> apply(ListPageWithPrefixes<GoogleCloudStorageObject> from) {
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
from = ListPageWithPrefixes.create(null, null, null);
|
from = ListPageWithPrefixes.create(null, null, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,21 +22,21 @@ import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
||||||
import org.jclouds.blobstore.domain.StorageType;
|
import org.jclouds.blobstore.domain.StorageType;
|
||||||
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
|
import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
|
||||||
import org.jclouds.blobstore.strategy.IfDirectoryReturnNameStrategy;
|
import org.jclouds.blobstore.strategy.IfDirectoryReturnNameStrategy;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.javax.annotation.Nullable;
|
import org.jclouds.javax.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.hash.HashCode;
|
import com.google.common.hash.HashCode;
|
||||||
import com.google.common.io.BaseEncoding;
|
import com.google.common.io.BaseEncoding;
|
||||||
|
|
||||||
public class ObjectToBlobMetadata implements Function<GCSObject, MutableBlobMetadata> {
|
public class ObjectToBlobMetadata implements Function<GoogleCloudStorageObject, MutableBlobMetadata> {
|
||||||
private final IfDirectoryReturnNameStrategy ifDirectoryReturnName;
|
private final IfDirectoryReturnNameStrategy ifDirectoryReturnName;
|
||||||
|
|
||||||
@Inject public ObjectToBlobMetadata(IfDirectoryReturnNameStrategy ifDirectoryReturnName) {
|
@Inject public ObjectToBlobMetadata(IfDirectoryReturnNameStrategy ifDirectoryReturnName) {
|
||||||
this.ifDirectoryReturnName = ifDirectoryReturnName;
|
this.ifDirectoryReturnName = ifDirectoryReturnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MutableBlobMetadata apply(GCSObject from) {
|
public MutableBlobMetadata apply(GoogleCloudStorageObject from) {
|
||||||
if (from == null) {
|
if (from == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.blobstore.domain.BlobBuilder;
|
import org.jclouds.blobstore.domain.BlobBuilder;
|
||||||
import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
|
import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
|
||||||
import org.jclouds.googlecloudstorage.blobstore.functions.BlobMetadataToObjectTemplate;
|
import org.jclouds.googlecloudstorage.blobstore.functions.BlobMetadataToObjectTemplate;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
||||||
import org.jclouds.io.Payload;
|
import org.jclouds.io.Payload;
|
||||||
|
@ -60,7 +60,7 @@ public final class SequentialMultipartUploadStrategy extends MultipartUploadStra
|
||||||
|
|
||||||
ObjectTemplate destination = blob2ObjectTemplate.apply(blob.getMetadata());
|
ObjectTemplate destination = blob2ObjectTemplate.apply(blob.getMetadata());
|
||||||
|
|
||||||
List<GCSObject> sourceList = Lists.newArrayList();
|
List<GoogleCloudStorageObject> sourceList = Lists.newArrayList();
|
||||||
|
|
||||||
String key = blob.getMetadata().getName();
|
String key = blob.getMetadata().getName();
|
||||||
Payload payload = blob.getPayload();
|
Payload payload = blob.getPayload();
|
||||||
|
@ -81,7 +81,7 @@ public final class SequentialMultipartUploadStrategy extends MultipartUploadStra
|
||||||
Blob blobPart = blobBuilders.get().name(partName).payload(part).contentDisposition(partName)
|
Blob blobPart = blobBuilders.get().name(partName).payload(part).contentDisposition(partName)
|
||||||
.contentLength(partSize).contentType(blob.getMetadata().getContentMetadata().getContentType())
|
.contentLength(partSize).contentType(blob.getMetadata().getContentMetadata().getContentType())
|
||||||
.build();
|
.build();
|
||||||
GCSObject object = api.getObjectApi().multipartUpload(container,
|
GoogleCloudStorageObject object = api.getObjectApi().multipartUpload(container,
|
||||||
blob2ObjectTemplate.apply(blobPart.getMetadata()), blobPart.getPayload());
|
blob2ObjectTemplate.apply(blobPart.getMetadata()), blobPart.getPayload());
|
||||||
sourceList.add(object);
|
sourceList.add(object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import com.google.auto.value.AutoValue;
|
||||||
*/
|
*/
|
||||||
@AutoValue
|
@AutoValue
|
||||||
// TODO: nullable sweep
|
// TODO: nullable sweep
|
||||||
public abstract class GCSObject {
|
public abstract class GoogleCloudStorageObject {
|
||||||
|
|
||||||
public abstract String id();
|
public abstract String id();
|
||||||
public abstract URI selfLink();
|
public abstract URI selfLink();
|
||||||
|
@ -67,12 +67,12 @@ public abstract class GCSObject {
|
||||||
{ "id", "selfLink", "etag", "name", "bucket", "generation", "metageneration", "contentType", "updated",
|
{ "id", "selfLink", "etag", "name", "bucket", "generation", "metageneration", "contentType", "updated",
|
||||||
"timeDeleted", "storageClass", "size", "md5Hash", "mediaLink", "metadata", "contentEncoding",
|
"timeDeleted", "storageClass", "size", "md5Hash", "mediaLink", "metadata", "contentEncoding",
|
||||||
"contentDisposition", "contentLanguage", "cacheControl", "acl", "owner", "crc32c", "componentCount" })
|
"contentDisposition", "contentLanguage", "cacheControl", "acl", "owner", "crc32c", "componentCount" })
|
||||||
public static GCSObject create(String id, URI selfLink, String etag, String name, String bucket, long generation,
|
public static GoogleCloudStorageObject create(String id, URI selfLink, String etag, String name, String bucket, long generation,
|
||||||
long metageneration, String contentType, Date updated, Date timeDeleted, StorageClass storageClass, long size,
|
long metageneration, String contentType, Date updated, Date timeDeleted, StorageClass storageClass, long size,
|
||||||
String md5Hash, URI mediaLink, Map<String, String> metadata, String contentEncoding, String contentDisposition,
|
String md5Hash, URI mediaLink, Map<String, String> metadata, String contentEncoding, String contentDisposition,
|
||||||
String contentLanguage, String cacheControl, List<ObjectAccessControls> acl, Owner owner, String crc32c,
|
String contentLanguage, String cacheControl, List<ObjectAccessControls> acl, Owner owner, String crc32c,
|
||||||
Integer componentCount) {
|
Integer componentCount) {
|
||||||
return new AutoValue_GCSObject(id, selfLink, etag, name, bucket, generation, metageneration, contentType, updated,
|
return new AutoValue_GoogleCloudStorageObject(id, selfLink, etag, name, bucket, generation, metageneration, contentType, updated,
|
||||||
timeDeleted, storageClass, size, md5Hash, mediaLink, copyOf(metadata), contentEncoding, contentDisposition,
|
timeDeleted, storageClass, size, md5Hash, mediaLink, copyOf(metadata), contentEncoding, contentDisposition,
|
||||||
contentLanguage, cacheControl, copyOf(acl), owner, crc32c, componentCount);
|
contentLanguage, cacheControl, copyOf(acl), owner, crc32c, componentCount);
|
||||||
}
|
}
|
|
@ -19,7 +19,7 @@ package org.jclouds.googlecloudstorage.domain.templates;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
|
|
||||||
import com.google.auto.value.AutoValue;
|
import com.google.auto.value.AutoValue;
|
||||||
|
|
||||||
|
@ -28,11 +28,11 @@ public abstract class ComposeObjectTemplate {
|
||||||
|
|
||||||
private final String kind = "storage/composeRequest";
|
private final String kind = "storage/composeRequest";
|
||||||
|
|
||||||
public abstract List<GCSObject> sourceObjects();
|
public abstract List<GoogleCloudStorageObject> sourceObjects();
|
||||||
|
|
||||||
public abstract ObjectTemplate destination();
|
public abstract ObjectTemplate destination();
|
||||||
|
|
||||||
public static ComposeObjectTemplate create(List<GCSObject> sourceObjects, ObjectTemplate destination) {
|
public static ComposeObjectTemplate create(List<GoogleCloudStorageObject> sourceObjects, ObjectTemplate destination) {
|
||||||
return new AutoValue_ComposeObjectTemplate(sourceObjects, destination);
|
return new AutoValue_ComposeObjectTemplate(sourceObjects, destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
|
import org.jclouds.Fallbacks.TrueOnNotFoundOr404;
|
||||||
import org.jclouds.googlecloudstorage.binders.MultipartUploadBinder;
|
import org.jclouds.googlecloudstorage.binders.MultipartUploadBinder;
|
||||||
import org.jclouds.googlecloudstorage.binders.UploadBinder;
|
import org.jclouds.googlecloudstorage.binders.UploadBinder;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.ComposeObjectTemplate;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.ObjectTemplate;
|
||||||
|
@ -103,7 +103,7 @@ public interface ObjectApi {
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
@Nullable
|
@Nullable
|
||||||
GCSObject getObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName);
|
GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves objects metadata
|
* Retrieves objects metadata
|
||||||
|
@ -115,7 +115,7 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link GetObjectOptions} with optional query parameters
|
* Supply {@link GetObjectOptions} with optional query parameters
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:get")
|
@Named("Object:get")
|
||||||
@GET
|
@GET
|
||||||
|
@ -123,7 +123,7 @@ public interface ObjectApi {
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
@Nullable
|
@Nullable
|
||||||
GCSObject getObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
GoogleCloudStorageObject getObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
||||||
GetObjectOptions options);
|
GetObjectOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,7 +155,7 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link GetObjectOptions} with optional query parameters
|
* Supply {@link GetObjectOptions} with optional query parameters
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:get")
|
@Named("Object:get")
|
||||||
@GET
|
@GET
|
||||||
|
@ -176,7 +176,7 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply an {@link InsertObjectOptions}. 'name' should not null.
|
* Supply an {@link InsertObjectOptions}. 'name' should not null.
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:simpleUpload")
|
@Named("Object:simpleUpload")
|
||||||
@POST
|
@POST
|
||||||
|
@ -184,7 +184,7 @@ public interface ObjectApi {
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("/upload/storage/v1/b/{bucket}/o")
|
@Path("/upload/storage/v1/b/{bucket}/o")
|
||||||
@MapBinder(UploadBinder.class)
|
@MapBinder(UploadBinder.class)
|
||||||
GCSObject simpleUpload(@PathParam("bucket") String bucketName, @HeaderParam("Content-Type") String contentType,
|
GoogleCloudStorageObject simpleUpload(@PathParam("bucket") String bucketName, @HeaderParam("Content-Type") String contentType,
|
||||||
@HeaderParam("Content-Length") Long contentLength, @PayloadParam("payload") Payload payload,
|
@HeaderParam("Content-Length") Long contentLength, @PayloadParam("payload") Payload payload,
|
||||||
InsertObjectOptions Options);
|
InsertObjectOptions Options);
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ public interface ObjectApi {
|
||||||
@GET
|
@GET
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o")
|
@Path("storage/v1/b/{bucket}/o")
|
||||||
ListPageWithPrefixes<GCSObject> listObjects(@PathParam("bucket") String bucketName);
|
ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of objects matching the criteria.
|
* Retrieves a list of objects matching the criteria.
|
||||||
|
@ -239,13 +239,13 @@ public interface ObjectApi {
|
||||||
* Name of the bucket in which to look for objects.
|
* Name of the bucket in which to look for objects.
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link ListObjectOptions}
|
* Supply {@link ListObjectOptions}
|
||||||
* @return a {@link ListPage<GCSObject>}
|
* @return a {@link ListPage<GoogleCloudStorageObject>}
|
||||||
*/
|
*/
|
||||||
@Named("Object:list")
|
@Named("Object:list")
|
||||||
@GET
|
@GET
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o")
|
@Path("storage/v1/b/{bucket}/o")
|
||||||
ListPageWithPrefixes<GCSObject> listObjects(@PathParam("bucket") String bucketName, ListObjectOptions options);
|
ListPageWithPrefixes<GoogleCloudStorageObject> listObjects(@PathParam("bucket") String bucketName, ListObjectOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates an object metadata
|
* Updates an object metadata
|
||||||
|
@ -257,7 +257,7 @@ public interface ObjectApi {
|
||||||
* @param objectTemplate
|
* @param objectTemplate
|
||||||
* Supply an {@link ObjectTemplate}
|
* Supply an {@link ObjectTemplate}
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:update")
|
@Named("Object:update")
|
||||||
@PUT
|
@PUT
|
||||||
|
@ -265,7 +265,7 @@ public interface ObjectApi {
|
||||||
@Produces(APPLICATION_JSON)
|
@Produces(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o/{object}")
|
@Path("storage/v1/b/{bucket}/o/{object}")
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
GCSObject updateObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
||||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
|
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -280,7 +280,7 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link UpdateObjectOptions} with optional query parameters
|
* Supply {@link UpdateObjectOptions} with optional query parameters
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject} .
|
* @return a {@link GoogleCloudStorageObject} .
|
||||||
*/
|
*/
|
||||||
@Named("Object:update")
|
@Named("Object:update")
|
||||||
@PUT
|
@PUT
|
||||||
|
@ -288,7 +288,7 @@ public interface ObjectApi {
|
||||||
@Produces(APPLICATION_JSON)
|
@Produces(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o/{object}")
|
@Path("storage/v1/b/{bucket}/o/{object}")
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
GCSObject updateObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
GoogleCloudStorageObject updateObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
||||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
|
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +301,7 @@ public interface ObjectApi {
|
||||||
* @param objectTemplate
|
* @param objectTemplate
|
||||||
* Supply {@link ObjectTemplate} with optional query parameters
|
* Supply {@link ObjectTemplate} with optional query parameters
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:patch")
|
@Named("Object:patch")
|
||||||
@PATCH
|
@PATCH
|
||||||
|
@ -309,7 +309,7 @@ public interface ObjectApi {
|
||||||
@Produces(APPLICATION_JSON)
|
@Produces(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o/{object}")
|
@Path("storage/v1/b/{bucket}/o/{object}")
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
GCSObject patchObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
||||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
|
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,7 +324,7 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link UpdateObjectOptions} with optional query parameters
|
* Supply {@link UpdateObjectOptions} with optional query parameters
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:patch")
|
@Named("Object:patch")
|
||||||
@PUT
|
@PUT
|
||||||
|
@ -332,7 +332,7 @@ public interface ObjectApi {
|
||||||
@Produces(APPLICATION_JSON)
|
@Produces(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{bucket}/o/{object}")
|
@Path("storage/v1/b/{bucket}/o/{object}")
|
||||||
@Fallback(NullOnNotFoundOr404.class)
|
@Fallback(NullOnNotFoundOr404.class)
|
||||||
GCSObject patchObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
GoogleCloudStorageObject patchObject(@PathParam("bucket") String bucketName, @PathParam("object") String objectName,
|
||||||
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
|
@BinderParam(BindToJsonPayload.class) ObjectTemplate objectTemplate, UpdateObjectOptions options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -345,13 +345,13 @@ public interface ObjectApi {
|
||||||
* @param composeObjectTemplate
|
* @param composeObjectTemplate
|
||||||
* Supply a {@link ComposeObjectTemplate}
|
* Supply a {@link ComposeObjectTemplate}
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:compose")
|
@Named("Object:compose")
|
||||||
@POST
|
@POST
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
||||||
GCSObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
||||||
@PathParam("destinationObject") String destinationObject,
|
@PathParam("destinationObject") String destinationObject,
|
||||||
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate);
|
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate);
|
||||||
|
|
||||||
|
@ -367,13 +367,13 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply an {@link ComposeObjectOptions}
|
* Supply an {@link ComposeObjectOptions}
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:compose")
|
@Named("Object:compose")
|
||||||
@POST
|
@POST
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
@Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
|
||||||
GCSObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
GoogleCloudStorageObject composeObjects(@PathParam("destinationBucket") String destinationBucket,
|
||||||
@PathParam("destinationObject") String destinationObject,
|
@PathParam("destinationObject") String destinationObject,
|
||||||
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate,
|
@BinderParam(BindToJsonPayload.class) ComposeObjectTemplate composeObjectTemplate,
|
||||||
ComposeObjectOptions options);
|
ComposeObjectOptions options);
|
||||||
|
@ -390,13 +390,13 @@ public interface ObjectApi {
|
||||||
* @param sourceObject
|
* @param sourceObject
|
||||||
* Name of the source object
|
* Name of the source object
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:copy")
|
@Named("Object:copy")
|
||||||
@POST
|
@POST
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
|
@Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
|
||||||
GCSObject copyObject(@PathParam("destinationBucket") String destinationBucket,
|
GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket,
|
||||||
@PathParam("destinationObject") String destinationObject, @PathParam("sourceBucket") String sourceBucket,
|
@PathParam("destinationObject") String destinationObject, @PathParam("sourceBucket") String sourceBucket,
|
||||||
@PathParam("sourceObject") String sourceObject);
|
@PathParam("sourceObject") String sourceObject);
|
||||||
|
|
||||||
|
@ -414,13 +414,13 @@ public interface ObjectApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply a {@link CopyObjectOptions}
|
* Supply a {@link CopyObjectOptions}
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:copy")
|
@Named("Object:copy")
|
||||||
@POST
|
@POST
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
|
@Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
|
||||||
GCSObject copyObject(@PathParam("destinationBucket") String destinationBucket,
|
GoogleCloudStorageObject copyObject(@PathParam("destinationBucket") String destinationBucket,
|
||||||
@PathParam("destinationObject") String destinationObject, @PathParam("sourceBucket") String sourceBucket,
|
@PathParam("destinationObject") String destinationObject, @PathParam("sourceBucket") String sourceBucket,
|
||||||
@PathParam("sourceObject") String sourceObject, CopyObjectOptions options);
|
@PathParam("sourceObject") String sourceObject, CopyObjectOptions options);
|
||||||
|
|
||||||
|
@ -434,7 +434,7 @@ public interface ObjectApi {
|
||||||
* @param objectTemplate
|
* @param objectTemplate
|
||||||
* Supply an {@link ObjectTemplate}.
|
* Supply an {@link ObjectTemplate}.
|
||||||
*
|
*
|
||||||
* @return a {@link GCSObject}
|
* @return a {@link GoogleCloudStorageObject}
|
||||||
*/
|
*/
|
||||||
@Named("Object:multipartUpload")
|
@Named("Object:multipartUpload")
|
||||||
@POST
|
@POST
|
||||||
|
@ -442,7 +442,7 @@ public interface ObjectApi {
|
||||||
@Consumes(APPLICATION_JSON)
|
@Consumes(APPLICATION_JSON)
|
||||||
@Path("/upload/storage/v1/b/{bucket}/o")
|
@Path("/upload/storage/v1/b/{bucket}/o")
|
||||||
@MapBinder(MultipartUploadBinder.class)
|
@MapBinder(MultipartUploadBinder.class)
|
||||||
GCSObject multipartUpload(@PathParam("bucket") String bucketName,
|
GoogleCloudStorageObject multipartUpload(@PathParam("bucket") String bucketName,
|
||||||
@PayloadParam("template") ObjectTemplate objectTemplate,
|
@PayloadParam("template") ObjectTemplate objectTemplate,
|
||||||
@PayloadParam("payload") Payload payload);
|
@PayloadParam("payload") Payload payload);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ public interface ResumableUploadApi {
|
||||||
* @param options
|
* @param options
|
||||||
* Supply {@link InsertObjectOptions} with optional query parameters. 'name' is mandatory.
|
* Supply {@link InsertObjectOptions} with optional query parameters. 'name' is mandatory.
|
||||||
*
|
*
|
||||||
* @return If successful, this method returns a {@link GCSObject} resource.
|
* @return If successful, this method returns a {@link GoogleCloudStorageObject} resource.
|
||||||
*/
|
*/
|
||||||
@Named("Object:resumableUpload")
|
@Named("Object:resumableUpload")
|
||||||
@PUT
|
@PUT
|
||||||
|
|
|
@ -55,11 +55,11 @@ import com.google.common.io.ByteSource;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
@Test(groups = { "live", "blobstorelive" })
|
@Test(groups = { "live", "blobstorelive" })
|
||||||
public class GCSBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
public class GoogleCloudStorageBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
|
|
||||||
private long PART_SIZE = MultipartUpload.MIN_PART_SIZE;
|
private long PART_SIZE = MultipartUpload.MIN_PART_SIZE;
|
||||||
|
|
||||||
public GCSBlobIntegrationLiveTest() throws IOException {
|
public GoogleCloudStorageBlobIntegrationLiveTest() throws IOException {
|
||||||
provider = "google-cloud-storage";
|
provider = "google-cloud-storage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ public class GCSBlobIntegrationLiveTest extends BaseBlobIntegrationTest {
|
||||||
@Override
|
@Override
|
||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
public void testGetTwoRanges() throws SkipException {
|
public void testGetTwoRanges() throws SkipException {
|
||||||
// not supported in GCS
|
// not supported in GoogleCloudStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
public void testGetRange() throws SkipException {
|
public void testGetRange() throws SkipException {
|
||||||
// not supported in GCS
|
// not supported in GoogleCloudStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
|
@ -44,11 +44,11 @@ import com.google.common.io.BaseEncoding;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
|
|
||||||
@Test(groups = { "live" })
|
@Test(groups = { "live" })
|
||||||
public class GCSBlobLiveTest extends BaseBlobLiveTest {
|
public class GoogleCloudStorageBlobLiveTest extends BaseBlobLiveTest {
|
||||||
private static final String sysHttpStreamUrl = System.getProperty("jclouds.blobstore.httpstream.url");
|
private static final String sysHttpStreamUrl = System.getProperty("jclouds.blobstore.httpstream.url");
|
||||||
private static final String sysHttpStreamMD5 = System.getProperty("jclouds.blobstore.httpstream.md5");
|
private static final String sysHttpStreamMD5 = System.getProperty("jclouds.blobstore.httpstream.md5");
|
||||||
|
|
||||||
public GCSBlobLiveTest() {
|
public GoogleCloudStorageBlobLiveTest() {
|
||||||
provider = "google-cloud-storage";
|
provider = "google-cloud-storage";
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ import com.google.common.base.Charsets;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
|
|
||||||
public class GCSContainerIntegrationLiveTest extends BaseContainerIntegrationTest {
|
public class GoogleCloudStorageContainerIntegrationLiveTest extends BaseContainerIntegrationTest {
|
||||||
|
|
||||||
public GCSContainerIntegrationLiveTest() {
|
public GoogleCloudStorageContainerIntegrationLiveTest() {
|
||||||
provider = "google-cloud-storage";
|
provider = "google-cloud-storage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class GCSContainerIntegrationLiveTest extends BaseContainerIntegrationTes
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void testDirectory() throws InterruptedException {
|
public void testDirectory() throws InterruptedException {
|
||||||
// GCS does not support directories, rather it supports prefixes which look like directories.
|
// GoogleCloudStorage does not support directories, rather it supports prefixes which look like directories.
|
||||||
throw new SkipException("directories are not supported in GCS");
|
throw new SkipException("directories are not supported in GoogleCloudStorage");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,9 +23,9 @@ import org.jclouds.googlecloud.internal.TestProperties;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@Test(groups = { "live" })
|
@Test(groups = { "live" })
|
||||||
public class GCSContainerLiveTest extends BaseContainerLiveTest {
|
public class GoogleCloudStorageContainerLiveTest extends BaseContainerLiveTest {
|
||||||
|
|
||||||
public GCSContainerLiveTest() {
|
public GoogleCloudStorageContainerLiveTest() {
|
||||||
provider = "google-cloud-storage";
|
provider = "google-cloud-storage";
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.jclouds.googlecloudstorage.domain.Bucket;
|
||||||
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl;
|
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.DestinationPredefinedAcl;
|
||||||
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
|
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.ObjectRole;
|
||||||
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
|
import org.jclouds.googlecloudstorage.domain.DomainResourceReferences.Projection;
|
||||||
import org.jclouds.googlecloudstorage.domain.GCSObject;
|
import org.jclouds.googlecloudstorage.domain.GoogleCloudStorageObject;
|
||||||
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
import org.jclouds.googlecloudstorage.domain.ListPageWithPrefixes;
|
||||||
import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
|
import org.jclouds.googlecloudstorage.domain.ObjectAccessControls;
|
||||||
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
import org.jclouds.googlecloudstorage.domain.templates.BucketTemplate;
|
||||||
|
@ -113,7 +113,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME);
|
InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME);
|
||||||
|
|
||||||
GCSObject gcsObject = api().simpleUpload(BUCKET_NAME, "text/plain",
|
GoogleCloudStorageObject gcsObject = api().simpleUpload(BUCKET_NAME, "text/plain",
|
||||||
payload.getPayload().getContentMetadata().getContentLength(), payload.getPayload(), options);
|
payload.getPayload().getContentMetadata().getContentLength(), payload.getPayload(), options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
|
@ -144,7 +144,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME2);
|
InsertObjectOptions options = new InsertObjectOptions().name(UPLOAD_OBJECT_NAME2);
|
||||||
|
|
||||||
GCSObject gcsObject = api().simpleUpload(BUCKET_NAME, "image/jpeg", contentLength, payload, options);
|
GoogleCloudStorageObject gcsObject = api().simpleUpload(BUCKET_NAME, "image/jpeg", contentLength, payload, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertEquals(gcsObject.bucket(), BUCKET_NAME);
|
assertEquals(gcsObject.bucket(), BUCKET_NAME);
|
||||||
|
@ -159,7 +159,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
@Test(groups = "live", dependsOnMethods = "testSimpleUpload")
|
@Test(groups = "live", dependsOnMethods = "testSimpleUpload")
|
||||||
public void testGetObject() {
|
public void testGetObject() {
|
||||||
GCSObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME);
|
GoogleCloudStorageObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
GetObjectOptions options = new GetObjectOptions().ifGenerationMatch(generation)
|
GetObjectOptions options = new GetObjectOptions().ifGenerationMatch(generation)
|
||||||
.ifMetagenerationMatch(metageneration).ifGenerationNotMatch(generation + 1).projection(Projection.FULL);
|
.ifMetagenerationMatch(metageneration).ifGenerationNotMatch(generation + 1).projection(Projection.FULL);
|
||||||
|
|
||||||
GCSObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
|
GoogleCloudStorageObject gcsObject = api().getObject(BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -187,7 +187,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
@Test(groups = "live", dependsOnMethods = "testGetObject")
|
@Test(groups = "live", dependsOnMethods = "testGetObject")
|
||||||
public void testCopyObject() throws IOException {
|
public void testCopyObject() throws IOException {
|
||||||
GCSObject gcsObject = api().copyObject(BUCKET_NAME2, COPIED_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME);
|
GoogleCloudStorageObject gcsObject = api().copyObject(BUCKET_NAME2, COPIED_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertEquals(gcsObject.bucket(), BUCKET_NAME2);
|
assertEquals(gcsObject.bucket(), BUCKET_NAME2);
|
||||||
|
@ -208,7 +208,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
CopyObjectOptions options = new CopyObjectOptions().ifSourceGenerationMatch(generation)
|
CopyObjectOptions options = new CopyObjectOptions().ifSourceGenerationMatch(generation)
|
||||||
.ifSourceMetagenerationMatch(metageneration).projection(Projection.FULL);
|
.ifSourceMetagenerationMatch(metageneration).projection(Projection.FULL);
|
||||||
|
|
||||||
GCSObject gcsObject = api()
|
GoogleCloudStorageObject gcsObject = api()
|
||||||
.copyObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
|
.copyObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME, BUCKET_NAME, UPLOAD_OBJECT_NAME, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
|
@ -224,13 +224,13 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
.role(ObjectRole.OWNER).build();
|
.role(ObjectRole.OWNER).build();
|
||||||
|
|
||||||
ObjectTemplate destination = new ObjectTemplate().contentType("text/plain").addAcl(oacl);
|
ObjectTemplate destination = new ObjectTemplate().contentType("text/plain").addAcl(oacl);
|
||||||
List<GCSObject> sourceList = Lists.newArrayList();
|
List<GoogleCloudStorageObject> sourceList = Lists.newArrayList();
|
||||||
sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
|
sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
|
||||||
sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
|
sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
|
||||||
|
|
||||||
ComposeObjectTemplate requestTemplate = ComposeObjectTemplate.create(sourceList, destination);
|
ComposeObjectTemplate requestTemplate = ComposeObjectTemplate.create(sourceList, destination);
|
||||||
|
|
||||||
GCSObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT, requestTemplate);
|
GoogleCloudStorageObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT, requestTemplate);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -242,7 +242,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
@Test(groups = "live", dependsOnMethods = "testComposeObject")
|
@Test(groups = "live", dependsOnMethods = "testComposeObject")
|
||||||
public void testComposeObjectWithOptions() {
|
public void testComposeObjectWithOptions() {
|
||||||
ObjectTemplate destination = new ObjectTemplate().contentType(MediaType.APPLICATION_JSON);
|
ObjectTemplate destination = new ObjectTemplate().contentType(MediaType.APPLICATION_JSON);
|
||||||
List<GCSObject> sourceList = Lists.newArrayList();
|
List<GoogleCloudStorageObject> sourceList = Lists.newArrayList();
|
||||||
sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
|
sourceList.add(api().getObject(BUCKET_NAME2, UPLOAD_OBJECT_NAME));
|
||||||
sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
|
sourceList.add(api().getObject(BUCKET_NAME2, COPIED_OBJECT_NAME));
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
ComposeObjectOptions options = new ComposeObjectOptions().destinationPredefinedAcl(
|
ComposeObjectOptions options = new ComposeObjectOptions().destinationPredefinedAcl(
|
||||||
DestinationPredefinedAcl.BUCKET_OWNER_READ).ifMetagenerationNotMatch(RANDOM_LONG);
|
DestinationPredefinedAcl.BUCKET_OWNER_READ).ifMetagenerationNotMatch(RANDOM_LONG);
|
||||||
|
|
||||||
GCSObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT2, requestTemplate, options);
|
GoogleCloudStorageObject gcsObject = api().composeObjects(BUCKET_NAME2, COMPOSED_OBJECT2, requestTemplate, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -262,20 +262,20 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
@Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
|
@Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
|
||||||
public void listObjects() {
|
public void listObjects() {
|
||||||
ListPageWithPrefixes<GCSObject> list = api().listObjects(BUCKET_NAME);
|
ListPageWithPrefixes<GoogleCloudStorageObject> list = api().listObjects(BUCKET_NAME);
|
||||||
|
|
||||||
assertNotNull(list);
|
assertNotNull(list);
|
||||||
assertEquals(list.get(0) instanceof GCSObject, true);
|
assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
|
@Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
|
||||||
public void testListObjectsWithOptions() {
|
public void testListObjectsWithOptions() {
|
||||||
ListObjectOptions options = new ListObjectOptions().maxResults(1);
|
ListObjectOptions options = new ListObjectOptions().maxResults(1);
|
||||||
ListPageWithPrefixes<GCSObject> list = api().listObjects(BUCKET_NAME, options);
|
ListPageWithPrefixes<GoogleCloudStorageObject> list = api().listObjects(BUCKET_NAME, options);
|
||||||
|
|
||||||
while (list.nextPageToken() != null) {
|
while (list.nextPageToken() != null) {
|
||||||
assertNotNull(list);
|
assertNotNull(list);
|
||||||
assertEquals(list.get(0) instanceof GCSObject, true);
|
assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
|
||||||
assertEquals(list.size(), 1);
|
assertEquals(list.size(), 1);
|
||||||
|
|
||||||
options = new ListObjectOptions().maxResults(1).pageToken(list.nextPageToken());
|
options = new ListObjectOptions().maxResults(1).pageToken(list.nextPageToken());
|
||||||
|
@ -290,7 +290,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
.role(ObjectRole.OWNER).build();
|
.role(ObjectRole.OWNER).build();
|
||||||
|
|
||||||
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
|
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
|
||||||
GCSObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
|
GoogleCloudStorageObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -312,7 +312,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
|
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
|
||||||
.contentDisposition("attachment").customMetadata(METADATA_KEY, METADATA_VALUE);
|
.contentDisposition("attachment").customMetadata(METADATA_KEY, METADATA_VALUE);
|
||||||
GCSObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
|
GoogleCloudStorageObject gcsObject = api().updateObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -329,7 +329,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
.role(ObjectRole.READER).build();
|
.role(ObjectRole.READER).build();
|
||||||
|
|
||||||
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
|
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg");
|
||||||
GCSObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
|
GoogleCloudStorageObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -349,7 +349,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
|
|
||||||
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
|
ObjectTemplate template = new ObjectTemplate().addAcl(oacl).contentType("image/jpeg")
|
||||||
.contentDisposition("attachment");
|
.contentDisposition("attachment");
|
||||||
GCSObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
|
GoogleCloudStorageObject gcsObject = api().patchObject(BUCKET_NAME, UPLOAD_OBJECT_NAME2, template, options);
|
||||||
|
|
||||||
assertNotNull(gcsObject);
|
assertNotNull(gcsObject);
|
||||||
assertNotNull(gcsObject.acl());
|
assertNotNull(gcsObject.acl());
|
||||||
|
@ -380,7 +380,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
.customMetadata("custommetakey1", "custommetavalue1").crc32c(crc32c)
|
.customMetadata("custommetakey1", "custommetavalue1").crc32c(crc32c)
|
||||||
.customMetadata(ImmutableMap.of("Adrian", "powderpuff"));
|
.customMetadata(ImmutableMap.of("Adrian", "powderpuff"));
|
||||||
|
|
||||||
GCSObject gcsObject = api().multipartUpload(BUCKET_NAME, template, payloadImpl.getPayload());
|
GoogleCloudStorageObject gcsObject = api().multipartUpload(BUCKET_NAME, template, payloadImpl.getPayload());
|
||||||
|
|
||||||
assertThat(gcsObject.bucket()).isEqualTo(BUCKET_NAME);
|
assertThat(gcsObject.bucket()).isEqualTo(BUCKET_NAME);
|
||||||
assertThat(gcsObject.name()).isEqualTo(MULTIPART_UPLOAD_OBJECT);
|
assertThat(gcsObject.name()).isEqualTo(MULTIPART_UPLOAD_OBJECT);
|
||||||
|
@ -395,7 +395,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
|
||||||
ByteStreams2.toByteArrayAndClose(payloadImpl.getPayload().openStream()));
|
ByteStreams2.toByteArrayAndClose(payloadImpl.getPayload().openStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkHashCodes(GCSObject gcsObject) {
|
private void checkHashCodes(GoogleCloudStorageObject gcsObject) {
|
||||||
assertEquals(HashCode.fromBytes(base64().decode(gcsObject.md5Hash())), md5Hash);
|
assertEquals(HashCode.fromBytes(base64().decode(gcsObject.md5Hash())), md5Hash);
|
||||||
if (crc32c != null) {
|
if (crc32c != null) {
|
||||||
assertEquals(HashCode.fromBytes(reverse(base64().decode(gcsObject.crc32c()))), crc32c);
|
assertEquals(HashCode.fromBytes(reverse(base64().decode(gcsObject.crc32c()))), crc32c);
|
||||||
|
|
Loading…
Reference in New Issue