Search in sources :

Example 1 with UpdateBigQueryDatasetReferenceRequestBody

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

the class BqDatasetUtils method updateBigQueryDatasetReference.

/**
 * Updates the name, description or referencing target of a BQ dataset reference.
 */
public static void updateBigQueryDatasetReference(ReferencedGcpResourceApi resourceApi, UUID workspace, UUID resourceId, @Nullable String name, @Nullable String description, @Nullable String projectId, @Nullable String datasetId) throws ApiException {
    UpdateBigQueryDatasetReferenceRequestBody body = new UpdateBigQueryDatasetReferenceRequestBody();
    if (name != null) {
        body.setName(name);
    }
    if (description != null) {
        body.setDescription(description);
    }
    if (projectId != null) {
        body.setProjectId(projectId);
    }
    if (datasetId != null) {
        body.setDatasetId(datasetId);
    }
    resourceApi.updateBigQueryDatasetReferenceResource(body, workspace, resourceId);
}
Also used : UpdateBigQueryDatasetReferenceRequestBody(bio.terra.workspace.model.UpdateBigQueryDatasetReferenceRequestBody)

Example 2 with UpdateBigQueryDatasetReferenceRequestBody

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

the class WorkspaceManagerService method updateReferencedBigQueryDataset.

/**
 * Call the Workspace Manager POST
 * "/api/workspaces/v1/{workspaceId}/resources/referenced/gcp/bigquerydatasets/{resourceId}"
 * endpoint to update a BigQuery dataset 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 updateReferencedBigQueryDataset(UUID workspaceId, UUID resourceId, UpdateReferencedBqDatasetParams updateParams) {
    // convert the CLI object to a WSM request object
    UpdateBigQueryDatasetReferenceRequestBody updateRequest = new UpdateBigQueryDatasetReferenceRequestBody().name(updateParams.resourceParams.name).description(updateParams.resourceParams.description).projectId(updateParams.projectId).datasetId(updateParams.datasetId);
    callWithRetries(() -> new ReferencedGcpResourceApi(apiClient).updateBigQueryDatasetReferenceResource(updateRequest, workspaceId, resourceId), "Error updating referenced BigQuery dataset in the workspace.");
}
Also used : ReferencedGcpResourceApi(bio.terra.workspace.api.ReferencedGcpResourceApi) UpdateBigQueryDatasetReferenceRequestBody(bio.terra.workspace.model.UpdateBigQueryDatasetReferenceRequestBody)

Aggregations

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