Search in sources :

Example 1 with ComposeObjectRequest

use of com.google.storage.v2.ComposeObjectRequest in project gapic-generator-java by googleapis.

the class SyncComposeObject method syncComposeObject.

public static void syncComposeObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ComposeObjectRequest request = ComposeObjectRequest.newBuilder().setDestination(Object.newBuilder().build()).addAllSourceObjects(new ArrayList<ComposeObjectRequest.SourceObject>()).setDestinationPredefinedAcl(PredefinedObjectAcl.forNumber(0)).setIfGenerationMatch(-1086241088).setIfMetagenerationMatch(1043427781).setKmsKey(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        Object response = storageClient.composeObject(request);
    }
}
Also used : ComposeObjectRequest(com.google.storage.v2.ComposeObjectRequest) ArrayList(java.util.ArrayList) StorageClient(com.google.storage.v2.StorageClient) Object(com.google.storage.v2.Object)

Example 2 with ComposeObjectRequest

use of com.google.storage.v2.ComposeObjectRequest in project gapic-generator-java by googleapis.

the class AsyncComposeObject method asyncComposeObject.

public static void asyncComposeObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        ComposeObjectRequest request = ComposeObjectRequest.newBuilder().setDestination(Object.newBuilder().build()).addAllSourceObjects(new ArrayList<ComposeObjectRequest.SourceObject>()).setDestinationPredefinedAcl(PredefinedObjectAcl.forNumber(0)).setIfGenerationMatch(-1086241088).setIfMetagenerationMatch(1043427781).setKmsKey(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Object> future = storageClient.composeObjectCallable().futureCall(request);
        // Do something.
        Object response = future.get();
    }
}
Also used : ComposeObjectRequest(com.google.storage.v2.ComposeObjectRequest) ArrayList(java.util.ArrayList) StorageClient(com.google.storage.v2.StorageClient) Object(com.google.storage.v2.Object)

Aggregations

ComposeObjectRequest (com.google.storage.v2.ComposeObjectRequest)2 Object (com.google.storage.v2.Object)2 StorageClient (com.google.storage.v2.StorageClient)2 ArrayList (java.util.ArrayList)2