use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncSetIamPolicyStringPolicy method syncSetIamPolicyStringPolicy.
public static void syncSetIamPolicyStringPolicy() 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();
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 AsyncStartResumableWrite method asyncStartResumableWrite.
public static void asyncStartResumableWrite() 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();
ApiFuture<StartResumableWriteResponse> future = storageClient.startResumableWriteCallable().futureCall(request);
// Do something.
StartResumableWriteResponse response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncTestIamPermissions method asyncTestIamPermissions.
public static void asyncTestIamPermissions() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).addAllPermissions(new ArrayList<String>()).build();
ApiFuture<TestIamPermissionsResponse> future = storageClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class SyncTestIamPermissions method syncTestIamPermissions.
public static void syncTestIamPermissions() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder().setResource(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).addAllPermissions(new ArrayList<String>()).build();
TestIamPermissionsResponse response = storageClient.testIamPermissions(request);
}
}
use of com.google.storage.v2.StorageClient in project gapic-generator-java by googleapis.
the class AsyncGetObject method asyncGetObject.
public static void asyncGetObject() throws Exception {
// It may require modifications to work in your environment.
try (StorageClient storageClient = StorageClient.create()) {
GetObjectRequest request = GetObjectRequest.newBuilder().setBucket("bucket-1378203158").setObject("object-1023368385").setGeneration(305703192).setIfGenerationMatch(-1086241088).setIfGenerationNotMatch(1475720404).setIfMetagenerationMatch(1043427781).setIfMetagenerationNotMatch(1025430873).setCommonObjectRequestParams(CommonObjectRequestParams.newBuilder().build()).setCommonRequestParams(CommonRequestParams.newBuilder().build()).setReadMask(FieldMask.newBuilder().build()).build();
ApiFuture<Object> future = storageClient.getObjectCallable().futureCall(request);
// Do something.
Object response = future.get();
}
}
Aggregations