Search in sources :

Example 1 with GcpGcsBucketUpdateParameters

use of bio.terra.workspace.model.GcpGcsBucketUpdateParameters 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

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 UpdateControlledGcpGcsBucketRequestBody (bio.terra.workspace.model.UpdateControlledGcpGcsBucketRequestBody)1