-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
fcli sc-sast sensor-pool list
command
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 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
26 changes: 26 additions & 0 deletions
26
...t/src/main/java/com/fortify/cli/sc_sast/sensor_pool/cli/cmd/SCSastSensorPoolCommands.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,26 @@ | ||
/******************************************************************************* | ||
* Copyright 2021, 2023 Open Text. | ||
* | ||
* The only warranties for products and services of Open Text | ||
* and its affiliates and licensors ("Open Text") are as may | ||
* be set forth in the express warranty statements accompanying | ||
* such products and services. Nothing herein should be construed | ||
* as constituting an additional warranty. Open Text shall not be | ||
* liable for technical or editorial errors or omissions contained | ||
* herein. The information contained herein is subject to change | ||
* without notice. | ||
*******************************************************************************/ | ||
package com.fortify.cli.sc_sast.sensor_pool.cli.cmd; | ||
|
||
import com.fortify.cli.common.cli.cmd.AbstractContainerCommand; | ||
import picocli.CommandLine.Command; | ||
|
||
@Command( | ||
name = "sensor-pool", | ||
subcommands = { | ||
SCSastSensorPoolListCommand.class, | ||
} | ||
) | ||
|
||
public class SCSastSensorPoolCommands extends AbstractContainerCommand { | ||
} |
38 changes: 38 additions & 0 deletions
38
...rc/main/java/com/fortify/cli/sc_sast/sensor_pool/cli/cmd/SCSastSensorPoolListCommand.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,38 @@ | ||
package com.fortify.cli.sc_sast.sensor_pool.cli.cmd; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fortify.cli.common.json.JsonHelper; | ||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.common.output.transform.IInputTransformer; | ||
import com.fortify.cli.sc_sast._common.output.cli.cmd.AbstractSCSastControllerBaseRequestOutputCommand; | ||
|
||
import kong.unirest.HttpRequest; | ||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command(name = OutputHelperMixins.List.CMD_NAME) | ||
public class SCSastSensorPoolListCommand extends AbstractSCSastControllerBaseRequestOutputCommand implements IInputTransformer { | ||
|
||
@Getter @Mixin private OutputHelperMixins.List outputHelper; | ||
|
||
|
||
@Override | ||
protected HttpRequest<?> getBaseRequest(UnirestInstance unirest) { | ||
return unirest.get("/rest/v4/info/pools"); | ||
} | ||
|
||
@Override | ||
public JsonNode transformInput(JsonNode input) { | ||
return JsonHelper.evaluateSpelExpression(input, "beans", ArrayNode.class); | ||
} | ||
|
||
@Override | ||
public boolean isSingular() { | ||
return false; | ||
} | ||
|
||
|
||
} |
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