Search in sources :

Example 1 with SecretConfigs

use of com.thoughtworks.go.config.SecretConfigs in project gocd by gocd.

the class SecretConfigsControllerV3 method index.

public String index(Request request, Response response) throws IOException {
    SecretConfigs allSecretConfigs = configService.getAllSecretConfigs();
    String etag = etagFor(allSecretConfigs);
    if (fresh(request, etag)) {
        return notModified(response);
    }
    setEtagHeader(response, etag);
    return writerForTopLevelObject(request, response, writer -> SecretConfigsRepresenter.toJSON(writer, allSecretConfigs));
}
Also used : SecretConfigs(com.thoughtworks.go.config.SecretConfigs)

Example 2 with SecretConfigs

use of com.thoughtworks.go.config.SecretConfigs in project gocd by gocd.

the class InternalSecretConfigControllerV1 method index.

public String index(Request request, Response response) throws Exception {
    SecretConfigs secretConfigs = secretConfigService.getAllSecretConfigs();
    SecretConfigsViewModel configsViewModel = new SecretConfigsViewModel().setSecretConfigs(secretConfigs);
    List<String> groups = pipelineConfigService.viewableGroupsFor(currentUsername()).stream().map(PipelineConfigs::getGroup).collect(toList());
    List<String> envNames = environmentConfigService.getEnvironmentNames();
    List<String> scms = pluggableScmService.listAllScms().stream().map(SCM::getName).collect(toList());
    List<String> pkgRepos = packageRepositoryService.getPackageRepositories().stream().map(PackageRepository::getName).collect(toList());
    List<String> clusterProfiles = clusterProfilesService.getPluginProfiles().stream().map(PluginProfile::getId).collect(toList());
    configsViewModel.getAutoSuggestions().put("pipeline_group", groups);
    configsViewModel.getAutoSuggestions().put("environment", envNames);
    configsViewModel.getAutoSuggestions().put("pluggable_scm", scms);
    configsViewModel.getAutoSuggestions().put("package_repository", pkgRepos);
    configsViewModel.getAutoSuggestions().put("cluster_profile", clusterProfiles);
    final String etag = etagFor(configsViewModel);
    if (fresh(request, etag)) {
        return notModified(response);
    }
    setEtagHeader(response, etag);
    return writerForTopLevelObject(request, response, writer -> SecretConfigsViewModelRepresenter.toJSON(writer, configsViewModel));
}
Also used : SecretConfigsViewModel(com.thoughtworks.go.apiv1.internalsecretconfig.models.SecretConfigsViewModel) SecretConfigs(com.thoughtworks.go.config.SecretConfigs)

Example 3 with SecretConfigs

use of com.thoughtworks.go.config.SecretConfigs in project gocd by gocd.

the class SecretConfigUpdateCommand method update.

@Override
public void update(CruiseConfig preprocessedConfig) {
    SecretConfig existingSecretConfig = findExistingProfile(preprocessedConfig);
    SecretConfigs secretConfigs = getPluginProfiles(preprocessedConfig);
    secretConfigs.set(secretConfigs.indexOf(existingSecretConfig), profile);
}
Also used : SecretConfig(com.thoughtworks.go.config.SecretConfig) SecretConfigs(com.thoughtworks.go.config.SecretConfigs)

Aggregations

SecretConfigs (com.thoughtworks.go.config.SecretConfigs)3 SecretConfigsViewModel (com.thoughtworks.go.apiv1.internalsecretconfig.models.SecretConfigsViewModel)1 SecretConfig (com.thoughtworks.go.config.SecretConfig)1