Search in sources :

Example 1 with TagSpecificationsResponse

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;
}
Also used : TagSpecificationsResponse(com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse) Platform(com.sequenceiq.cloudbreak.cloud.model.Platform) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) DisableCheckPermissions(com.sequenceiq.authorization.annotation.DisableCheckPermissions)

Example 2 with TagSpecificationsResponse

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;
}
Also used : TagSpecificationsResponse(com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse) HashMap(java.util.HashMap) TagSpecification(com.sequenceiq.cloudbreak.cloud.model.TagSpecification) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

TagSpecificationsResponse (com.sequenceiq.environment.api.v1.platformresource.model.TagSpecificationsResponse)2 DisableCheckPermissions (com.sequenceiq.authorization.annotation.DisableCheckPermissions)1 PlatformParameters (com.sequenceiq.cloudbreak.cloud.PlatformParameters)1 Platform (com.sequenceiq.cloudbreak.cloud.model.Platform)1 TagSpecification (com.sequenceiq.cloudbreak.cloud.model.TagSpecification)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1