Search in sources :

Example 6 with DeleteBucketRequest

use of com.google.logging.v2.DeleteBucketRequest in project gapic-generator-java by googleapis.

the class SyncDeleteBucket method syncDeleteBucket.

public static void syncDeleteBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (ConfigClient configClient = ConfigClient.create()) {
        DeleteBucketRequest request = DeleteBucketRequest.newBuilder().setName(LogBucketName.ofProjectLocationBucketName("[PROJECT]", "[LOCATION]", "[BUCKET]").toString()).build();
        configClient.deleteBucket(request);
    }
}
Also used : ConfigClient(com.google.cloud.logging.v2.ConfigClient) DeleteBucketRequest(com.google.logging.v2.DeleteBucketRequest)

Example 7 with DeleteBucketRequest

use of com.google.logging.v2.DeleteBucketRequest in project gapic-generator-java by googleapis.

the class AsyncDeleteBucket method asyncDeleteBucket.

public static void asyncDeleteBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteBucketRequest request = DeleteBucketRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        ApiFuture<Empty> future = storageClient.deleteBucketCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : Empty(com.google.protobuf.Empty) DeleteBucketRequest(com.google.storage.v2.DeleteBucketRequest) StorageClient(com.google.storage.v2.StorageClient)

Aggregations

DeleteBucketRequest (com.google.logging.v2.DeleteBucketRequest)6 Empty (com.google.protobuf.Empty)4 Test (org.junit.Test)4 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)2 ConfigClient (com.google.cloud.logging.v2.ConfigClient)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 StatusRuntimeException (io.grpc.StatusRuntimeException)2 DeleteBucketRequest (com.google.storage.v2.DeleteBucketRequest)1 StorageClient (com.google.storage.v2.StorageClient)1