IEndpointConfigurationService creates, reads, updates and stores configurations as Automation Orchestrator resources. IEndpointConfiguration represents a single configuration that is stored as an Automation Orchestrator resource.
Note: Some plug-ins rely on the configuration files of other plug-ins.
With IEndpointConfigurationService, you can retrieve a read-only configuration of another plug-in.
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import ch.dunes.vso.sdk.endpoints.IEndpointConfiguration; import ch.dunes.vso.sdk.endpoints.IEndpointConfigurationService; //Reader for vCenter configurations public class VcenterConnectionReader { @Autowired private IEndpointConfigurationService endpointConfigurationService; public List<VcHost> loadVcPluginHosts() throws IOException { List<VcHost> hosts = new ArrayList<VcHost>(); try { //Read the configuration of another plug-in by its name endpointConfigurationService.getEndpointConfigurationServiceForPlugin("VC"); //Iterate through the IEndpointConfiguration objects and construct your own model objects for (IEndpointConfiguration configuration : endpointConfigurationService.getEndpointConfigurations()) { String passwordEncrypted = configuration.getPassword("administratorPassword"); Boolean isSharedLoginMode = configuration.getAsBoolean("sharedLoginMode"); String administratorUsername = configuration.getString("administratorUsername"); Boolean isEnabled = configuration.getAsBoolean("enabled"); String url = configuration.getString("url"); VcHost vcHost = new VcHost(); vcHost.setActive(isEnabled); vcHost.setPassword(passwordEncrypted); vcHost.setUsername(administratorUsername); vcHost.setSharedLoginMode(isSharedLoginMode); vcHost.setVcUri(url); if (isEnabled) { hosts.add(vcHost); } } } catch (Exception e) { throw new RuntimeException(e); } return hosts; } //A model class representing vCenter connections public class VcHost { private Boolean isEnabled; private String url; private Boolean isSharedLoginMode; private String administratorUsername; private String passwordEncrypted; public Boolean getIsEnabled() { return isEnabled; } public void setIsEnabled(Boolean isEnabled) { this.isEnabled = isEnabled; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Boolean getIsSharedLoginMode() { return isSharedLoginMode; } public void setIsSharedLoginMode(Boolean isSharedLoginMode) { this.isSharedLoginMode = isSharedLoginMode; } public String getAdministratorUsername() { return administratorUsername; } public void setAdministratorUsername(String administratorUsername) { this.administratorUsername = administratorUsername; } public String getPasswordEncrypted() { return passwordEncrypted; } public void setPasswordEncrypted(String passwordEncrypted) { this.passwordEncrypted = passwordEncrypted; } public void setActive(Boolean isEnabled) { this.isEnabled = isEnabled; } public void setVcUri(String url) { this.url = url; } public void setSharedLoginMode(Boolean isSharedLoginMode) { this.isSharedLoginMode = isSharedLoginMode; } public void setUsername(String administratorUsername) { this.administratorUsername = administratorUsername; } public void setPassword(String passwordEncrypted) { this.passwordEncrypted = passwordEncrypted; } } }