use of com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse in project cloudbreak by hortonworks.
the class CredentialPlatformResourceController method getTagSpecifications.
@Override
@DisableCheckPermissions
public TagSpecificationsResponse getTagSpecifications() {
LOGGER.info("Get /platform_resources/tag_specifications");
Map<Platform, PlatformParameters> platformParameters = platformParameterService.getPlatformParameters();
TagSpecificationsResponse response = tagSpecificationsToTagSpecificationsV1ResponseConverter.convert(platformParameters);
LOGGER.info("Resp /platform_resources/tag_specifications, platformParameters: {}, response: {}", platformParameters, response);
return response;
}
use of com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse in project cloudbreak by hortonworks.
the class TagSpecificationsToTagSpecificationsV1ResponseConverter method convert.
public TagSpecificationsResponse convert(Map<Platform, PlatformParameters> source) {
TagSpecificationsResponse json = new TagSpecificationsResponse();
Map<String, Map<String, Object>> specifications = new HashMap<>();
json.setSpecifications(specifications);
source.keySet().forEach(p -> {
TagSpecification ts = source.get(p).tagSpecification();
Map<String, Object> specification = Collections.emptyMap();
if (ts != null) {
specification = new HashMap<>();
specification.put("maxAmount", ts.getMaxAmount());
specification.put("minKeyLength", ts.getMinKeyLength());
specification.put("maxKeyLength", ts.getMaxKeyLength());
specification.put("keyLength", ts.getMaxKeyLength());
specification.put("keyValidator", ts.getKeyValidator());
specification.put("minValueLength", ts.getMinValueLength());
specification.put("maxValueLength", ts.getMaxValueLength());
specification.put("valueLength", ts.getMaxValueLength());
specification.put("valueValidator", ts.getValueValidator());
}
specifications.put(p.value(), specification);
});
return json;
}
Aggregations