use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListBucketsPaged method asyncListBucketsPaged.
public static void asyncListBucketsPaged() 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();
while (true) {
ListBucketsResponse response = storageClient.listBucketsCallable().call(request);
for (Bucket element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateHmacKey method syncCreateHmacKey.
public static void syncCreateHmacKey() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
CreateHmacKeyRequest request = CreateHmacKeyRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setServiceAccountEmail("serviceAccountEmail1825953988").setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
CreateHmacKeyResponse response = storageClient.createHmacKey(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateHmacKeyStringString method syncCreateHmacKeyStringString.
public static void syncCreateHmacKeyStringString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String project = ProjectName.of("[PROJECT]").toString();
String serviceAccountEmail = "serviceAccountEmail1825953988";
CreateHmacKeyResponse response = storageClient.createHmacKey(project, serviceAccountEmail);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncCreateNotification method asyncCreateNotification.
public static void asyncCreateNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
CreateNotificationRequest request = CreateNotificationRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setNotification(Notification.newBuilder().build()).build();
ApiFuture<Notification> future = storageClient.createNotificationCallable().futureCall(request);
// Do something.
Notification response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateNotification method syncCreateNotification.
public static void syncCreateNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
CreateNotificationRequest request = CreateNotificationRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setNotification(Notification.newBuilder().build()).build();
Notification response = storageClient.createNotification(request);
}
}
Aggregations