use of com.sequenceiq.cloudbreak.workspace.model.User in project cloudbreak by hortonworks.
the class ImageCatalogService method getImagesFromDefault.
public Images getImagesFromDefault(Long workspaceId, String stackName, String platform, Set<String> operatingSystems) throws CloudbreakImageCatalogException {
if (isNotEmpty(platform) && isNotEmpty(stackName)) {
throw new BadRequestException("Platform or stackName cannot be filled in the same request.");
}
if (isNotEmpty(platform)) {
User user = getLoggedInUser();
ImageFilter imageFilter = new ImageFilter(getDefaultImageCatalog(user), Set.of(platform), null, baseImageEnabled(), operatingSystems, null);
return getStatedImagesFilteredByOperatingSystems(imageFilter, image -> true).getImages();
} else if (isNotEmpty(stackName)) {
return stackImageFilterService.getApplicableImages(workspaceId, stackName);
} else {
throw new BadRequestException("Either platform or stackName should be filled in request.");
}
}
use of com.sequenceiq.cloudbreak.workspace.model.User in project cloudbreak by hortonworks.
the class ClusterDecoratorTest method testAutoTlsSettingByParentEnvironmentCloudPlatform.
@Test
void testAutoTlsSettingByParentEnvironmentCloudPlatform() {
Cluster expectedClusterInstance = new Cluster();
Blueprint blueprint = getBlueprint();
when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))).thenReturn(expectedClusterInstance);
ArgumentCaptor<Platform> platformArgumentCaptor = ArgumentCaptor.forClass(Platform.class);
when(cloudPlatformConnectors.get(platformArgumentCaptor.capture(), any())).thenReturn(connector);
when(embeddedDatabaseService.isEmbeddedDatabaseOnAttachedDiskEnabled(stack, expectedClusterInstance)).thenReturn(false);
String platform = CloudPlatform.YARN.name();
underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack, platform);
assertEquals(platform, platformArgumentCaptor.getValue().value());
}
use of com.sequenceiq.cloudbreak.workspace.model.User in project cloudbreak by hortonworks.
the class InstanceGroupV4RequestToHostGroupConverter method convert.
public HostGroup convert(InstanceGroupV4Request source) {
HostGroup hostGroup = new HostGroup();
hostGroup.setName(source.getName().toLowerCase());
hostGroup.setRecoveryMode(source.getRecoveryMode());
Set<String> recipeNames = source.getRecipeNames();
if (!CollectionUtils.isEmpty(recipeNames)) {
CloudbreakUser cloudbreakUser = restRequestThreadLocalService.getCloudbreakUser();
User user = userService.getOrCreate(cloudbreakUser);
Workspace workspace = workspaceService.get(restRequestThreadLocalService.getRequestedWorkspaceId(), user);
hostGroup.setRecipes(recipeService.getRecipesByNamesForWorkspace(workspace, recipeNames));
}
return hostGroup;
}
use of com.sequenceiq.cloudbreak.workspace.model.User in project cloudbreak by hortonworks.
the class ImageCatalogToImageCatalogV4ResponseConverter method isDefault.
private boolean isDefault(String imageCatalogName) {
CloudbreakUser cloudbreakUser = legacyRestRequestThreadLocalService.getCloudbreakUser();
User user = userService.getOrCreate(cloudbreakUser);
String defaultImageCatalogName = imageCatalogService.getDefaultImageCatalogName(user);
return imageCatalogName.equals(defaultImageCatalogName) || (defaultImageCatalogName == null && imageCatalogService.isEnvDefault(imageCatalogName));
}
use of com.sequenceiq.cloudbreak.workspace.model.User in project cloudbreak by hortonworks.
the class BlueprintService method updateDefaultBlueprintCollection.
public void updateDefaultBlueprintCollection(Long workspaceId) {
User user = getLoggedInUser();
Workspace workspace = getWorkspaceService().get(workspaceId, user);
updateDefaultBlueprintCollection(workspace);
}
Aggregations