Search in sources :

Example 26 with Bucket

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

the class AsyncDeleteNotification method asyncDeleteNotification.

public static void asyncDeleteNotification() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteNotificationRequest request = DeleteNotificationRequest.newBuilder().setName(NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]").toString()).build();
        ApiFuture<Empty> future = storageClient.deleteNotificationCallable().futureCall(request);
        // Do something.
        future.get();
    }
}
Also used : Empty(com.google.protobuf.Empty) StorageClient(com.google.storage.v2.StorageClient) DeleteNotificationRequest(com.google.storage.v2.DeleteNotificationRequest)

Example 27 with Bucket

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

the class SyncDeleteNotification method syncDeleteNotification.

public static void syncDeleteNotification() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        DeleteNotificationRequest request = DeleteNotificationRequest.newBuilder().setName(NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]").toString()).build();
        storageClient.deleteNotification(request);
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient) DeleteNotificationRequest(com.google.storage.v2.DeleteNotificationRequest)

Example 28 with Bucket

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

the class SyncDeleteNotificationNotificationname method syncDeleteNotificationNotificationname.

public static void syncDeleteNotificationNotificationname() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        NotificationName name = NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]");
        storageClient.deleteNotification(name);
    }
}
Also used : NotificationName(com.google.storage.v2.NotificationName) StorageClient(com.google.storage.v2.StorageClient)

Example 29 with Bucket

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

the class SyncDeleteNotificationString method syncDeleteNotificationString.

public static void syncDeleteNotificationString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String name = NotificationName.of("[PROJECT]", "[BUCKET]", "[NOTIFICATION]").toString();
        storageClient.deleteNotification(name);
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient)

Example 30 with Bucket

use of com.google.storage.v2.Bucket 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

StorageClient (com.google.storage.v2.StorageClient)39 Bucket (com.google.storage.v2.Bucket)17 AbstractMessage (com.google.protobuf.AbstractMessage)4 BucketName (com.google.storage.v2.BucketName)4 Notification (com.google.storage.v2.Notification)4 Object (com.google.storage.v2.Object)4 ListBucketsPagedResponse (com.google.storage.v2.StorageClient.ListBucketsPagedResponse)4 Test (org.junit.Test)4 Empty (com.google.protobuf.Empty)3 ByteString (com.google.protobuf.ByteString)2 CreateBucketRequest (com.google.storage.v2.CreateBucketRequest)2 DeleteNotificationRequest (com.google.storage.v2.DeleteNotificationRequest)2 DeleteObjectRequest (com.google.storage.v2.DeleteObjectRequest)2 GetBucketRequest (com.google.storage.v2.GetBucketRequest)2 GetNotificationRequest (com.google.storage.v2.GetNotificationRequest)2 GetObjectRequest (com.google.storage.v2.GetObjectRequest)2 ListBucketsRequest (com.google.storage.v2.ListBucketsRequest)2 LockBucketRetentionPolicyRequest (com.google.storage.v2.LockBucketRetentionPolicyRequest)2 RewriteObjectRequest (com.google.storage.v2.RewriteObjectRequest)2 RewriteResponse (com.google.storage.v2.RewriteResponse)2