Search in sources :

Example 1 with DeleteObjectRequest

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

the class AsyncDeleteObject method asyncDeleteObject.

public static void asyncDeleteObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteObjectRequest request = DeleteObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setUploadId("uploadId1563990780").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Empty> future = storageClient.deleteObjectCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : DeleteObjectRequest(com.google.storage.v2.DeleteObjectRequest) Empty(com.google.protobuf.Empty) StorageClient(com.google.storage.v2.StorageClient)

Example 2 with DeleteObjectRequest

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

the class SyncDeleteObject method syncDeleteObject.

public static void syncDeleteObject() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteObjectRequest request = DeleteObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setUploadId("uploadId1563990780").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        storageClient.deleteObject(request);
    }
}
Also used : DeleteObjectRequest(com.google.storage.v2.DeleteObjectRequest) StorageClient(com.google.storage.v2.StorageClient)

Aggregations

DeleteObjectRequest (com.google.storage.v2.DeleteObjectRequest)2 StorageClient (com.google.storage.v2.StorageClient)2 Empty (com.google.protobuf.Empty)1