-
Notifications
You must be signed in to change notification settings - Fork 33
Added fod xxx-scan update commands
#1024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kadraman
wants to merge
1
commit into
fortify:dev/v3.x
Choose a base branch
from
kadraman:fod-scan-update-command
base: dev/v3.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
61 changes: 61 additions & 0 deletions
61
.../src/main/java/com/fortify/cli/fod/_common/scan/cli/cmd/AbstractFoDScanUpdateCommand.java
This file contains hidden or 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,61 @@ | ||
| /* | ||
| * Copyright 2021-2026 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._common.scan.cli.cmd; | ||
|
|
||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import com.fortify.cli.common.cli.util.CommandGroup; | ||
| import com.fortify.cli.common.output.transform.IActionCommandResultSupplier; | ||
| import com.fortify.cli.fod._common.cli.mixin.FoDDelimiterMixin; | ||
| import com.fortify.cli.fod._common.output.cli.cmd.AbstractFoDJsonNodeOutputCommand; | ||
| import com.fortify.cli.fod._common.scan.cli.mixin.FoDScanResolverMixin; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanDescriptor; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanHelper; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanPutRequest; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanType; | ||
| import com.fortify.cli.fod._common.util.FoDEnums; | ||
| import com.fortify.cli.fod.attribute.cli.mixin.FoDAttributeUpdateOptions; | ||
| import com.fortify.cli.fod.attribute.helper.FoDAttributeDefinitionHelper; | ||
|
|
||
| import kong.unirest.UnirestInstance; | ||
| import picocli.CommandLine.Mixin; | ||
|
|
||
| @CommandGroup("*-scan") | ||
| public abstract class AbstractFoDScanUpdateCommand extends AbstractFoDJsonNodeOutputCommand implements IActionCommandResultSupplier { | ||
| @Mixin private FoDDelimiterMixin delimiterMixin; | ||
| @Mixin private FoDScanResolverMixin.PositionalParameter scanResolver; | ||
| @Mixin private FoDAttributeUpdateOptions.RequiredAttrOption scanAttrsUpdate; | ||
|
|
||
| @Override | ||
| public final JsonNode getJsonNode(UnirestInstance unirest) { | ||
| FoDScanDescriptor descriptor = scanResolver.getScanDescriptor(unirest, getScanType()); | ||
| JsonNode jsonAttrs = new FoDAttributeDefinitionHelper(unirest).buildAttributesNodeForUpdate( | ||
| FoDEnums.AttributeTypes.Scan, | ||
| descriptor.getAttributes(), | ||
| scanAttrsUpdate.getAttributes(), | ||
| false); | ||
| FoDScanPutRequest request = FoDScanPutRequest.builder().attributes(jsonAttrs).build(); | ||
| return FoDScanHelper.updateScan(unirest, descriptor.getScanId(), request).asJsonNode(); | ||
| } | ||
|
|
||
| protected abstract FoDScanType getScanType(); | ||
|
|
||
| @Override | ||
| public final String getActionCommandResult() { | ||
| return "UPDATED"; | ||
| } | ||
|
|
||
| @Override | ||
| public final boolean isSingular() { | ||
| return true; | ||
| } | ||
| } |
This file contains hidden or 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
28 changes: 28 additions & 0 deletions
28
...ore/fcli-fod/src/main/java/com/fortify/cli/fod/_common/scan/helper/FoDScanPutRequest.java
This file contains hidden or 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,28 @@ | ||
| /* | ||
| * Copyright 2021-2026 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._common.scan.helper; | ||
|
|
||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import com.formkiq.graalvm.annotations.Reflectable; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import lombok.ToString; | ||
|
|
||
| @Reflectable @NoArgsConstructor @AllArgsConstructor | ||
| @Getter @ToString @Builder | ||
| public class FoDScanPutRequest { | ||
| private JsonNode attributes; | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
...cli-fod/src/main/java/com/fortify/cli/fod/dast_scan/cli/cmd/FoDDastScanUpdateCommand.java
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Copyright 2021-2026 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.dast_scan.cli.cmd; | ||
|
|
||
| import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
| import com.fortify.cli.fod._common.scan.cli.cmd.AbstractFoDScanUpdateCommand; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanType; | ||
|
|
||
| import lombok.Getter; | ||
| import picocli.CommandLine.Command; | ||
| import picocli.CommandLine.Mixin; | ||
|
|
||
| @Command(name = OutputHelperMixins.Update.CMD_NAME, hidden = true) | ||
| public class FoDDastScanUpdateCommand extends AbstractFoDScanUpdateCommand { | ||
| @Getter @Mixin private OutputHelperMixins.Update outputHelper; | ||
|
|
||
| @Override | ||
| protected FoDScanType getScanType() { | ||
| return FoDScanType.Dynamic; | ||
| } | ||
| } | ||
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
...cli-fod/src/main/java/com/fortify/cli/fod/mast_scan/cli/cmd/FoDMastScanUpdateCommand.java
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Copyright 2021-2026 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.mast_scan.cli.cmd; | ||
|
|
||
| import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
| import com.fortify.cli.fod._common.scan.cli.cmd.AbstractFoDScanUpdateCommand; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanType; | ||
|
|
||
| import lombok.Getter; | ||
| import picocli.CommandLine.Command; | ||
| import picocli.CommandLine.Mixin; | ||
|
|
||
| @Command(name = OutputHelperMixins.Update.CMD_NAME, hidden = false) | ||
| public class FoDMastScanUpdateCommand extends AbstractFoDScanUpdateCommand { | ||
| @Getter @Mixin private OutputHelperMixins.Update outputHelper; | ||
|
|
||
| @Override | ||
| protected FoDScanType getScanType() { | ||
| return FoDScanType.Mobile; | ||
| } | ||
| } |
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
.../fcli-fod/src/main/java/com/fortify/cli/fod/oss_scan/cli/cmd/FoDOssScanUpdateCommand.java
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Copyright 2021-2026 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.oss_scan.cli.cmd; | ||
|
|
||
| import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
| import com.fortify.cli.fod._common.scan.cli.cmd.AbstractFoDScanUpdateCommand; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanType; | ||
|
|
||
| import lombok.Getter; | ||
| import picocli.CommandLine.Command; | ||
| import picocli.CommandLine.Mixin; | ||
|
|
||
| @Command(name = OutputHelperMixins.Update.CMD_NAME, hidden = false) | ||
| public class FoDOssScanUpdateCommand extends AbstractFoDScanUpdateCommand { | ||
| @Getter @Mixin private OutputHelperMixins.Update outputHelper; | ||
|
|
||
| @Override | ||
| protected FoDScanType getScanType() { | ||
| return FoDScanType.OpenSource; | ||
| } | ||
| } |
This file contains hidden or 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
31 changes: 31 additions & 0 deletions
31
...cli-fod/src/main/java/com/fortify/cli/fod/sast_scan/cli/cmd/FoDSastScanUpdateCommand.java
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Copyright 2021-2026 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.sast_scan.cli.cmd; | ||
|
|
||
| import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
| import com.fortify.cli.fod._common.scan.cli.cmd.AbstractFoDScanUpdateCommand; | ||
| import com.fortify.cli.fod._common.scan.helper.FoDScanType; | ||
|
|
||
| import lombok.Getter; | ||
| import picocli.CommandLine.Command; | ||
| import picocli.CommandLine.Mixin; | ||
|
|
||
| @Command(name = OutputHelperMixins.Update.CMD_NAME, hidden = false) | ||
| public class FoDSastScanUpdateCommand extends AbstractFoDScanUpdateCommand { | ||
| @Getter @Mixin private OutputHelperMixins.Update outputHelper; | ||
|
|
||
| @Override | ||
| protected FoDScanType getScanType() { | ||
| return FoDScanType.Static; | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.