Search in sources :

Example 1 with UpdateBigQueryDataTableReferenceRequestBody

use of bio.terra.workspace.model.UpdateBigQueryDataTableReferenceRequestBody in project terra-workspace-manager by DataBiosphere.

the class BqDataTableUtils method updateBigQueryDataTableReference.

/**
 * Updates name, description and/or referencing target of BigQuery data table reference.
 */
public static void updateBigQueryDataTableReference(ReferencedGcpResourceApi resourceApi, UUID workspaceId, UUID resourceId, @Nullable String name, @Nullable String description, @Nullable String projectId, @Nullable String datasetId, @Nullable String tableId) throws ApiException {
    UpdateBigQueryDataTableReferenceRequestBody body = new UpdateBigQueryDataTableReferenceRequestBody();
    if (name != null) {
        body.setName(name);
    }
    if (description != null) {
        body.setDescription(description);
    }
    if (projectId != null) {
        body.setProjectId(projectId);
    }
    if (datasetId != null) {
        body.setDatasetId(datasetId);
    }
    if (tableId != null) {
        body.setDataTableId(tableId);
    }
    resourceApi.updateBigQueryDataTableReferenceResource(body, workspaceId, resourceId);
}
Also used : UpdateBigQueryDataTableReferenceRequestBody(bio.terra.workspace.model.UpdateBigQueryDataTableReferenceRequestBody)

Example 2 with UpdateBigQueryDataTableReferenceRequestBody

use of bio.terra.workspace.model.UpdateBigQueryDataTableReferenceRequestBody in project terra-cli by DataBiosphere.

the class WorkspaceManagerService method updateReferencedBigQueryDataTable.

/**
 * Call the Workspace Manager PATCH
 * "/api/workspaces/v1/{workspaceId}/resources/referenced/gcp/bigquerydatatables/{resourceId}"
 * endpoint to update a BigQuery data table referenced resource in the workspace.
 *
 * @param workspaceId the workspace where the resource exists
 * @param resourceId the resource id
 * @param updateParams resource properties to update
 */
public void updateReferencedBigQueryDataTable(UUID workspaceId, UUID resourceId, UpdateReferencedBqTableParams updateParams) {
    // convert the CLI object to a WSM request object
    UpdateBigQueryDataTableReferenceRequestBody updateRequest = new UpdateBigQueryDataTableReferenceRequestBody().name(updateParams.resourceParams.name).description(updateParams.resourceParams.description).projectId(updateParams.projectId).datasetId(updateParams.datasetId).dataTableId(updateParams.tableId);
    callWithRetries(() -> new ReferencedGcpResourceApi(apiClient).updateBigQueryDataTableReferenceResource(updateRequest, workspaceId, resourceId), "Error updating referenced BigQuery data table in the workspace.");
}
Also used : ReferencedGcpResourceApi(bio.terra.workspace.api.ReferencedGcpResourceApi) UpdateBigQueryDataTableReferenceRequestBody(bio.terra.workspace.model.UpdateBigQueryDataTableReferenceRequestBody)

Aggregations

UpdateBigQueryDataTableReferenceRequestBody (bio.terra.workspace.model.UpdateBigQueryDataTableReferenceRequestBody)2 ReferencedGcpResourceApi (bio.terra.workspace.api.ReferencedGcpResourceApi)1