diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/_common/output/cli/mixin/SSCOutputHelperMixins.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/_common/output/cli/mixin/SSCOutputHelperMixins.java index 3f132cdadd..e039d91eeb 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/_common/output/cli/mixin/SSCOutputHelperMixins.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/_common/output/cli/mixin/SSCOutputHelperMixins.java @@ -120,4 +120,14 @@ public static class GetJob extends DetailsNoQuery { public static class UploadSeedBundle extends TableNoQuery { public static final String CMD_NAME = "upload-seed-bundle"; } + + @Command(aliases = {"lss"}) + public static class ListSettings extends TableWithQuery { + public static final String CMD_NAME = "list-settings"; + } + + @Command(aliases = {"lsr"}) + public static class ListRulepacks extends TableWithQuery { + public static final String CMD_NAME = "list-rulepacks"; + } } diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCActivityFeedListCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateActivitiesListCommand.java similarity index 94% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCActivityFeedListCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateActivitiesListCommand.java index feed22fffc..b3300b6bdc 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCActivityFeedListCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateActivitiesListCommand.java @@ -32,7 +32,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.ListActivities.CMD_NAME) @CommandGroup("activity") -public class SSCActivityFeedListCommand extends AbstractSSCBaseRequestOutputCommand implements IRecordTransformer, IServerSideQueryParamGeneratorSupplier { +public class SSCStateActivitiesListCommand extends AbstractSSCBaseRequestOutputCommand implements IRecordTransformer, IServerSideQueryParamGeneratorSupplier { @Getter @Mixin private SSCOutputHelperMixins.ListActivities outputHelper; @Mixin private SSCQParamMixin qParamMixin; @Getter private IServerSideQueryParamValueGenerator serverSideQueryParamGenerator = new SSCQParamGenerator() diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCEventListCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateEventListCommand.java similarity index 94% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCEventListCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateEventListCommand.java index 6dae4e5d46..1c509a3d20 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCEventListCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateEventListCommand.java @@ -31,7 +31,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.ListEvents.CMD_NAME) @CommandGroup("event") -public class SSCEventListCommand extends AbstractSSCBaseRequestOutputCommand implements IRecordTransformer, IServerSideQueryParamGeneratorSupplier { +public class SSCStateEventListCommand extends AbstractSSCBaseRequestOutputCommand implements IRecordTransformer, IServerSideQueryParamGeneratorSupplier { @Getter @Mixin private SSCOutputHelperMixins.ListEvents outputHelper; @Mixin private SSCQParamMixin qParamMixin; @Getter private IServerSideQueryParamValueGenerator serverSideQueryParamGenerator = new SSCQParamGenerator() diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobCancelCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobCancelCommand.java similarity index 95% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobCancelCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobCancelCommand.java index 79d8cfce20..af1e39e60f 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobCancelCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobCancelCommand.java @@ -29,7 +29,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.CancelJob.CMD_NAME) @CommandGroup("job") -public class SSCJobCancelCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { +public class SSCStateJobCancelCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { @Getter @Mixin private SSCOutputHelperMixins.CancelJob outputHelper; @Mixin private SSCJobResolverMixin.PositionalParameter jobResolver; diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobGetCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobGetCommand.java similarity index 95% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobGetCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobGetCommand.java index 990d51aa2b..168da43fb9 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobGetCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobGetCommand.java @@ -24,7 +24,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.GetJob.CMD_NAME) @CommandGroup("job") -public class SSCJobGetCommand extends AbstractSSCJsonNodeOutputCommand { +public class SSCStateJobGetCommand extends AbstractSSCJsonNodeOutputCommand { @Getter @Mixin private SSCOutputHelperMixins.GetJob outputHelper; @Mixin private SSCJobResolverMixin.PositionalParameter jobResolver; diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobListCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobListCommand.java similarity index 92% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobListCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobListCommand.java index ff009b0503..794d4d432d 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobListCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobListCommand.java @@ -29,7 +29,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.ListJobs.CMD_NAME) @CommandGroup("job") -public class SSCJobListCommand extends AbstractSSCBaseRequestOutputCommand implements IServerSideQueryParamGeneratorSupplier { +public class SSCStateJobListCommand extends AbstractSSCBaseRequestOutputCommand implements IServerSideQueryParamGeneratorSupplier { @Getter @Mixin private SSCOutputHelperMixins.ListJobs outputHelper; @Mixin private SSCQParamMixin qParamMixin; @Getter private IServerSideQueryParamValueGenerator serverSideQueryParamGenerator = new SSCQParamGenerator() @@ -41,7 +41,7 @@ public class SSCJobListCommand extends AbstractSSCBaseRequestOutputCommand imple @Override public HttpRequest getBaseRequest(UnirestInstance unirest) { - return unirest.get(SSCUrls.JOBS).queryString("limit","-1"); + return unirest.get(SSCUrls.JOBS); } @Override diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobUpdateCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobUpdateCommand.java similarity index 95% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobUpdateCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobUpdateCommand.java index 661bedbae9..f25f4e8426 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCJobUpdateCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateJobUpdateCommand.java @@ -29,7 +29,7 @@ import picocli.CommandLine.Option; @Command(name = SSCOutputHelperMixins.UpdateJob.CMD_NAME) @CommandGroup("job") -public class SSCJobUpdateCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { +public class SSCStateJobUpdateCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { @Getter @Mixin private SSCOutputHelperMixins.UpdateJob outputHelper; @Mixin private SSCJobResolverMixin.PositionalParameter jobResolver; @Option(names="--priority", required = true) Integer priority; diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateRulepackListCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateRulepackListCommand.java new file mode 100644 index 0000000000..26b25a56f4 --- /dev/null +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateRulepackListCommand.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * 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.ssc.system_state.cli.cmd; + +import com.fortify.cli.common.cli.util.CommandGroup; +import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCBaseRequestOutputCommand; +import com.fortify.cli.ssc._common.output.cli.mixin.SSCOutputHelperMixins; + +import kong.unirest.HttpRequest; +import kong.unirest.UnirestInstance; +import lombok.Getter; +import picocli.CommandLine.Command; +import picocli.CommandLine.Mixin; + +@Command(name = SSCOutputHelperMixins.ListRulepacks.CMD_NAME) @CommandGroup("rulepack") +public class SSCStateRulepackListCommand extends AbstractSSCBaseRequestOutputCommand { + @Getter @Mixin private SSCOutputHelperMixins.ListRulepacks outputHelper; + + @Override + public HttpRequest getBaseRequest(UnirestInstance unirest) { + return unirest.get("/api/v1/coreRulepacks"); + } + + @Override + public boolean isSingular() { + return false; + } +} diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSeedBundleUploadCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSeedBundleUploadCommand.java similarity index 94% rename from fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSeedBundleUploadCommand.java rename to fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSeedBundleUploadCommand.java index e5ab6c4af1..ef0f341342 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSeedBundleUploadCommand.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSeedBundleUploadCommand.java @@ -27,7 +27,7 @@ import picocli.CommandLine.Mixin; @Command(name = SSCOutputHelperMixins.UploadSeedBundle.CMD_NAME) @CommandGroup("seed-bundle") -public class SSCSeedBundleUploadCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { +public class SSCStateSeedBundleUploadCommand extends AbstractSSCJsonNodeOutputCommand implements IActionCommandResultSupplier { @Getter @Mixin private SSCOutputHelperMixins.UploadSeedBundle outputHelper; @Mixin private CommonOptionMixins.RequiredFile fileMixin; diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSettingsListCommand.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSettingsListCommand.java new file mode 100644 index 0000000000..b2a713f220 --- /dev/null +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCStateSettingsListCommand.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * 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.ssc.system_state.cli.cmd; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fortify.cli.common.cli.util.CommandGroup; +import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCJsonNodeOutputCommand; +import com.fortify.cli.ssc._common.output.cli.mixin.SSCOutputHelperMixins; + +import kong.unirest.UnirestInstance; +import lombok.Getter; +import picocli.CommandLine.Command; +import picocli.CommandLine.Mixin; + +@Command(name = SSCOutputHelperMixins.ListSettings.CMD_NAME) @CommandGroup("settings") +public class SSCStateSettingsListCommand extends AbstractSSCJsonNodeOutputCommand { + @Getter @Mixin private SSCOutputHelperMixins.ListSettings outputHelper; + + @Override + public JsonNode getJsonNode(UnirestInstance unirest) { + return unirest.get("/api/v1/configuration").asObject(JsonNode.class).getBody() + .get("data") + .get("properties"); + } + + @Override + public boolean isSingular() { + return false; + } +} diff --git a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSystemStateCommands.java b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSystemStateCommands.java index ec87c0d0d1..69edf8b102 100644 --- a/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSystemStateCommands.java +++ b/fcli-core/fcli-ssc/src/main/java/com/fortify/cli/ssc/system_state/cli/cmd/SSCSystemStateCommands.java @@ -20,13 +20,15 @@ name = "system-state", aliases="state", subcommands = { - SSCActivityFeedListCommand.class, - SSCEventListCommand.class, - SSCJobCancelCommand.class, - SSCJobGetCommand.class, - SSCJobListCommand.class, - SSCJobUpdateCommand.class, - SSCSeedBundleUploadCommand.class + SSCStateActivitiesListCommand.class, + SSCStateEventListCommand.class, + SSCStateSettingsListCommand.class, + SSCStateSeedBundleUploadCommand.class, + SSCStateRulepackListCommand.class, + SSCStateJobCancelCommand.class, + SSCStateJobGetCommand.class, + SSCStateJobListCommand.class, + SSCStateJobUpdateCommand.class, } ) public class SSCSystemStateCommands extends AbstractContainerCommand { diff --git a/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/i18n/SSCMessages.properties b/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/i18n/SSCMessages.properties index 3430dfdd2f..0608d72930 100644 --- a/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/i18n/SSCMessages.properties +++ b/fcli-core/fcli-ssc/src/main/resources/com/fortify/cli/ssc/i18n/SSCMessages.properties @@ -355,6 +355,8 @@ fcli.ssc.role.permission.resolver.nameOrId = Role permission name or id. fcli.ssc.system-state.usage.header = View & manage SSC system state (logs, jobs, ...) fcli.ssc.system-state.list-activities.usage.header = List activity feed entries. fcli.ssc.system-state.list-events.usage.header = List system events. +fcli.ssc.system-state.list-settings.usage.header = List system settings. +fcli.ssc.system-state.list-rulepacks.usage.header = List installed rule packs. fcli.ssc.system-state.cancel-job.usage.header = Cancel a job. fcli.ssc.system-state.get-job.usage.header = Get job details. fcli.ssc.system-state.list-jobs.usage.header = List jobs. @@ -436,6 +438,8 @@ fcli.ssc.system-state.activity.output.table.options = eventDate,userName,eventTy fcli.ssc.system-state.event.output.table.options = eventDate,userName,eventType,detailedNote,applicationVersionId,entityId fcli.ssc.system-state.job.output.table.options = jobName,jobGroup,jobClass,state,cancellable,priority,createTime,startTime,finishTime fcli.ssc.system-state.seed-bundle.output.table.options = responseCode +fcli.ssc.system-state.settings.output.table.options = group,name,value +fcli.ssc.system-state.rulepack.output.table.options = rulepackGUID,name,version fcli.ssc.token.output.table.options = id,username,type,creationDate,terminalDate,timeRemaining,description fcli.ssc.token.create.output.table.options = id,username,type,restToken,applicationToken,terminalDate,timeRemaining,description fcli.ssc.token.revoke.output.table.options = responseCode