Skip to content

Commit

Permalink
feat: Add fcli fod issue list command
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Apr 2, 2024
1 parent 1a9ac33 commit 2b97d5c
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fortify.cli.fod.action.cli.cmd.FoDActionCommands;
import com.fortify.cli.fod.app.cli.cmd.FoDAppCommands;
import com.fortify.cli.fod.dast_scan.cli.cmd.FoDDastScanCommands;
import com.fortify.cli.fod.issue.cli.cmd.FoDIssueCommands;
import com.fortify.cli.fod.mast_scan.cli.cmd.FoDMastScanCommands;
import com.fortify.cli.fod.microservice.cli.cmd.FoDMicroserviceCommands;
import com.fortify.cli.fod.oss_scan.cli.cmd.FoDOssScanCommands;
Expand Down Expand Up @@ -52,6 +53,7 @@
FoDDastScanCommands.class,
FoDMastScanCommands.class,
FoDOssScanCommands.class,
FoDIssueCommands.class,
FoDReportCommands.class,
FoDRestCommands.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.fod.issue.cli.cmd;

import com.fortify.cli.common.cli.cmd.AbstractContainerCommand;

import picocli.CommandLine;

@CommandLine.Command(name = "issue",
subcommands = {
FoDIssueListCommand.class,
}
)
//@DefaultVariablePropertyName("applicationId")
public class FoDIssueCommands extends AbstractContainerCommand {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* 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.fod.issue.cli.cmd;

import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins;
import com.fortify.cli.common.rest.query.IServerSideQueryParamGeneratorSupplier;
import com.fortify.cli.common.rest.query.IServerSideQueryParamValueGenerator;
import com.fortify.cli.fod._common.cli.mixin.FoDDelimiterMixin;
import com.fortify.cli.fod._common.output.cli.cmd.AbstractFoDBaseRequestOutputCommand;
import com.fortify.cli.fod._common.rest.query.FoDFiltersParamGenerator;
import com.fortify.cli.fod._common.rest.query.cli.mixin.FoDFiltersParamMixin;
import com.fortify.cli.fod.release.cli.mixin.FoDReleaseByQualifiedNameOrIdResolverMixin;

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 FoDIssueListCommand extends AbstractFoDBaseRequestOutputCommand implements IServerSideQueryParamGeneratorSupplier {
@Getter @Mixin private OutputHelperMixins.List outputHelper;
@Mixin private FoDDelimiterMixin delimiterMixin; // Is automatically injected in resolver mixins
@Mixin private FoDReleaseByQualifiedNameOrIdResolverMixin.RequiredOption releaseResolver;
@Mixin private FoDFiltersParamMixin filterParamMixin;
@Getter private IServerSideQueryParamValueGenerator serverSideQueryParamGenerator = new FoDFiltersParamGenerator();
// .add("id","applicationId")
// .add("name","applicationName")
// .add("criticality", "businessCriticalityType")
// .add("type", "applicationType");

@Override
public HttpRequest<?> getBaseRequest(UnirestInstance unirest) {
return unirest.get("/api/v3/releases/{releaseId}/vulnerabilities")
.routeParam("releaseId", releaseResolver.getReleaseId(unirest));
}

@Override
public boolean isSingular() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,15 @@ fcli.fod.oss-scan.download.file = File path and name where to save the SBOM file
fcli.fod.oss-scan.download-latest.usage.header = Download latest scan results from release.
fcli.fod.oss-scan.download-latest.file = File path and name where to save the SBOM file.

# fcli fod issue
fcli.fod.issue.usage.header = Manage FoD issues (vulnerabilities) and related entities.
fcli.fod.issue.list.usage.header = List vulnerabilities.
# TODO --embed option yet to be added.
fcli.fod.issue.list.embed = Embed extra issue data. Allowed values: ${COMPLETION-CANDIDATES}. \
Using the --output option, this extra data can be included in the output. Using the --query option, \
this extra data can be queried upon. To get an understanding of the structure and contents of the \
embedded data, use the --output json or --output yaml options.

# fcli fod report
fcli.fod.report.usage.header = Manage FoD reports.
fcli.fod.report.output.header.reportId = Id
Expand Down Expand Up @@ -783,3 +792,4 @@ fcli.fod.session.output.table.options = name,type,url,created,expires,expired
fcli.fod.rest.lookup.output.table.options = group,text,value
fcli.fod.report.output.table.options = reportId,reportName,reportStatusType,reportType
fcli.fod.report.report-template.output.table.options = value,text,group
fcli.fod.issue.list.output.table.options = id,primaryLocation,lineNumber,category

0 comments on commit 2b97d5c

Please sign in to comment.