Search in sources :

Example 36 with Bucket

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

the class AsyncGetNotification method asyncGetNotification.

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

Example 37 with Bucket

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

the class SyncGetNotification method syncGetNotification.

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

Example 38 with Bucket

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

the class SyncGetNotificationBucketname method syncGetNotificationBucketname.

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

Example 39 with Bucket

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

the class SyncGetNotificationString method syncGetNotificationString.

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

Example 40 with Bucket

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

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