Search in sources :

Example 1 with UpdateControlledGcpGcsBucketRequestBody

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

the class ControlledGcsBucketLifecycle method updateBucketAttempt.

private GcpGcsBucketResource updateBucketAttempt(ControlledGcpResourceApi resourceApi, UUID resourceId, @Nullable String updatedResourceName, @Nullable String updatedDescription, @Nullable GcpGcsBucketUpdateParameters updateParameters) throws ApiException {
    var body = new UpdateControlledGcpGcsBucketRequestBody().name(updatedResourceName).description(updatedDescription).updateParameters(updateParameters);
    logger.info("Attempting to update bucket {} resource ID {} workspace {}", bucketName, resourceId, getWorkspaceId());
    return resourceApi.updateGcsBucket(body, getWorkspaceId(), resourceId);
}
Also used : UpdateControlledGcpGcsBucketRequestBody(bio.terra.workspace.model.UpdateControlledGcpGcsBucketRequestBody)

Example 2 with UpdateControlledGcpGcsBucketRequestBody

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

the class WorkspaceManagerService method updateControlledGcsBucket.

/**
 * Call the Workspace Manager POST
 * "/api/workspaces/v1/{workspaceId}/resources/controlled/gcp/buckets/{resourceId}" endpoint to
 * update a GCS bucket controlled 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 updateControlledGcsBucket(UUID workspaceId, UUID resourceId, UpdateControlledGcsBucketParams updateParams) {
    // convert the CLI lifecycle rule object into the WSM request objects
    List<GcpGcsBucketLifecycleRule> lifecycleRules = fromCLIObject(updateParams.lifecycle);
    // convert the CLI object to a WSM request object
    UpdateControlledGcpGcsBucketRequestBody updateRequest = new UpdateControlledGcpGcsBucketRequestBody().name(updateParams.resourceFields.name).description(updateParams.resourceFields.description).updateParameters(new GcpGcsBucketUpdateParameters().defaultStorageClass(updateParams.defaultStorageClass).lifecycle(new GcpGcsBucketLifecycle().rules(lifecycleRules)));
    callWithRetries(() -> new ControlledGcpResourceApi(apiClient).updateGcsBucket(updateRequest, workspaceId, resourceId), "Error updating controlled GCS bucket in the workspace.");
}
Also used : GcpGcsBucketLifecycleRule(bio.terra.workspace.model.GcpGcsBucketLifecycleRule) UpdateControlledGcpGcsBucketRequestBody(bio.terra.workspace.model.UpdateControlledGcpGcsBucketRequestBody) ControlledGcpResourceApi(bio.terra.workspace.api.ControlledGcpResourceApi) GcpGcsBucketUpdateParameters(bio.terra.workspace.model.GcpGcsBucketUpdateParameters) GcpGcsBucketLifecycle(bio.terra.workspace.model.GcpGcsBucketLifecycle)

Aggregations

UpdateControlledGcpGcsBucketRequestBody (bio.terra.workspace.model.UpdateControlledGcpGcsBucketRequestBody)2 ControlledGcpResourceApi (bio.terra.workspace.api.ControlledGcpResourceApi)1 GcpGcsBucketLifecycle (bio.terra.workspace.model.GcpGcsBucketLifecycle)1 GcpGcsBucketLifecycleRule (bio.terra.workspace.model.GcpGcsBucketLifecycleRule)1 GcpGcsBucketUpdateParameters (bio.terra.workspace.model.GcpGcsBucketUpdateParameters)1