use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetObjectStringStringLong method syncGetObjectStringStringLong.
public static void syncGetObjectStringStringLong() 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;
Object response = storageClient.getObject(bucket, object, generation);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncGetServiceAccount method asyncGetServiceAccount.
public static void asyncGetServiceAccount() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetServiceAccountRequest request = GetServiceAccountRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<ServiceAccount> future = storageClient.getServiceAccountCallable().futureCall(request);
// Do something.
ServiceAccount response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetServiceAccount method syncGetServiceAccount.
public static void syncGetServiceAccount() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetServiceAccountRequest request = GetServiceAccountRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ServiceAccount response = storageClient.getServiceAccount(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetServiceAccountProjectname method syncGetServiceAccountProjectname.
public static void syncGetServiceAccountProjectname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
ServiceAccount response = storageClient.getServiceAccount(project);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListBuckets method asyncListBuckets.
public static void asyncListBuckets() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ListBucketsRequest request = ListBucketsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setPrefix("prefix-980110702").setReadMask(FieldMask.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<Bucket> future = storageClient.listBucketsPagedCallable().futureCall(request);
// Do something.
for (Bucket element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
Aggregations