Search in sources :

Example 1 with ConfigurationPropertyBuilder

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;
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) PluggableInstanceSettings(com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings) ConfigurationPropertyBuilder(com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder) PluginConfiguration(com.thoughtworks.go.plugin.domain.common.PluginConfiguration)

Example 2 with ConfigurationPropertyBuilder

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);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ArrayList(java.util.ArrayList) ConfigurationPropertyBuilder(com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder) ClusterProfile(com.thoughtworks.go.config.elastic.ClusterProfile)

Example 3 with ConfigurationPropertyBuilder

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));
    }
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationPropertyBuilder(com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)

Example 4 with ConfigurationPropertyBuilder

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);
    }
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationPropertyBuilder(com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)

Example 5 with ConfigurationPropertyBuilder

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);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) ConfigurationPropertyBuilder(com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)

Aggregations

ConfigurationPropertyBuilder (com.thoughtworks.go.config.builder.ConfigurationPropertyBuilder)5 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)5 ClusterProfile (com.thoughtworks.go.config.elastic.ClusterProfile)1 PluggableInstanceSettings (com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings)1 PluginConfiguration (com.thoughtworks.go.plugin.domain.common.PluginConfiguration)1 ArrayList (java.util.ArrayList)1