Search in sources :

Example 1 with CONFIG_REPO

use of com.thoughtworks.go.config.policy.SupportedEntity.CONFIG_REPO in project gocd by gocd.

the class ConfigReposControllerV4 method index.

String index(Request req, Response res) {
    ConfigReposConfig repos = allRepos();
    ConfigReposConfig userSpecificRepos = repos.stream().filter(configRepoConfig -> authHelper.doesUserHasPermissions(currentUsername(), getAction(req), CONFIG_REPO, configRepoConfig.getId())).collect(toCollection(ConfigReposConfig::new));
    String etag = entityHashingService.hashForEntity(userSpecificRepos);
    setEtagHeader(res, etag);
    if (fresh(req, etag)) {
        return notModified(res);
    }
    return jsonizeAsTopLevelObject(req, w -> ConfigReposConfigRepresenterV4.toJSON(w, userSpecificRepos));
}
Also used : CrudController(com.thoughtworks.go.api.CrudController) EntityType(com.thoughtworks.go.config.exceptions.EntityType) MaterialConfigConverter(com.thoughtworks.go.server.service.MaterialConfigConverter) Autowired(org.springframework.beans.factory.annotation.Autowired) MessageJson(com.thoughtworks.go.api.util.MessageJson) MaterialConfig(com.thoughtworks.go.domain.materials.MaterialConfig) ConfigRepoConfig(com.thoughtworks.go.config.remote.ConfigRepoConfig) EntityHashingService(com.thoughtworks.go.server.service.EntityHashingService) Collectors.toCollection(java.util.stream.Collectors.toCollection) JsonReader(com.thoughtworks.go.api.representers.JsonReader) Request(spark.Request) SparkSpringController(com.thoughtworks.go.spark.spring.SparkSpringController) ApiVersion(com.thoughtworks.go.api.ApiVersion) MaterialUpdateService(com.thoughtworks.go.server.materials.MaterialUpdateService) Routes(com.thoughtworks.go.spark.Routes) RecordNotFoundException(com.thoughtworks.go.config.exceptions.RecordNotFoundException) ApiController(com.thoughtworks.go.api.ApiController) GsonTransformer(com.thoughtworks.go.api.util.GsonTransformer) HaltApiResponses.haltBecauseEntityAlreadyExists(com.thoughtworks.go.api.util.HaltApiResponses.haltBecauseEntityAlreadyExists) PartialConfigRepresenter(com.thoughtworks.go.apiv4.configrepos.representers.PartialConfigRepresenter) ConfigRepoService(com.thoughtworks.go.server.service.ConfigRepoService) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig) ApiAuthenticationHelper(com.thoughtworks.go.api.spring.ApiAuthenticationHelper) Consumer(java.util.function.Consumer) HttpStatus(org.springframework.http.HttpStatus) OutputWriter(com.thoughtworks.go.api.base.OutputWriter) Component(org.springframework.stereotype.Component) ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig) Response(spark.Response) HttpLocalizedOperationResult(com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult) CONFIG_REPO(com.thoughtworks.go.config.policy.SupportedEntity.CONFIG_REPO) HaltApiResponses.haltBecauseEtagDoesNotMatch(com.thoughtworks.go.api.util.HaltApiResponses.haltBecauseEtagDoesNotMatch) ConfigReposConfigRepresenterV4(com.thoughtworks.go.apiv4.configrepos.representers.ConfigReposConfigRepresenterV4) Spark(spark.Spark) ConfigRepoConfigRepresenterV4(com.thoughtworks.go.apiv4.configrepos.representers.ConfigRepoConfigRepresenterV4) CachedDigestUtils.sha512_256Hex(com.thoughtworks.go.util.CachedDigestUtils.sha512_256Hex) ConfigReposConfig(com.thoughtworks.go.config.remote.ConfigReposConfig)

Aggregations

ApiController (com.thoughtworks.go.api.ApiController)1 ApiVersion (com.thoughtworks.go.api.ApiVersion)1 CrudController (com.thoughtworks.go.api.CrudController)1 OutputWriter (com.thoughtworks.go.api.base.OutputWriter)1 JsonReader (com.thoughtworks.go.api.representers.JsonReader)1 ApiAuthenticationHelper (com.thoughtworks.go.api.spring.ApiAuthenticationHelper)1 GsonTransformer (com.thoughtworks.go.api.util.GsonTransformer)1 HaltApiResponses.haltBecauseEntityAlreadyExists (com.thoughtworks.go.api.util.HaltApiResponses.haltBecauseEntityAlreadyExists)1 HaltApiResponses.haltBecauseEtagDoesNotMatch (com.thoughtworks.go.api.util.HaltApiResponses.haltBecauseEtagDoesNotMatch)1 MessageJson (com.thoughtworks.go.api.util.MessageJson)1 ConfigRepoConfigRepresenterV4 (com.thoughtworks.go.apiv4.configrepos.representers.ConfigRepoConfigRepresenterV4)1 ConfigReposConfigRepresenterV4 (com.thoughtworks.go.apiv4.configrepos.representers.ConfigReposConfigRepresenterV4)1 PartialConfigRepresenter (com.thoughtworks.go.apiv4.configrepos.representers.PartialConfigRepresenter)1 EntityType (com.thoughtworks.go.config.exceptions.EntityType)1 RecordNotFoundException (com.thoughtworks.go.config.exceptions.RecordNotFoundException)1 CONFIG_REPO (com.thoughtworks.go.config.policy.SupportedEntity.CONFIG_REPO)1 ConfigRepoConfig (com.thoughtworks.go.config.remote.ConfigRepoConfig)1 ConfigReposConfig (com.thoughtworks.go.config.remote.ConfigReposConfig)1 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)1