use of bio.terra.workspace.generated.model.ApiCloneWorkspaceResult in project terra-workspace-manager by DataBiosphere.
the class WorkspaceApiController method getCloneWorkspaceResult.
/**
* Return the workspace clone result, including job result and error result.
*
* @param workspaceId - source workspace ID
* @param jobId - ID of flight
* @return - response with result
*/
@Override
public ResponseEntity<ApiCloneWorkspaceResult> getCloneWorkspaceResult(UUID workspaceId, String jobId) {
final AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
final ApiCloneWorkspaceResult result = fetchCloneWorkspaceResult(jobId, userRequest);
return new ResponseEntity<>(result, getAsyncResponseCode(result.getJobReport()));
}
use of bio.terra.workspace.generated.model.ApiCloneWorkspaceResult in project terra-workspace-manager by DataBiosphere.
the class WorkspaceApiController method cloneWorkspace.
/**
* Clone an entire workspace by creating a new workspace and cloning the workspace's resources
* into it.
*
* @param workspaceId - ID of source workspace
* @param body - request body
* @return - result structure for the overall clone operation with details for each resource
*/
@Override
public ResponseEntity<ApiCloneWorkspaceResult> cloneWorkspace(UUID workspaceId, @Valid ApiCloneWorkspaceRequest body) {
final AuthenticatedUserRequest petRequest = getCloningCredentials(workspaceId);
Optional<SpendProfileId> spendProfileId = Optional.ofNullable(body.getSpendProfile()).map(SpendProfileId::new);
// Construct the target workspace object from the inputs
Workspace destinationWorkspace = Workspace.builder().workspaceId(UUID.randomUUID()).spendProfileId(spendProfileId.orElse(null)).workspaceStage(WorkspaceStage.MC_WORKSPACE).displayName(body.getDisplayName()).description(body.getDescription()).properties(propertyMapFromApi(body.getProperties())).build();
final String jobId = workspaceService.cloneWorkspace(workspaceId, petRequest, body.getLocation(), destinationWorkspace);
final ApiCloneWorkspaceResult result = fetchCloneWorkspaceResult(jobId, getAuthenticatedInfo());
return new ResponseEntity<>(result, getAsyncResponseCode(result.getJobReport()));
}
Aggregations