use of org.graylog2.contentpacks.EntityDescriptorIds in project graylog2-server by Graylog2.
the class OutputFacade method exportNativeEntity.
@VisibleForTesting
Entity exportNativeEntity(Output output, EntityDescriptorIds entityDescriptorIds) {
final OutputEntity outputEntity = OutputEntity.create(ValueReference.of(output.getTitle()), ValueReference.of(output.getType()), toReferenceMap(output.getConfiguration()));
final JsonNode data = objectMapper.convertValue(outputEntity, JsonNode.class);
final Set<Constraint> constraints = versionConstraints(output);
return EntityV1.builder().id(ModelId.of(entityDescriptorIds.getOrThrow(output.getId(), ModelTypes.OUTPUT_V1))).type(ModelTypes.OUTPUT_V1).constraints(ImmutableSet.copyOf(constraints)).data(data).build();
}
use of org.graylog2.contentpacks.EntityDescriptorIds in project graylog2-server by Graylog2.
the class PipelineRuleFacade method exportNativeEntity.
@VisibleForTesting
Entity exportNativeEntity(RuleDao ruleDao, EntityDescriptorIds entityDescriptorIds) {
final PipelineRuleEntity ruleEntity = PipelineRuleEntity.create(ValueReference.of(ruleDao.title()), ValueReference.of(ruleDao.description()), ValueReference.of(ruleDao.source()));
final JsonNode data = objectMapper.convertValue(ruleEntity, JsonNode.class);
return EntityV1.builder().id(ModelId.of(entityDescriptorIds.getOrThrow(ruleDao.id(), ModelTypes.PIPELINE_RULE_V1))).type(ModelTypes.PIPELINE_RULE_V1).data(data).build();
}
use of org.graylog2.contentpacks.EntityDescriptorIds in project graylog2-server by Graylog2.
the class SidecarCollectorFacade method exportEntity.
@Override
public Optional<Entity> exportEntity(EntityDescriptor entityDescriptor, EntityDescriptorIds entityDescriptorIds) {
final ModelId modelId = entityDescriptor.id();
final Collector collector = collectorService.find(modelId.id());
if (isNull(collector)) {
LOG.debug("Couldn't find collector {}", entityDescriptor);
return Optional.empty();
}
return Optional.of(exportNativeEntity(collector, entityDescriptorIds));
}
use of org.graylog2.contentpacks.EntityDescriptorIds in project graylog2-server by Graylog2.
the class SidecarCollectorFacade method exportNativeEntity.
@VisibleForTesting
Entity exportNativeEntity(Collector collector, EntityDescriptorIds entityDescriptorIds) {
final SidecarCollectorEntity collectorEntity = SidecarCollectorEntity.create(ValueReference.of(collector.name()), ValueReference.of(collector.serviceType()), ValueReference.of(collector.nodeOperatingSystem()), ValueReference.of(collector.executablePath()), ValueReference.of(collector.executeParameters()), ValueReference.of(collector.validationParameters()), ValueReference.of(collector.defaultTemplate()));
final JsonNode data = objectMapper.convertValue(collectorEntity, JsonNode.class);
return EntityV1.builder().id(ModelId.of(entityDescriptorIds.getOrThrow(collector.id(), ModelTypes.SIDECAR_COLLECTOR_V1))).type(TYPE_V1).data(data).build();
}
use of org.graylog2.contentpacks.EntityDescriptorIds in project graylog2-server by Graylog2.
the class GrokPatternFacade method exportNativeEntity.
@VisibleForTesting
Entity exportNativeEntity(GrokPattern grokPattern, EntityDescriptorIds entityDescriptorIds) {
final GrokPatternEntity grokPatternEntity = GrokPatternEntity.create(grokPattern.name(), grokPattern.pattern());
final JsonNode data = objectMapper.convertValue(grokPatternEntity, JsonNode.class);
return EntityV1.builder().id(ModelId.of(entityDescriptorIds.getOrThrow(grokPattern.id(), ModelTypes.GROK_PATTERN_V1))).type(ModelTypes.GROK_PATTERN_V1).data(data).build();
}
Aggregations