use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncCreateNotificationProjectnameNotification method syncCreateNotificationProjectnameNotification.
public static void syncCreateNotificationProjectnameNotification() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
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 SyncDeleteBucketBucketname method syncDeleteBucketBucketname.
public static void syncDeleteBucketBucketname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
BucketName name = BucketName.of("[PROJECT]", "[BUCKET]");
storageClient.deleteBucket(name);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetHmacKeyStringProjectname method syncGetHmacKeyStringProjectname.
public static void syncGetHmacKeyStringProjectname() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String accessId = "accessId-2146437729";
ProjectName project = ProjectName.of("[PROJECT]");
HmacKeyMetadata response = storageClient.getHmacKey(accessId, project);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncGetHmacKeyStringString method syncGetHmacKeyStringString.
public static void syncGetHmacKeyStringString() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String accessId = "accessId-2146437729";
String project = ProjectName.of("[PROJECT]").toString();
HmacKeyMetadata response = storageClient.getHmacKey(accessId, project);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncGetIamPolicy method asyncGetIamPolicy.
public static void asyncGetIamPolicy() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setOptions(GetPolicyOptions.newBuilder().build()).build();
ApiFuture<Policy> future = storageClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
}
Aggregations