/** * Asynchronously starts certain workspace with specified environment and account. * * @param workspaceId identifier of workspace which should be started * @param envName name of environment or null, when default environment should be used * @param options possible startup options * @return starting workspace * @throws NullPointerException when {@code workspaceId} is null * @throws NotFoundException when workspace with given {@code workspaceId} doesn't exist * @throws ServerException when any other error occurs during workspace start */ public WorkspaceImpl startWorkspace( String workspaceId, @Nullable String envName, @Nullable Map<String, String> options) throws NotFoundException, ServerException, ConflictException { requireNonNull(workspaceId, "Required non-null workspace id"); final WorkspaceImpl workspace = workspaceDao.get(workspaceId); startAsync(workspace, envName, options); return normalizeState(workspace, true); }
/** * Asynchronously starts workspace from the given configuration. * * @param config workspace configuration from which workspace is created and started * @param namespace workspace name is unique in this namespace * @return starting workspace * @throws NullPointerException when {@code workspaceId} is null * @throws NotFoundException when workspace with given {@code workspaceId} doesn't exist * @throws ServerException when any other error occurs during workspace start */ public WorkspaceImpl startWorkspace( WorkspaceConfig config, String namespace, boolean isTemporary, Map<String, String> options) throws ServerException, NotFoundException, ConflictException, ValidationException { requireNonNull(config, "Required non-null configuration"); requireNonNull(namespace, "Required non-null namespace"); validator.validateConfig(config); final WorkspaceImpl workspace = doCreateWorkspace( config, accountManager.getByName(namespace), Collections.emptyMap(), isTemporary); startAsync(workspace, workspace.getConfig().getDefaultEnv(), options); return normalizeState(workspace, true); }