Search in sources :

Example 1 with GetObjectRequest

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();
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) Object(com.google.storage.v2.Object) GetObjectRequest(com.google.storage.v2.GetObjectRequest)

Example 2 with GetObjectRequest

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);
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) Object(com.google.storage.v2.Object) GetObjectRequest(com.google.storage.v2.GetObjectRequest)

Aggregations

GetObjectRequest (com.google.storage.v2.GetObjectRequest)2 Object (com.google.storage.v2.Object)2 StorageClient (com.google.storage.v2.StorageClient)2