use of com.google.api.services.healthcare.v1.model.Operation in project beam by apache.
the class HttpHealthcareApiClient method importFhirResource.
@Override
public Operation importFhirResource(String fhirStore, String gcsSourcePath, @Nullable String contentStructure) throws IOException {
GoogleCloudHealthcareV1FhirGcsSource gcsSrc = new GoogleCloudHealthcareV1FhirGcsSource();
gcsSrc.setUri(gcsSourcePath);
ImportResourcesRequest importRequest = new ImportResourcesRequest();
importRequest.setGcsSource(gcsSrc).setContentStructure(contentStructure);
return client.projects().locations().datasets().fhirStores().healthcareImport(fhirStore, importRequest).execute();
}
use of com.google.api.services.healthcare.v1.model.Operation in project beam by apache.
the class HttpHealthcareApiClient method deidentifyFhirStore.
@Override
public Operation deidentifyFhirStore(String sourcefhirStore, String destinationFhirStore, DeidentifyConfig deidConfig) throws IOException {
DeidentifyFhirStoreRequest deidRequest = new DeidentifyFhirStoreRequest();
deidRequest.setDestinationStore(destinationFhirStore);
deidRequest.setConfig(deidConfig);
return client.projects().locations().datasets().fhirStores().deidentify(sourcefhirStore, deidRequest).execute();
}
use of com.google.api.services.healthcare.v1.model.Operation in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleApiClientAppEngineAdminService method createApplication.
@Override
public Application createApplication(@NotNull String locationId, @NotNull final String projectId, @NotNull final Credential credential) throws IOException, GoogleApiException {
Application arg = new Application();
arg.setId(projectId);
arg.setLocationId(locationId);
Apps.Create createRequest = GoogleApiClientFactory.getInstance().getAppEngineApiClient(credential).apps().create(arg);
Operation operation;
try {
// make the initial request to create the application
operation = createRequest.execute();
// poll for updates while the application is being created
boolean done = false;
while (!done) {
try {
Thread.sleep(CREATE_APPLICATION_POLLING_INTERVAL_MS);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
operation = getOperation(projectId, operation.getName(), credential);
if (operation.getDone() != null) {
done = operation.getDone();
}
}
} catch (GoogleJsonResponseException e) {
throw GoogleApiException.from(e);
}
if (operation.getError() != null) {
Status status = operation.getError();
throw new GoogleApiException(status.getMessage(), status.getCode());
} else {
Application result = new Application();
result.putAll(operation.getResponse());
return result;
}
}
use of com.google.api.services.healthcare.v1.model.Operation in project google-cloud-intellij by GoogleCloudPlatform.
the class GoogleApiClientAppEngineAdminServiceTest method testCreateApplication_operationFailed.
@Test
public void testCreateApplication_operationFailed() throws IOException, GoogleApiException {
String operationName = "apps/-/operations/12345";
Operation inProgressOperation = buildInProgressOperation(operationName);
when(appengineClientMock.getAppsCreateQuery().execute()).thenReturn(inProgressOperation);
String errorMessage = "The operation failed.";
int errorCode = 400;
Status status = new Status();
status.setMessage(errorMessage);
status.setCode(errorCode);
Operation failedOperation = new Operation();
failedOperation.setError(status);
failedOperation.setDone(true);
failedOperation.setName(operationName);
when(appengineClientMock.getAppsCreateQuery().execute()).thenReturn(inProgressOperation);
when(appengineClientMock.getAppsOperationsGetQuery().execute()).thenReturn(failedOperation);
try {
service.createApplication("us-east", "my-project-id", mock(Credential.class));
} catch (GoogleApiException expected) {
assertEquals(errorCode, expected.getStatusCode());
assertEquals(errorMessage, expected.getMessage());
return;
}
fail();
}
use of com.google.api.services.healthcare.v1.model.Operation in project java-docs-samples by GoogleCloudPlatform.
the class CheckLatestTransferOperationApiary method checkLatestTransferOperationApiary.
// Gets the requested transfer job and checks its latest operation
public static void checkLatestTransferOperationApiary(String projectId, String jobName) throws IOException {
// Your Google Cloud Project ID
// String projectId = "your-project-id";
// The name of the job to check
// String jobName = "myJob/1234567890";
// Create Storage Transfer client
GoogleCredentials credential = GoogleCredentials.getApplicationDefault();
if (credential.createScopedRequired()) {
credential = credential.createScoped(StoragetransferScopes.all());
}
Storagetransfer storageTransfer = new Storagetransfer.Builder(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory(), new HttpCredentialsAdapter(credential)).build();
// Get transfer job and check latest operation
TransferJob transferJob = storageTransfer.transferJobs().get(jobName, projectId).execute();
String latestOperationName = transferJob.getLatestOperationName();
if (latestOperationName != null) {
Operation latestOperation = storageTransfer.transferOperations().get(latestOperationName).execute();
System.out.println("The latest operation for transfer job " + jobName + " is:");
System.out.println(latestOperation.toPrettyString());
} else {
System.out.println("Transfer job " + jobName + " does not have an operation scheduled yet," + " try again once the job starts running.");
}
}
Aggregations