use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class JobServiceTest method runFlight.
// Submit a flight; wait for it to finish; return the flight id
// Use the jobId defaulting in the JobBuilder
private String runFlight(String description) {
// workspace must exist in the Dao for authorization check to pass
UUID workspaceId = UUID.randomUUID();
Workspace workspace = Workspace.builder().workspaceId(workspaceId).workspaceStage(WorkspaceStage.MC_WORKSPACE).description("Workspace for runFlight: " + description).build();
workspaceDao.createWorkspace(workspace);
String jobId = jobService.newJob().description(description).flightClass(JobServiceTestFlight.class).userRequest(testUser).workspaceId(workspaceId.toString()).submit();
jobService.waitForJob(jobId);
return jobId;
}
use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class ResourceDaoTest method createGcpWorkspace.
/**
* Creates a workspaces with a GCP cloud context and stores it in the database. Returns the
* workspace id.
*
* <p>The {@link ResourceDao#createControlledResource(ControlledResource)} checks that a relevant
* cloud context exists before storing the resource.
*/
private UUID createGcpWorkspace() {
Workspace workspace = Workspace.builder().workspaceId(UUID.randomUUID()).workspaceStage(WorkspaceStage.MC_WORKSPACE).build();
workspaceDao.createWorkspace(workspace);
WorkspaceFixtures.createGcpCloudContextInDatabase(workspaceDao, workspace.getWorkspaceId(), "my-project-id");
return workspace.getWorkspaceId();
}
use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class WorkspaceApiController method getWorkspace.
@Override
public ResponseEntity<ApiWorkspaceDescription> getWorkspace(@PathVariable("workspaceId") UUID id) {
AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
logger.info("Getting workspace {} for {}", id, userRequest.getEmail());
Workspace workspace = workspaceService.getWorkspace(id, userRequest);
ApiWorkspaceDescription desc = buildWorkspaceDescription(workspace);
logger.info("Got workspace {} for {}", desc, userRequest.getEmail());
return new ResponseEntity<>(desc, HttpStatus.OK);
}
use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class WorkspaceApiController method listWorkspaces.
@Override
public ResponseEntity<ApiWorkspaceDescriptionList> listWorkspaces(Integer offset, Integer limit) {
AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
logger.info("Listing workspaces for {}", userRequest.getEmail());
ControllerValidationUtils.validatePaginationParams(offset, limit);
List<Workspace> workspaces = workspaceService.listWorkspaces(userRequest, offset, limit);
var response = new ApiWorkspaceDescriptionList().workspaces(workspaces.stream().map(this::buildWorkspaceDescription).collect(Collectors.toList()));
return new ResponseEntity<>(response, HttpStatus.OK);
}
use of bio.terra.workspace.service.workspace.model.Workspace in project terra-workspace-manager by DataBiosphere.
the class WsmApplicationService method getWorkspaceApplication.
public WsmWorkspaceApplication getWorkspaceApplication(AuthenticatedUserRequest userRequest, UUID workspaceId, UUID applicationId) {
Workspace workspace = workspaceService.validateWorkspaceAndAction(userRequest, workspaceId, SamConstants.SamWorkspaceAction.READ);
stageService.assertMcWorkspace(workspace, "getWorkspaceApplication");
return applicationDao.getWorkspaceApplication(workspaceId, applicationId);
}
Aggregations