use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncListObjectsPaged method asyncListObjectsPaged.
public static void asyncListObjectsPaged() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ListObjectsRequest request = ListObjectsRequest.newBuilder().setParent(ProjectName.of("[PROJECT]").toString()).setPageSize(883849137).setPageToken("pageToken873572522").setDelimiter("delimiter-250518009").setIncludeTrailingDelimiter(true).setPrefix("prefix-980110702").setVersions(true).setReadMask(FieldMask.newBuilder().build()).setLexicographicStart("lexicographicStart-2093413008").setLexicographicEnd("lexicographicEnd1646968169").setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
while (true) {
ListObjectsResponse response = storageClient.listObjectsCallable().call(request);
for (Object 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 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);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetIamPolicyResourcename method syncGetIamPolicyResourcename.
public static void syncGetIamPolicyResourcename() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ResourceName resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
Policy response = storageClient.getIamPolicy(resource);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncGetNotification method asyncGetNotification.
public static void asyncGetNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetNotificationRequest request = GetNotificationRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).build();
ApiFuture<Notification> future = storageClient.getNotificationCallable().futureCall(request);
// Do something.
Notification response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetNotification method syncGetNotification.
public static void syncGetNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetNotificationRequest request = GetNotificationRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).build();
Notification response = storageClient.getNotification(request);
}
}
Aggregations