use of com.cloudera.api.swagger.model.ApiEntityTag in project cloudbreak by hortonworks.
the class CmTemplateProcessor method addDiagnosticTags.
public void addDiagnosticTags(TemplatePreparationObject templatePreparationObject, ClouderaManagerRepo clouderaManagerRepo) {
if (Objects.nonNull(clouderaManagerRepo) && isTagsResourceSupportedViaBlueprint(clouderaManagerRepo)) {
cmTemplate.addTagsItem(new ApiEntityTag().name("_cldr_cb_origin").value("cloudbreak"));
cmTemplate.addTagsItem(new ApiEntityTag().name("_cldr_cb_clustertype").value(getClusterType(templatePreparationObject.getStackType())));
}
}
use of com.cloudera.api.swagger.model.ApiEntityTag in project cloudbreak by hortonworks.
the class ClouderaManagerModificationService method asyncTagHost.
private void asyncTagHost(String hostname, HostsResourceApi hostsResourceApi, InstanceGroup instanceGroup) {
ApiEntityTag tag = new ApiEntityTag().name(HOST_TEMPLATE_NAME_TAG).value(instanceGroup.getGroupName());
try {
ApiCallback<List<ApiEntityTag>> callback = new ApiCallback<>() {
@Override
public void onFailure(ApiException e, int i, Map<String, List<String>> map) {
LOGGER.error("Tagging failed for host [{}]: {}. Response headers: {}", hostname, e.getMessage(), map, e);
throw new ClouderaManagerOperationFailedException("Host tagging failed for host: " + hostname, e);
}
@Override
public void onSuccess(List<ApiEntityTag> apiEntityTags, int i, Map<String, List<String>> map) {
LOGGER.debug("Tagging successful for host: [{}]. Body: {}, headers: {}", hostname, apiEntityTags, map);
}
@Override
public void onUploadProgress(long l, long l1, boolean b) {
}
@Override
public void onDownloadProgress(long l, long l1, boolean b) {
}
};
LOGGER.debug("Tagging host [{}] with [{}]", hostname, tag);
hostsResourceApi.addTagsAsync(hostname, List.of(tag), callback);
} catch (ApiException e) {
LOGGER.error("Error while tagging host: [{}]", hostname, e);
throw new ClouderaManagerOperationFailedException(e.getMessage(), e);
}
}
Aggregations