use of com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder in project gocd by gocd.
the class PluginSettings method getSecurePluginSettingsProperties.
public List<ConfigurationProperty> getSecurePluginSettingsProperties(PluginInfo pluginInfo) {
ArrayList<ConfigurationProperty> configurationProperties = new ArrayList<>();
if (pluginInfo != null) {
ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder();
PluggableInstanceSettings pluginSettings = pluginInfo.getPluginSettings();
for (ConfigurationProperty configurationProperty : settingsMap) {
PluginConfiguration pluginConfiguration = configPropertyFor(configurationProperty.getConfigKeyName(), pluginSettings);
if (pluginConfiguration != null && pluginConfiguration.isSecure()) {
configurationProperties.add(builder.create(configurationProperty.getConfigKeyName(), configurationProperty.getConfigValue(), configurationProperty.getEncryptedValue(), true));
} else {
configurationProperties.add(configurationProperty);
}
}
}
return configurationProperties;
}
use of com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder in project gocd by gocd.
the class ConfigurationPropertyDTO method toDomainModel.
public ClusterProfile toDomainModel() {
ArrayList<ConfigurationProperty> configurationProperties = new ArrayList<>();
ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder();
this.properties.forEach((key, valueObject) -> {
boolean isSecure = (boolean) valueObject.get("isSecure");
String value = isSecure ? null : (String) valueObject.get("value");
String encryptedValue = isSecure ? (String) valueObject.get("value") : null;
configurationProperties.add(builder.create(key, value, encryptedValue, isSecure));
});
return new ClusterProfile(this.id, this.pluginId, configurationProperties);
}
use of com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder in project gocd by gocd.
the class RuleAwarePluginProfile method addConfigurations.
public void addConfigurations(List<ConfigurationProperty> configurations) {
ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder();
for (ConfigurationProperty property : configurations) {
final boolean isSecure = property.isSecure() || isSecure(property.getConfigKeyName());
configuration.add(builder.create(property.getConfigKeyName(), property.getConfigValue(), property.getEncryptedValue(), isSecure));
}
}
use of com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder in project gocd by gocd.
the class PluginSettings method addConfigurations.
public void addConfigurations(PluginInfo pluginInfo, List<ConfigurationProperty> configurationProperties) {
settingsMap.clear();
ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder();
for (ConfigurationProperty property : configurationProperties) {
ConfigurationProperty configurationProperty = builder.create(property.getConfigKeyName(), property.getConfigValue(), property.getEncryptedValue(), pluginInfo.isSecure(property.getConfigKeyName()));
settingsMap.add(configurationProperty);
}
}
use of com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder in project gocd by gocd.
the class PluginSettings method from.
public static PluginSettings from(Plugin plugin, PluginInfo pluginInfo) {
ArrayList<ConfigurationProperty> settingsMap = new ArrayList<>();
ConfigurationPropertyBuilder builder = new ConfigurationPropertyBuilder();
for (String key : plugin.getAllConfigurationKeys()) {
ConfigurationProperty configurationProperty = builder.create(key, plugin.getConfigurationValue(key), null, pluginInfo.isSecure(key));
settingsMap.add(configurationProperty);
}
return new PluginSettings(plugin.getPluginId(), settingsMap);
}
Aggregations