use of com.google.cloud.bigquery.datatransfer.v1.ProjectName 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.cloud.bigquery.datatransfer.v1.ProjectName 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.cloud.bigquery.datatransfer.v1.ProjectName in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceClientTest method listRelatedAccountGroupsExceptionTest.
@Test
public void listRelatedAccountGroupsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecaptchaEnterpriseService.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listRelatedAccountGroups(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.bigquery.datatransfer.v1.ProjectName in project java-recaptchaenterprise by googleapis.
the class RecaptchaEnterpriseServiceClientTest method createAssessmentExceptionTest.
@Test
public void createAssessmentExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockRecaptchaEnterpriseService.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
Assessment assessment = Assessment.newBuilder().build();
client.createAssessment(parent, assessment);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.bigquery.datatransfer.v1.ProjectName in project java-asset by googleapis.
the class ExportAssetsExample method exportAssets.
// Export assets for a project.
// @param exportPath where the results will be exported to.
public static void exportAssets(String exportPath, ContentType contentType) throws IOException, IllegalArgumentException, InterruptedException, ExecutionException {
try (AssetServiceClient client = AssetServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
OutputConfig outputConfig = OutputConfig.newBuilder().setGcsDestination(GcsDestination.newBuilder().setUri(exportPath).build()).build();
ExportAssetsRequest request = ExportAssetsRequest.newBuilder().setParent(parent.toString()).setOutputConfig(outputConfig).setContentType(contentType).build();
ExportAssetsResponse response = client.exportAssetsAsync(request).get();
System.out.println(response);
}
}
Aggregations