use of com.sequenceiq.cloudbreak.cloud.model.StackTags in project cloudbreak by hortonworks.
the class StackToStackResponseConverter method convertTags.
private void convertTags(StackResponse stackJson, Json tag) {
try {
if (tag != null) {
if (tag.getValue() != null) {
StackTags stackTag = tag.get(StackTags.class);
stackJson.setApplicationTags(stackTag.getApplicationTags());
stackJson.setDefaultTags(stackTag.getDefaultTags());
stackJson.setUserDefinedTags(stackTag.getUserDefinedTags());
} else {
stackJson.setApplicationTags(new HashMap<>());
stackJson.setDefaultTags(new HashMap<>());
stackJson.setUserDefinedTags(new HashMap<>());
}
} else {
stackJson.setApplicationTags(new HashMap<>());
stackJson.setDefaultTags(new HashMap<>());
stackJson.setUserDefinedTags(new HashMap<>());
}
} catch (Exception e) {
LOGGER.error("Failed to convert dynamic tags.", e);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.StackTags in project cloudbreak by hortonworks.
the class StackToStackV2RequestConverter method prepareTags.
private void prepareTags(Stack source, StackV2Request stackV2Request) {
try {
StackTags stackTags = source.getTags().get(StackTags.class);
if (stackTags.getUserDefinedTags() != null) {
Tags tags = new Tags();
tags.setApplicationTags(null);
tags.setDefaultTags(null);
tags.setUserDefinedTags(stackTags.getUserDefinedTags());
stackV2Request.setTags(tags);
}
} catch (IOException e) {
stackV2Request.setTags(null);
}
}
use of com.sequenceiq.cloudbreak.cloud.model.StackTags in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method getUserDefinedTags.
public Map<String, String> getUserDefinedTags(Stack stack) {
Map<String, String> result = Maps.newHashMap();
try {
if (stack.getTags() != null) {
StackTags stackTag = stack.getTags().get(StackTags.class);
Map<String, String> userDefined = stackTag.getUserDefinedTags();
Map<String, String> defaultTags = stackTag.getDefaultTags();
if (userDefined != null) {
result.putAll(userDefined);
}
if (defaultTags != null) {
result.putAll(defaultTags);
}
}
} catch (IOException e) {
LOGGER.warn("Exception during converting user defined tags.", e);
}
return result;
}
Aggregations