use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateHmacKeyProjectnameString method syncCreateHmacKeyProjectnameString.
public static void syncCreateHmacKeyProjectnameString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
String serviceAccountEmail = "serviceAccountEmail1825953988";
CreateHmacKeyResponse response = storageClient.createHmacKey(project, serviceAccountEmail);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateNotificationStringNotification method syncCreateNotificationStringNotification.
public static void syncCreateNotificationStringNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
Notification notification = Notification.newBuilder().build();
Notification response = storageClient.createNotification(parent, notification);
}
}
use of com.google.storage.v2.StorageClient 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();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncUpdateHmacKey method syncUpdateHmacKey.
public static void syncUpdateHmacKey() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
UpdateHmacKeyRequest request = UpdateHmacKeyRequest.newBuilder().setHmacKey(HmacKeyMetadata.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setUpdateMask(FieldMask.newBuilder().build()).build();
HmacKeyMetadata response = storageClient.updateHmacKey(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncUpdateObject method asyncUpdateObject.
public static void asyncUpdateObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
UpdateObjectRequest request = UpdateObjectRequest.newBuilder().setObject(Object.newBuilder().build()).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setPredefinedAcl(PredefinedObjectAcl.forNumber(0)).setUpdateMask(FieldMask.newBuilder().build()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
ApiFuture<Object> future = storageClient.updateObjectCallable().futureCall(request);
// Do something.
Object response = future.get();
}
}
Aggregations