use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncDeleteObjectStringStringLong method syncDeleteObjectStringStringLong.
public static void syncDeleteObjectStringStringLong() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String bucket = "bucket-1378203158";
String object = "object-1023368385";
long generation = 305703192;
storageClient.deleteObject(bucket, object, generation);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncGetBucketString method syncGetBucketString.
public static void syncGetBucketString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
Bucket response = storageClient.getBucket(name);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncDeleteBucketString method syncDeleteBucketString.
public static void syncDeleteBucketString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
storageClient.deleteBucket(name);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class AsyncDeleteObject method asyncDeleteObject.
public static void asyncDeleteObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
DeleteObjectRequest request = DeleteObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setUploadId("uploadId1563990780").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<Empty> future = storageClient.deleteObjectCallable().futureCall(request);
// Do something.
future.get();
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class AsyncLockBucketRetentionPolicy method asyncLockBucketRetentionPolicy.
public static void asyncLockBucketRetentionPolicy() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
LockBucketRetentionPolicyRequest request = LockBucketRetentionPolicyRequest.newBuilder().setBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<Bucket> future = storageClient.lockBucketRetentionPolicyCallable().futureCall(request);
// Do something.
Bucket response = future.get();
}
}
Aggregations