use of bio.terra.workspace.service.resource.referenced.cloud.gcp.bqdatatable.ReferencedBigQueryDataTableResource in project terra-workspace-manager by DataBiosphere.
the class ReferencedGcpResourceController method updateBigQueryDataTableReferenceResource.
@Override
public ResponseEntity<Void> updateBigQueryDataTableReferenceResource(UUID workspaceId, UUID referenceId, ApiUpdateBigQueryDataTableReferenceRequestBody body) {
AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
String updatedProjectId = body.getProjectId();
String updatedDatasetId = body.getDatasetId();
String updatedDataTableId = body.getDataTableId();
if (StringUtils.isEmpty(updatedProjectId) && StringUtils.isEmpty(updatedDatasetId) && StringUtils.isEmpty(updatedDataTableId)) {
referenceResourceService.updateReferenceResource(workspaceId, referenceId, body.getName(), body.getDescription(), userRequest);
} else {
ReferencedBigQueryDataTableResource referencedResource = referenceResourceService.getReferenceResource(workspaceId, referenceId, userRequest).castByEnum(WsmResourceType.REFERENCED_GCP_BIG_QUERY_DATA_TABLE);
ReferencedBigQueryDataTableResource.Builder updateBqTableResource = referencedResource.toBuilder();
if (!StringUtils.isEmpty(updatedProjectId)) {
updateBqTableResource.projectId(updatedProjectId);
}
if (!StringUtils.isEmpty(updatedDatasetId)) {
updateBqTableResource.datasetId(updatedDatasetId);
}
if (!StringUtils.isEmpty(updatedDataTableId)) {
updateBqTableResource.dataTableId(updatedDataTableId);
}
referenceResourceService.updateReferenceResource(workspaceId, referenceId, body.getName(), body.getDescription(), updateBqTableResource.build(), userRequest);
}
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
Aggregations