use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncDeleteObjectStringString method syncDeleteObjectStringString.
public static void syncDeleteObjectStringString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String bucket = "bucket-1378203158";
String object = "object-1023368385";
storageClient.deleteObject(bucket, object);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class AsyncGetBucket method asyncGetBucket.
public static void asyncGetBucket() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetBucketRequest request = GetBucketRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
ApiFuture<Bucket> future = storageClient.getBucketCallable().futureCall(request);
// Do something.
Bucket response = future.get();
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncGetBucket method syncGetBucket.
public static void syncGetBucket() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetBucketRequest request = GetBucketRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
Bucket response = storageClient.getBucket(request);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncGetBucketBucketname method syncGetBucketBucketname.
public static void syncGetBucketBucketname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
Bucket response = storageClient.getBucket(name);
}
}
use of com.google.storage.v2.Bucket in project gapic-generator-java by googleapis.
the class SyncLockBucketRetentionPolicy method syncLockBucketRetentionPolicy.
public static void syncLockBucketRetentionPolicy() 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();
Bucket response = storageClient.lockBucketRetentionPolicy(request);
}
}
Aggregations