Search in sources :

Example 1 with LockBucketRetentionPolicyRequest

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

the class AsyncLockBucketRetentionPolicy method asyncLockBucketRetentionPolicy.

public static void asyncLockBucketRetentionPolicy() 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();
        ApiFuture<Bucket> future = storageClient.lockBucketRetentionPolicyCallable().futureCall(request);
        // Do something.
        Bucket response = future.get();
    }
}
Also used : LockBucketRetentionPolicyRequest(com.google.storage.v2.LockBucketRetentionPolicyRequest) Bucket(com.google.storage.v2.Bucket) StorageClient(com.google.storage.v2.StorageClient)

Example 2 with LockBucketRetentionPolicyRequest

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

Bucket (com.google.storage.v2.Bucket)2 LockBucketRetentionPolicyRequest (com.google.storage.v2.LockBucketRetentionPolicyRequest)2 StorageClient (com.google.storage.v2.StorageClient)2