use of com.google.storage.v2.GetObjectRequest in project gapic-generator-java by googleapis.
the class AsyncGetObject method asyncGetObject.
public static void asyncGetObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetObjectRequest request = GetObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
ApiFuture<Object> future = storageClient.getObjectCallable().futureCall(request);
// Do something.
Object response = future.get();
}
}
use of com.google.storage.v2.GetObjectRequest in project gapic-generator-java by googleapis.
the class SyncGetObject method syncGetObject.
public static void syncGetObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetObjectRequest request = GetObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
Object response = storageClient.getObject(request);
}
}
Aggregations