-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding new endpoints and functionality
- Loading branch information
Eric Kerwin
committed
Jun 16, 2021
1 parent
10adc95
commit 30d3cc7
Showing
19 changed files
with
617 additions
and
394 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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/synopsys/integration/chitstop/ApplicationProperties.java
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* chitstop | ||
* | ||
* Copyright (c) 2021 Synopsys, Inc. | ||
* | ||
* Use subject to the terms and conditions of the Synopsys End User Software License and Maintenance Agreement. All rights reserved worldwide. | ||
*/ | ||
package com.synopsys.integration.chitstop; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ApplicationProperties { | ||
@Value("${stored.tokens.path}") | ||
private String storedTokensPath; | ||
|
||
public String getStoredTokensPath() { | ||
return storedTokensPath; | ||
} | ||
|
||
} |
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
52 changes: 0 additions & 52 deletions
52
src/main/java/com/synopsys/integration/chitstop/controller/ApiTokenController.java
This file was deleted.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
src/main/java/com/synopsys/integration/chitstop/model/ApiToken.java
This file was deleted.
Oops, something went wrong.
83 changes: 0 additions & 83 deletions
83
src/main/java/com/synopsys/integration/chitstop/model/ApiTokens.java
This file was deleted.
Oops, something went wrong.
77 changes: 77 additions & 0 deletions
77
src/main/java/com/synopsys/integration/chitstop/rest/controller/ApiTokenController.java
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* chitstop | ||
* | ||
* Copyright (c) 2021 Synopsys, Inc. | ||
* | ||
* Use subject to the terms and conditions of the Synopsys End User Software License and Maintenance Agreement. All rights reserved worldwide. | ||
*/ | ||
package com.synopsys.integration.chitstop.rest.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.synopsys.integration.chitstop.rest.model.ApiToken; | ||
import com.synopsys.integration.chitstop.rest.model.VmKey; | ||
import com.synopsys.integration.chitstop.service.ApiTokens; | ||
|
||
@RestController | ||
public class ApiTokenController { | ||
private final ApiTokens apiTokens; | ||
|
||
@Autowired | ||
public ApiTokenController(ApiTokens apiTokens) { | ||
this.apiTokens = apiTokens; | ||
} | ||
|
||
@GetMapping("/puretoken") | ||
public String retrievePure( | ||
@RequestParam(value = "vm") VmKey vmKey, | ||
@RequestParam(value = "username", required = false) String username | ||
) { | ||
return apiTokens.findPure(vmKey, username); | ||
} | ||
|
||
@GetMapping("/token") | ||
public ApiToken retrieve( | ||
@RequestParam(value = "vm") VmKey vmKey, | ||
@RequestParam(value = "username", required = false) String username | ||
) { | ||
return apiTokens.find(vmKey, username); | ||
} | ||
|
||
@GetMapping("/tokens") | ||
public List<ApiToken> retrieveVmTokens(@RequestParam(value = "vm", required = false) VmKey vmKey) { | ||
return apiTokens.findAll(vmKey); | ||
} | ||
|
||
@GetMapping("/report") | ||
public String tokensReport() { | ||
return apiTokens.tokensStatusReport(); | ||
} | ||
|
||
@PutMapping("/token") | ||
public void store(@RequestBody ApiToken apiToken) { | ||
apiTokens.storeToken(apiToken); | ||
} | ||
|
||
@DeleteMapping("/token") | ||
public void clearVmToken( | ||
@RequestParam(value = "vm") VmKey vmKey, | ||
@RequestParam(value = "token") String token | ||
) { | ||
apiTokens.deleteVmToken(vmKey, token); | ||
} | ||
|
||
@DeleteMapping("/tokens") | ||
public void clearVmTokens(@RequestParam(value = "vm") VmKey vmKey) { | ||
apiTokens.deleteVmTokens(vmKey); | ||
} | ||
|
||
} |
Oops, something went wrong.