use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class InstanceGroupNetworkToInstanceGroupNetworkV4RequestConverter method convert.
public InstanceGroupNetworkV4Request convert(InstanceGroupNetwork source) {
InstanceGroupNetworkV4Request response = new InstanceGroupNetworkV4Request();
Json attributes = source.getAttributes();
if (attributes != null) {
Map<String, Object> parameters = attributes.getMap();
ofNullable(attributes).ifPresent(attr -> parameters.putAll(new Json(attr).getMap()));
providerParameterCalculator.parse(parameters, response);
}
return response;
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCreationSetupService method determineCdhRepoConfig.
private Set<ClouderaManagerProduct> determineCdhRepoConfig(Cluster cluster, List<Component> stackCdhRepoConfig, String osType, String blueprintCdhVersion, String imageCatalogName) throws CloudbreakImageCatalogException {
if (Objects.isNull(stackCdhRepoConfig) || stackCdhRepoConfig.isEmpty()) {
DefaultCDHInfo defaultCDHInfo = getDefaultCDHInfo(cluster, blueprintCdhVersion, osType, imageCatalogName);
Map<String, String> stack = defaultCDHInfo.getRepo().getStack();
Set<ClouderaManagerProduct> cdhProduct = Set.of(new ClouderaManagerProduct().withVersion(defaultCDHInfo.getVersion()).withName(stack.get("repoid").split("-")[0]).withParcel(stack.get(osType)));
LOGGER.debug("Determined CDH product: {}", cdhProduct);
return cdhProduct;
} else {
Set<ClouderaManagerProduct> products = stackCdhRepoConfig.stream().map(Component::getAttributes).map(json -> json.getSilent(ClouderaManagerProduct.class)).collect(Collectors.toSet());
return filterParcelsIfNecessary(cluster, products);
}
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class ClouderaManagerClusterCreationSetupService method determineCmRepoConfig.
private ClusterComponent determineCmRepoConfig(Optional<Component> stackClouderaManagerRepoConfig, String osType, Cluster cluster, String cdhStackVersion) throws CloudbreakImageCatalogException {
Json json;
if (Objects.isNull(stackClouderaManagerRepoConfig) || stackClouderaManagerRepoConfig.isEmpty()) {
ImageCatalogPlatform platform = platformStringTransformer.getPlatformStringForImageCatalog(cluster.getStack().getCloudPlatform(), cluster.getStack().getPlatformVariant());
ClouderaManagerRepo clouderaManagerRepo = defaultClouderaManagerRepoService.getDefault(osType, StackType.CDH.name(), cdhStackVersion, platform);
if (clouderaManagerRepo == null) {
throw new BadRequestException(String.format("Couldn't determine Cloudera Manager repo for the stack: %s", cluster.getStack().getName()));
}
json = new Json(clouderaManagerRepo);
} else {
json = stackClouderaManagerRepoConfig.get().getAttributes();
}
return new ClusterComponent(ComponentType.CM_REPO_DETAILS, json, cluster);
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class LoadBalancerConfigService method getSubnetId.
private String getSubnetId(Network network) {
Json attributes = network.getAttributes();
Map<String, Object> params = attributes == null ? Collections.emptyMap() : attributes.getMap();
return params.get(NetworkConstants.SUBNET_ID) != null ? String.valueOf(params.get(NetworkConstants.SUBNET_ID)) : null;
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class LoadBalancerConfigService method getNetworkV4Base.
private NetworkV4Base getNetworkV4Base(Network network) {
Json attributes = network.getAttributes();
Map<String, Object> params = attributes == null ? Collections.emptyMap() : attributes.getMap();
NetworkV4Base networkV4Base = new NetworkV4Base();
providerParameterCalculator.parse(params, networkV4Base);
return networkV4Base;
}
Aggregations