Search in sources :

Example 31 with Bucket

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

the class SyncDeleteObjectStringString method syncDeleteObjectStringString.

public static void syncDeleteObjectStringString() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        String bucket = "bucket-1378203158";
        String object = "object-1023368385";
        storageClient.deleteObject(bucket, object);
    }
}
Also used : StorageClient(com.google.storage.v2.StorageClient)

Example 32 with Bucket

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

the class AsyncGetBucket method asyncGetBucket.

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

Example 33 with Bucket

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

the class SyncGetBucket method syncGetBucket.

public static void syncGetBucket() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        GetBucketRequest request = GetBucketRequest.newBuilder().setName(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
        Bucket response = storageClient.getBucket(request);
    }
}
Also used : Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient) GetBucketRequest(com.google.storage.v2.GetBucketRequest)

Example 34 with Bucket

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

the class SyncGetBucketBucketname method syncGetBucketBucketname.

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

Example 35 with Bucket

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

the class SyncLockBucketRetentionPolicy method syncLockBucketRetentionPolicy.

public static void syncLockBucketRetentionPolicy() throws Exception {
    // It may require modifications to work in your environment.
    try (StorageClient storageClient = StorageClient.create()) {
        LockBucketRetentionPolicyRequest request = LockBucketRetentionPolicyRequest.newBuilder().setBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setIfMetagenerationMatch(1043427781).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
        Bucket response = storageClient.lockBucketRetentionPolicy(request);
    }
}
Also used : LockBucketRetentionPolicyRequest(com.google.storage.v2.LockBucketRetentionPolicyRequest) Bucket(com.google.storage.v2.Bucket) 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