use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetNotificationBucketname method syncGetNotificationBucketname.
public static void syncGetNotificationBucketname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
Notification response = storageClient.getNotification(name);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetNotificationString method syncGetNotificationString.
public static void syncGetNotificationString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String name = BucketName.of("[PROJECT]", "[BUCKET]").toString();
Notification response = storageClient.getNotification(name);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListHmacKeys method asyncListHmacKeys.
public static void asyncListHmacKeys() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ListHmacKeysRequest request = ListHmacKeysRequest.newBuilder().setProject(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setServiceAccountEmail("serviceAccountEmail1825953988").setShowDeletedKeys(true).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<HmacKeyMetadata> future = storageClient.listHmacKeysPagedCallable().futureCall(request);
// Do something.
for (HmacKeyMetadata element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListNotifications method asyncListNotifications.
public static void asyncListNotifications() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ListNotificationsRequest request = ListNotificationsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
ApiFuture<Notification> future = storageClient.listNotificationsPagedCallable().futureCall(request);
// Do something.
for (Notification element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListNotificationsPaged method asyncListNotificationsPaged.
public static void asyncListNotificationsPaged() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ListNotificationsRequest request = ListNotificationsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").build();
while (true) {
ListNotificationsResponse response = storageClient.listNotificationsCallable().call(request);
for (Notification element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
}
Aggregations