-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/excludeDisabledPipelines
- Loading branch information
Showing
15 changed files
with
81 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,10 @@ | |
import com.netflix.spinnaker.front50.model.application.ApplicationDAO; | ||
import com.netflix.spinnaker.front50.model.application.ApplicationPermissionDAO; | ||
import com.netflix.spinnaker.front50.model.application.ApplicationService; | ||
import com.netflix.spinnaker.kork.retrofit.Retrofit2SyncCall; | ||
import com.netflix.spinnaker.kork.web.exceptions.NotFoundException; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import java.util.*; | ||
import java.util.stream.Collectors; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
@@ -30,7 +31,7 @@ | |
|
||
@RestController | ||
@RequestMapping("/v2/applications") | ||
@Api(value = "application", description = "Application API") | ||
@Tag(name = "application", description = "Application API") | ||
public class ApplicationsController { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(ApplicationsController.class); | ||
|
@@ -62,9 +63,9 @@ public ApplicationsController( | |
|
||
@PreAuthorize("#restricted ? @fiatPermissionEvaluator.storeWholePermission() : true") | ||
@PostFilter("#restricted ? hasPermission(filterObject.name, 'APPLICATION', 'READ') : true") | ||
@ApiOperation( | ||
value = "", | ||
notes = | ||
@Operation( | ||
summary = "", | ||
description = | ||
"Fetch all applications.\n\nSupports filtering by one or more attributes:\n- [email protected]\n- [email protected]&name=flex") | ||
@RequestMapping(method = RequestMethod.GET) | ||
public List<Application> applications( | ||
|
@@ -113,7 +114,7 @@ public List<Application> applications( | |
} | ||
|
||
@PreAuthorize("@fiatPermissionEvaluator.canCreate('APPLICATION', #app)") | ||
@ApiOperation(value = "", notes = "Create an application") | ||
@Operation(summary = "", description = "Create an application") | ||
@RequestMapping(method = RequestMethod.POST) | ||
public Application create(@RequestBody final Application app) { | ||
if (applicationService.findByName(app.getName()) != null) { | ||
|
@@ -125,7 +126,7 @@ public Application create(@RequestBody final Application app) { | |
&& fiatConfigurationProperties.getRoleSync().isEnabled() | ||
&& fiatService.isPresent()) { | ||
try { | ||
fiatService.get().sync(); | ||
Retrofit2SyncCall.execute(fiatService.get().sync()); | ||
} catch (Exception e) { | ||
log.warn("failed to trigger fiat permission sync", e); | ||
} | ||
|
@@ -135,15 +136,15 @@ public Application create(@RequestBody final Application app) { | |
} | ||
|
||
@PreAuthorize("hasPermission(#applicationName, 'APPLICATION', 'WRITE')") | ||
@ApiOperation(value = "", notes = "Delete an application") | ||
@Operation(summary = "", description = "Delete an application") | ||
@RequestMapping(method = RequestMethod.DELETE, value = "/{applicationName:.+}") | ||
public void delete(@PathVariable String applicationName, HttpServletResponse response) { | ||
applicationService.delete(applicationName); | ||
response.setStatus(HttpStatus.NO_CONTENT.value()); | ||
} | ||
|
||
@PreAuthorize("hasPermission(#app.name, 'APPLICATION', 'WRITE')") | ||
@ApiOperation(value = "", notes = "Update an existing application by merging the attributes") | ||
@Operation(summary = "", description = "Update an existing application by merging the attributes") | ||
@RequestMapping(method = RequestMethod.PATCH, value = "/{applicationName:.+}") | ||
public Application update( | ||
@PathVariable final String applicationName, @RequestBody final Application app) { | ||
|
@@ -158,7 +159,9 @@ public Application update( | |
} | ||
|
||
@PreAuthorize("hasPermission(#app.name, 'APPLICATION', 'WRITE')") | ||
@ApiOperation(value = "", notes = "Update an existing application by replacing all attributes") | ||
@Operation( | ||
summary = "", | ||
description = "Update an existing application by replacing all attributes") | ||
@RequestMapping(method = RequestMethod.PUT, value = "/{applicationName:.+}") | ||
public Application replace( | ||
@PathVariable final String applicationName, @RequestBody final Application app) { | ||
|
@@ -173,7 +176,7 @@ public Application replace( | |
} | ||
|
||
@PostAuthorize("hasPermission(#applicationName, 'APPLICATION', 'READ')") | ||
@ApiOperation(value = "", notes = "Fetch a single application by name") | ||
@Operation(summary = "", description = "Fetch a single application by name") | ||
@RequestMapping(method = RequestMethod.GET, value = "/{applicationName:.+}") | ||
public Application get(@PathVariable final String applicationName) { | ||
Application app = applicationDAO.findByName(applicationName.toUpperCase()); | ||
|
Oops, something went wrong.