use of io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator in project configuration-as-code-plugin by jenkinsci.
the class RootElementConfigurator method all.
static List<RootElementConfigurator> all() {
final Jenkins jenkins = Jenkins.get();
List<RootElementConfigurator> configurators = new ArrayList<>(jenkins.getExtensionList(RootElementConfigurator.class));
for (GlobalConfigurationCategory category : GlobalConfigurationCategory.all()) {
configurators.add(new GlobalConfigurationCategoryConfigurator(category));
}
for (ManagementLink link : ManagementLink.all()) {
final String name = link.getUrlName();
final Descriptor descriptor = Jenkins.get().getDescriptor(name);
if (descriptor != null)
configurators.add(new DescriptorConfigurator(descriptor));
}
configurators.sort(Configurator.extensionOrdinalSort());
return configurators;
}
use of io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator in project configuration-as-code-plugin by jenkinsci.
the class Util method getSecurityRoot.
/**
* Gets the "security" root mapping.
* <p>
* Example usage:
* <pre>{@code
* ConfiguratorRegistry registry = ConfiguratorRegistry.get();
* ConfigurationContext context = new ConfigurationContext(registry);
* CNode configNode = getSecurityRoot(context).get("GlobalJobDslSecurityConfiguration");}</pre>
*
* @param context the configuration context
* @return the "security" root mapping
* @throws Exception something's not right...
*/
public static Mapping getSecurityRoot(ConfigurationContext context) throws Exception {
GlobalConfigurationCategory.Security security = ExtensionList.lookup(GlobalConfigurationCategory.Security.class).get(0);
GlobalConfigurationCategoryConfigurator securityConfigurator = new GlobalConfigurationCategoryConfigurator(security);
return Objects.requireNonNull(securityConfigurator.describe(securityConfigurator.getTargetComponent(context), context)).asMapping();
}
use of io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator in project configuration-as-code-plugin by jenkinsci.
the class Util method getToolRoot.
/**
* Gets the "tool" root mapping.
* <p>
* Example usage:
* <pre>{@code
* ConfiguratorRegistry registry = ConfiguratorRegistry.get();
* ConfigurationContext context = new ConfigurationContext(registry);
* CNode configNode = getToolRoot(context).get("git");}</pre>
*
* @param context the configuration context
* @return the "tool" root mapping
* @throws Exception something's not right...
*/
public static Mapping getToolRoot(ConfigurationContext context) throws Exception {
ToolConfigurationCategory category = ExtensionList.lookup(ToolConfigurationCategory.class).get(0);
GlobalConfigurationCategoryConfigurator configurator = new GlobalConfigurationCategoryConfigurator(category);
return Objects.requireNonNull(configurator.describe(configurator.getTargetComponent(context), context)).asMapping();
}
use of io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator in project configuration-as-code-plugin by jenkinsci.
the class Util method getUnclassifiedRoot.
/**
* Gets the "unclassified" root mapping.
* <p>
* Example usage:
* <pre>{@code
* ConfiguratorRegistry registry = ConfiguratorRegistry.get();
* ConfigurationContext context = new ConfigurationContext(registry);
* CNode configNode = getUnclassifiedRoot(context).get("my-plugin-attribute");}</pre>
*
* @param context the configuration context
* @return the "unclassified" root mapping
* @throws Exception something's not right...
*/
public static Mapping getUnclassifiedRoot(ConfigurationContext context) throws Exception {
GlobalConfigurationCategory.Unclassified unclassified = ExtensionList.lookup(GlobalConfigurationCategory.Unclassified.class).get(0);
GlobalConfigurationCategoryConfigurator unclassifiedConfigurator = new GlobalConfigurationCategoryConfigurator(unclassified);
return Objects.requireNonNull(unclassifiedConfigurator.describe(unclassifiedConfigurator.getTargetComponent(context), context)).asMapping();
}
Aggregations