use of org.jenkinsci.plugins.pipeline.modeldefinition.agent.DeclarativeAgentDescriptor in project blueocean-plugin by jenkinsci.
the class PipelineMetadataService method doAgentMetadata.
/**
* Function to return all {@link DeclarativeAgent}s present in the system when accessed through the REST API
*/
@GET
@TreeResponse
public ExportedDescribableModel[] doAgentMetadata() {
List<ExportedDescribableModel> models = new ArrayList<>();
for (DeclarativeAgentDescriptor d : DeclarativeAgentDescriptor.all()) {
try {
DescribableModel<? extends DeclarativeAgent> model = new DescribableModel<>(d.clazz);
String symbol = symbolForObject(d);
if ("label".equals(symbol)) {
// Label has 2 symbols, but we need "node"
symbol = "node";
}
models.add(new ExportedDescribableModel(model, symbol));
} catch (NoStaplerConstructorException e) {
// Ignore!
}
}
return models.toArray(new ExportedDescribableModel[models.size()]);
}
Aggregations