Skip to content

Commit

Permalink
feat: Add fcli sc-sast sensor-pool list command
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Sep 24, 2024
1 parent 14626d7 commit 77fcc1c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.fortify.cli.sc_sast.rest.cli.cmd.SCSastControllerRestCommands;
import com.fortify.cli.sc_sast.scan.cli.cmd.SCSastScanCommands;
import com.fortify.cli.sc_sast.sensor.cli.cmd.SCSastSensorCommands;
import com.fortify.cli.sc_sast.sensor_pool.cli.cmd.SCSastSensorPoolCommands;

import picocli.CommandLine.Command;

Expand All @@ -35,6 +36,7 @@
SCSastSessionCommands.class,
SCSastScanCommands.class,
SCSastSensorCommands.class,
SCSastSensorPoolCommands.class,
SCSastControllerRestCommands.class,
}
)
Expand Down
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 {
}
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;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ fcli.sc-sast.sensor.list.usage.header = List ScanCentral SAST sensors
fcli.sc-sast.sensor.list.usage.description = This command lists sensor information for all \
available SanCentral SAST sensors. It calls the SSC API and as such requires an active SSC session.

# fcli sc-sast sensor-pool
fcli.sc-sast.sensor-pool.usage.header = Manage ScanCentral SAST sensor pools
fcli.sc-sast.sensor-pool.list.usage.header = List ScanCentral SAST sensor pools

# fcli sc-sast rest
fcli.sc-sast.rest.usage.header = Interact with ScanCentral SAST Controller REST API endpoints.
fcli.sc-sast.rest.usage.description = These commands allow for direct interaction with ScanCentral SAST \
Expand Down Expand Up @@ -186,3 +190,4 @@ fcli.env.default.prefix=FCLI_DEFAULT
fcli.sc-sast.session.output.table.options = name,type,url,created,expires,expired
fcli.sc-sast.scan.output.table.options = jobToken,hasFiles,scanState,publishState,sscArtifactState,endpointVersion
fcli.sc-sast.sensor.output.table.options = hostName,state,cloudPool?.name,ipAddress,scaVersion,lastSeen,workerStartTime
fcli.sc-sast.sensor-pool.output.table.options = uuid,name,description

0 comments on commit 77fcc1c

Please sign in to comment.