Search in sources :

Example 1 with Project

use of com.netflix.spinnaker.front50.model.project.Project in project front50 by spinnaker.

the class ProjectsController method put.

@ApiOperation(value = "", notes = "Update an existing project")
@RequestMapping(method = RequestMethod.PUT, value = "/{projectId}")
public Project put(@PathVariable final String projectId, @RequestBody final Project project) {
    Project existingProject = projectDAO.findById(projectId);
    project.setId(existingProject.getId());
    project.setCreateTs(existingProject.getCreateTs());
    project.setUpdateTs(System.currentTimeMillis());
    try {
        if (!projectDAO.findByName(project.getName()).getId().equals(projectId)) {
            // renamed projects must still be uniquely named
            throw new InvalidRequestException(format("A Project named '%s' already exists", project.getName()));
        }
    } catch (NotFoundException ignored) {
    }
    projectDAO.update(projectId, project);
    return project;
}
Also used : Project(com.netflix.spinnaker.front50.model.project.Project) NotFoundException(com.netflix.spinnaker.kork.web.exceptions.NotFoundException) InvalidRequestException(com.netflix.spinnaker.front50.exceptions.InvalidRequestException) ApiOperation(io.swagger.annotations.ApiOperation)

Example 2 with Project

use of com.netflix.spinnaker.front50.model.project.Project in project front50 by spinnaker.

the class GcsConfig method googleCloudStorageService.

private GcsStorageService googleCloudStorageService(Storage storage, String dataFilename, GcsProperties gcsProperties) {
    var executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat(GcsStorageService.class.getName() + "-%s").build());
    GcsStorageService service = new GcsStorageService(storage, gcsProperties.getBucket(), gcsProperties.getBucketLocation(), gcsProperties.getRootFolder(), dataFilename, new ObjectMapper().addMixIn(Timestamped.class, TimestampedMixins.class).addMixIn(Pipeline.class, PipelineMixins.class), executor);
    log.info("Using Google Cloud Storage bucket={} in project={}", value("bucket", gcsProperties.getBucket()), value("project", gcsProperties.getProject()));
    return service;
}
Also used : ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) GcsStorageService(com.netflix.spinnaker.front50.model.GcsStorageService) PipelineMixins(com.netflix.spinnaker.front50.jackson.mixins.PipelineMixins) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Pipeline(com.netflix.spinnaker.front50.api.model.pipeline.Pipeline)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 Pipeline (com.netflix.spinnaker.front50.api.model.pipeline.Pipeline)1 InvalidRequestException (com.netflix.spinnaker.front50.exceptions.InvalidRequestException)1 PipelineMixins (com.netflix.spinnaker.front50.jackson.mixins.PipelineMixins)1 GcsStorageService (com.netflix.spinnaker.front50.model.GcsStorageService)1 Project (com.netflix.spinnaker.front50.model.project.Project)1 NotFoundException (com.netflix.spinnaker.kork.web.exceptions.NotFoundException)1 ApiOperation (io.swagger.annotations.ApiOperation)1