Search in sources :

Example 1 with UpdateGcsBucketObjectReferenceRequestBody

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

the class GcsBucketUtils method updateGcsBucketObjectReference.

/**
 * Updates name, description, and/or referencing target for GCS bucket object reference.
 */
public static void updateGcsBucketObjectReference(ReferencedGcpResourceApi resourceApi, UUID workspaceId, UUID resourceId, @Nullable String name, @Nullable String description, @Nullable String bucketName, @Nullable String objectName) throws ApiException {
    UpdateGcsBucketObjectReferenceRequestBody body = new UpdateGcsBucketObjectReferenceRequestBody();
    if (name != null) {
        body.setName(name);
    }
    if (description != null) {
        body.setDescription(description);
    }
    if (bucketName != null) {
        body.setBucketName(bucketName);
    }
    if (objectName != null) {
        body.setObjectName(objectName);
    }
    resourceApi.updateBucketObjectReferenceResource(body, workspaceId, resourceId);
}
Also used : UpdateGcsBucketObjectReferenceRequestBody(bio.terra.workspace.model.UpdateGcsBucketObjectReferenceRequestBody)

Example 2 with UpdateGcsBucketObjectReferenceRequestBody

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

the class WorkspaceManagerService method updateReferencedGcsObject.

/**
 * Call the Workspace Manager POST
 * "/api/workspaces/v1/{workspaceId}/resources/referenced/gcp/bucket/objects/{resourceId}"
 * endpoint to update a GCS bucket object 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 updateReferencedGcsObject(UUID workspaceId, UUID resourceId, UpdateReferencedGcsObjectParams updateParams) {
    // convert the CLI object to a WSM request object
    UpdateGcsBucketObjectReferenceRequestBody updateRequest = new UpdateGcsBucketObjectReferenceRequestBody();
    updateRequest.name(updateParams.resourceFields.name).description(updateParams.resourceFields.description).bucketName(updateParams.bucketName).objectName(updateParams.objectName);
    callWithRetries(() -> new ReferencedGcpResourceApi(apiClient).updateBucketObjectReferenceResource(updateRequest, workspaceId, resourceId), "Error updating referenced GCS bucket object in the workspace.");
}
Also used : ReferencedGcpResourceApi(bio.terra.workspace.api.ReferencedGcpResourceApi) UpdateGcsBucketObjectReferenceRequestBody(bio.terra.workspace.model.UpdateGcsBucketObjectReferenceRequestBody)

Aggregations

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