use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintService method getByName.
public Blueprint getByName(String name, IdentityUser user) {
Blueprint blueprint = blueprintRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", name));
}
authorizationService.hasReadPermission(blueprint);
return blueprint;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintService method get.
public Blueprint get(Long id) {
Blueprint blueprint = blueprintRepository.findOne(id);
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", id));
}
authorizationService.hasReadPermission(blueprint);
return blueprint;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintService method delete.
public void delete(String name, IdentityUser user) {
Blueprint blueprint = blueprintRepository.findByNameInAccount(name, user.getAccount(), user.getUserId());
if (blueprint == null) {
throw new NotFoundException(String.format("Blueprint '%s' not found.", name));
}
delete(blueprint);
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class AmbariClusterService method validateComponentsCategory.
private void validateComponentsCategory(Stack stack, String hostGroup) {
Blueprint blueprint = stack.getCluster().getBlueprint();
try {
JsonNode root = JsonUtil.readTree(blueprint.getBlueprintText());
String blueprintName = root.path("Blueprints").path("blueprint_name").asText();
AmbariClient ambariClient = getAmbariClient(stack);
Map<String, String> categories = ambariClient.getComponentsCategory(blueprintName, hostGroup);
for (Entry<String, String> entry : categories.entrySet()) {
if (entry.getValue().equalsIgnoreCase(MASTER_CATEGORY)) {
throw new BadRequestException(String.format("Cannot downscale the '%s' hostGroupAdjustment group, because it contains a '%s' component", hostGroup, entry.getKey()));
}
}
} catch (IOException e) {
LOGGER.warn("Cannot check the host components category", e);
}
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class ClusterToClusterResponseConverterTest method createSource.
@Override
public Cluster createSource() {
Stack stack = TestUtil.stack();
Blueprint blueprint = TestUtil.blueprint();
Cluster cluster = TestUtil.cluster(blueprint, stack, 1L);
ProxyConfig proxyConfig = new ProxyConfig();
proxyConfig.setName("test");
cluster.setProxyConfig(proxyConfig);
stack.setCluster(cluster);
return cluster;
}
Aggregations