You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/com/google/gcloud/spi/DefaultStorageRpc.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1 +1 @@
1
-
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed 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. */packagecom.google.gcloud.spi;importcom.google.api.client.http.HttpRequestInitializer;importcom.google.api.client.http.HttpTransport;importcom.google.api.client.json.jackson.JacksonFactory;importcom.google.api.services.storage.Storage;importcom.google.api.services.storage.model.Bucket;importcom.google.api.services.storage.model.Buckets;importcom.google.api.services.storage.model.StorageObject;importcom.google.gcloud.storage.StorageServiceOptions;importjava.io.IOException;importjava.util.List;publicclassDefaultStorageRpcimplementsStorageRpc { privatefinalStorageServiceOptionsoptions; privatefinalStoragestorage; publicDefaultStorageRpc(StorageServiceOptionsoptions) { HttpTransporttransport = options.httpTransport(); HttpRequestInitializerinitializer = transport.createRequestFactory() .getInitializer(); this.options = options; storage = newStorage.Builder(transport, newJacksonFactory(), initializer).build(); } @OverridepublicList<Bucket> buckets() throwsIOException { Bucketsbuckets = storage.buckets().list(options.project()).execute(); returnbuckets.getItems(); } @OverridepublicList<StorageObject> objects(Stringbucket, Stringprefix, Stringdelimiter) throwsIOException { returnnull; } @OverridepublicBucketget(Stringbucket) throwsIOException { returnstorage.buckets().get(bucket).execute(); } @OverridepublicStorageObjectget(Stringbucket, Stringobject) throwsIOException { returnstorage.objects().get(bucket, object).execute(); } @OverridepublicBucketpatch(Bucketbucket) throwsIOException { returnstorage.buckets().patch(bucket.getName(), bucket).execute(); } @OverridepublicStorageObjectpatch(StorageObjectstorageObject) throwsIOException { returnstorage.objects() .patch(storageObject.getBucket(), storageObject.getName(), storageObject).execute(); } @Overridepublicvoiddelete(Stringbucket, Stringobject) throwsIOException { storage.objects().delete(bucket, object).execute(); }}
1
+
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed 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. */packagecom.google.gcloud.spi;importcom.google.api.client.http.HttpRequestInitializer;importcom.google.api.client.http.HttpTransport;importcom.google.api.client.json.jackson.JacksonFactory;importcom.google.api.services.storage.Storage;importcom.google.api.services.storage.model.Bucket;importcom.google.api.services.storage.model.Buckets;importcom.google.api.services.storage.model.StorageObject;importcom.google.gcloud.storage.StorageServiceOptions;importjava.io.IOException;importjava.util.List;publicclassDefaultStorageRpcimplementsStorageRpc { privatefinalStorageServiceOptionsoptions; privatefinalStoragestorage; publicDefaultStorageRpc(StorageServiceOptionsoptions) { HttpTransporttransport = options.httpTransport(); HttpRequestInitializerinitializer = transport.createRequestFactory() .getInitializer(); this.options = options; storage = newStorage.Builder(transport, newJacksonFactory(), initializer).build(); // Todo: set projection to full // Todo: make sure nulls are being used as Data.asNull() } @Override public List<Bucket> buckets() throws IOException { Buckets buckets = storage.buckets().list(options.project()).execute(); return buckets.getItems(); } @Override public List<StorageObject> objects(String bucket, String prefix, String delimiter) throws IOException { return null; } @Override public Bucket get(String bucket) throws IOException { return storage.buckets().get(bucket).execute(); } @Override public StorageObject get(String bucket, String object) throws IOException { return storage.objects().get(bucket, object).execute(); } @Override public Bucket patch(Bucket bucket) throws IOException { return storage.buckets().patch(bucket.getName(), bucket).execute(); } @Override public StorageObject patch(StorageObject storageObject) throws IOException { return storage.objects() .patch(storageObject.getBucket(), storageObject.getName(), storageObject).execute(); } @Override public void delete(String bucket, String object) throws IOException { storage.objects().delete(bucket, object).execute(); }}
Copy file name to clipboardExpand all lines: src/main/java/com/google/gcloud/spi/StorageRpc.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1 +1 @@
1
-
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed 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. */packagecom.google.gcloud.spi;importcom.google.api.services.storage.model.Bucket;importcom.google.api.services.storage.model.StorageObject;importjava.io.IOException;importjava.util.List;publicinterfaceStorageRpc { List<Bucket> buckets() throwsIOException; List<StorageObject> objects(Stringbucket, Stringprefix, Stringdelimiter) throwsIOException; Bucketget(Stringbucket) throwsIOException; StorageObjectget(Stringbucket, Stringobject) throwsIOException; Bucketpatch(Bucketbucket) throwsIOException; StorageObjectpatch(StorageObjectstorageObject) throwsIOException; //void delete(String bucket) throws IOException; void delete(String bucket, String object) throws IOException;}
1
+
/* * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed 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. */packagecom.google.gcloud.spi;importcom.google.api.services.storage.model.Bucket;importcom.google.api.services.storage.model.StorageObject;importcom.google.gcloud.storage.BlobReadChannel;importcom.google.gcloud.storage.ObjectWriteChannel;importjava.io.IOException;importjava.nio.ByteBuffer;importjava.util.Iterator;publicinterfaceStorageRpc { Bucketcreate(Bucketbucket) throwsIOException; StorageObjectcreate(StorageObjectobject, ByteBuffercontent) throwsIOException; Iterator<Bucket> list() throwsIOException; Iterator<StorageObject> list(Stringbucket, Stringprefix, Stringdelimiter, Stringcursor, booleanversions, intlimit) throwsIOException; Bucketget(Bucketbucket) throwsIOException; StorageObjectget(StorageObjectobject) throwsIOException; Bucketpatch(Bucketbucket) throwsIOException; StorageObjectpatch(StorageObjectstorageObject) throwsIOException; voiddelete(Bucketbucket) throwsIOException; voiddelete(StorageObjectobject) throwsIOException; StorageObjectcompose(Stringbucket, Iterable<String> src, StorageObjectdest) throwsIOException; StorageObjectcopy(StorageObjectfrom, StorageObjectto) throwsIOException; BlobReadChannelreader(StorageObjectfrom) throwsIOException; ObjectWriteChannelwriter(StorageObjectto) throwsIOException;}
0 commit comments