use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncSetIamPolicy method asyncSetIamPolicy.
public static void asyncSetIamPolicy() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setPolicy(Policy.newBuilder().build()).build();
ApiFuture<Policy> future = storageClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncSetIamPolicyResourcenamePolicy method syncSetIamPolicyResourcenamePolicy.
public static void syncSetIamPolicyResourcenamePolicy() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ResourceName resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
Policy policy = Policy.newBuilder().build();
Policy response = storageClient.setIamPolicy(resource, policy);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncStartResumableWrite method syncStartResumableWrite.
public static void syncStartResumableWrite() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
StartResumableWriteRequest request = StartResumableWriteRequest.newBuilder().setWriteObjectSpec(WriteObjectSpec.newBuilder().build()).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).build();
StartResumableWriteResponse response = storageClient.startResumableWrite(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncTestIamPermissionsResourcenameListstring method syncTestIamPermissionsResourcenameListstring.
public static void syncTestIamPermissionsResourcenameListstring() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
ResourceName resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = storageClient.testIamPermissions(resource, permissions);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncTestIamPermissionsStringListstring method syncTestIamPermissionsStringListstring.
public static void syncTestIamPermissionsStringListstring() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
String resource = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
List<String> permissions = new ArrayList<>();
TestIamPermissionsResponse response = storageClient.testIamPermissions(resource, permissions);
}
}
Aggregations