use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncLockBucketRetentionPolicyBucketname method syncLockBucketRetentionPolicyBucketname.
public static void syncLockBucketRetentionPolicyBucketname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
BucketName bucket = BucketName.of("[PROJECT]", "[BUCKET]");
Bucket response = storageClient.lockBucketRetentionPolicy(bucket);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncLockBucketRetentionPolicyString method syncLockBucketRetentionPolicyString.
public static void syncLockBucketRetentionPolicyString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String bucket = BucketName.of("[PROJECT]", "[BUCKET]").toString();
Bucket response = storageClient.lockBucketRetentionPolicy(bucket);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncQueryWriteStatus method syncQueryWriteStatus.
public static void syncQueryWriteStatus() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
QueryWriteStatusRequest request = QueryWriteStatusRequest.newBuilder().setUploadId("uploadId1563990780").setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
QueryWriteStatusResponse response = storageClient.queryWriteStatus(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncQueryWriteStatusString method syncQueryWriteStatusString.
public static void syncQueryWriteStatusString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String uploadId = "uploadId1563990780";
QueryWriteStatusResponse response = storageClient.queryWriteStatus(uploadId);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncRewriteObject method asyncRewriteObject.
public static void asyncRewriteObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
RewriteObjectRequest request = RewriteObjectRequest.newBuilder().setDestinationName("destinationName-1762755655").setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString()).setDestinationKmsKey(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setDestination(Object.newBuilder().build()).setSourceBucket("sourceBucket841604581").setSourceObject("sourceObject1196439354").setSourceGeneration(1232209852).setRewriteToken("rewriteToken80654285").setDestinationPredefinedAcl(PredefinedObjectAcl.forNumber(0)).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setIfSourceGenerationMatch(-1427877280).setIfSourceGenerationNotMatch(1575612532).setIfSourceMetagenerationMatch(1143319909).setIfSourceMetagenerationNotMatch(1900822777).setMaxBytesRewrittenPerCall(1178170730).setCopySourceEncryptionAlgorithm("copySourceEncryptionAlgorithm-1524952548").setCopySourceEncryptionKeyBytes(ByteString.EMPTY).setCopySourceEncryptionKeySha256Bytes(ByteString.EMPTY).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<RewriteResponse> future = storageClient.rewriteObjectCallable().futureCall(request);
// Do something.
RewriteResponse response = future.get();
}
}
Aggregations