-
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.
chore: SSC performance-indicator improvements, add variable commands
- Loading branch information
Showing
14 changed files
with
345 additions
and
14 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
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
39 changes: 39 additions & 0 deletions
39
...y/cli/ssc/performance_indicator/cli/cmd/SSCPerformanceIndicatorDefinitionListCommand.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,39 @@ | ||
/******************************************************************************* | ||
* 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.performance_indicator.cli.cmd; | ||
|
||
import com.fortify.cli.common.cli.util.CommandGroup; | ||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCBaseRequestOutputCommand; | ||
import com.fortify.cli.ssc._common.rest.SSCUrls; | ||
|
||
import kong.unirest.HttpRequest; | ||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command(name = OutputHelperMixins.ListDefinitions.CMD_NAME) @CommandGroup("definition") | ||
public class SSCPerformanceIndicatorDefinitionListCommand extends AbstractSSCBaseRequestOutputCommand { | ||
@Getter @Mixin private OutputHelperMixins.ListDefinitions outputHelper; | ||
|
||
@Override | ||
public HttpRequest<?> getBaseRequest(UnirestInstance unirest) { | ||
return unirest.get(SSCUrls.PERFORMANCE_INDICATORS); | ||
} | ||
|
||
@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
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
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
28 changes: 28 additions & 0 deletions
28
...core/fcli-ssc/src/main/java/com/fortify/cli/ssc/variable/cli/cmd/SSCVariableCommands.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,28 @@ | ||
/******************************************************************************* | ||
* 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.variable.cli.cmd; | ||
|
||
import com.fortify.cli.common.cli.cmd.AbstractContainerCommand; | ||
|
||
import picocli.CommandLine.Command; | ||
|
||
@Command( | ||
name = "variable", aliases = "var", | ||
subcommands = { | ||
SSCVariableDefinitionListCommand.class, | ||
SSCVariableGetCommand.class, | ||
SSCVariableListCommand.class | ||
} | ||
) | ||
public class SSCVariableCommands extends AbstractContainerCommand { | ||
} |
39 changes: 39 additions & 0 deletions
39
.../src/main/java/com/fortify/cli/ssc/variable/cli/cmd/SSCVariableDefinitionListCommand.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,39 @@ | ||
/******************************************************************************* | ||
* 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.variable.cli.cmd; | ||
|
||
import com.fortify.cli.common.cli.util.CommandGroup; | ||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCBaseRequestOutputCommand; | ||
import com.fortify.cli.ssc._common.rest.SSCUrls; | ||
|
||
import kong.unirest.HttpRequest; | ||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command(name = OutputHelperMixins.ListDefinitions.CMD_NAME) @CommandGroup("definition") | ||
public class SSCVariableDefinitionListCommand extends AbstractSSCBaseRequestOutputCommand { | ||
@Getter @Mixin private OutputHelperMixins.ListDefinitions outputHelper; | ||
|
||
@Override | ||
public HttpRequest<?> getBaseRequest(UnirestInstance unirest) { | ||
return unirest.get(SSCUrls.VARIABLES); | ||
} | ||
|
||
@Override | ||
public boolean isSingular() { | ||
return false; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...re/fcli-ssc/src/main/java/com/fortify/cli/ssc/variable/cli/cmd/SSCVariableGetCommand.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,41 @@ | ||
/******************************************************************************* | ||
* 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.variable.cli.cmd; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCJsonNodeOutputCommand; | ||
import com.fortify.cli.ssc.appversion.cli.mixin.SSCAppVersionResolverMixin; | ||
import com.fortify.cli.ssc.variable.cli.mixin.SSCVariableResolverMixin; | ||
|
||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
|
||
@Command(name = OutputHelperMixins.Get.CMD_NAME) | ||
public class SSCVariableGetCommand extends AbstractSSCJsonNodeOutputCommand { | ||
@Getter @Mixin private OutputHelperMixins.Get outputHelper; | ||
@Mixin SSCVariableResolverMixin.PositionalParameterSingle variableResolver; | ||
@Mixin private SSCAppVersionResolverMixin.RequiredOption parentResolver; | ||
|
||
@Override | ||
public JsonNode getJsonNode(UnirestInstance unirest) { | ||
return variableResolver.getVariableDescriptor(unirest, parentResolver.getAppVersionId(unirest)).asJsonNode(); | ||
} | ||
|
||
@Override | ||
public boolean isSingular() { | ||
return true; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...e/fcli-ssc/src/main/java/com/fortify/cli/ssc/variable/cli/cmd/SSCVariableListCommand.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,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.variable.cli.cmd; | ||
|
||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.ssc._common.output.cli.cmd.AbstractSSCBaseRequestOutputCommand; | ||
import com.fortify.cli.ssc._common.rest.SSCUrls; | ||
import com.fortify.cli.ssc.appversion.cli.mixin.SSCAppVersionResolverMixin; | ||
|
||
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 SSCVariableListCommand extends AbstractSSCBaseRequestOutputCommand { | ||
@Getter @Mixin private OutputHelperMixins.List outputHelper; | ||
@Mixin private SSCAppVersionResolverMixin.RequiredOption parentResolver; | ||
|
||
@Override | ||
public HttpRequest<?> getBaseRequest(UnirestInstance unirest) { | ||
return unirest.get(SSCUrls.PROJECT_VERSION_VARIABLE_HISTORIES(parentResolver.getAppVersionId(unirest))); | ||
} | ||
|
||
@Override | ||
public boolean isSingular() { | ||
return false; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...li-ssc/src/main/java/com/fortify/cli/ssc/variable/cli/mixin/SSCVariableResolverMixin.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,41 @@ | ||
/******************************************************************************* | ||
* 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.variable.cli.mixin; | ||
|
||
import com.fortify.cli.ssc.variable.helper.SSCVariableDescriptor; | ||
import com.fortify.cli.ssc.variable.helper.SSCVariableHelper; | ||
|
||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Option; | ||
import picocli.CommandLine.Parameters; | ||
|
||
public class SSCVariableResolverMixin { | ||
private static abstract class AbstractSSCVariableResolverMixin { | ||
public abstract String getVariableNameOrIdOrGuid(); | ||
|
||
public SSCVariableDescriptor getVariableDescriptor(UnirestInstance unirest, String appVersionId) { | ||
return new SSCVariableHelper(unirest, appVersionId).getDescriptorByNameOrIdOrGuid(getVariableNameOrIdOrGuid(), true); | ||
} | ||
} | ||
|
||
public static class VariableOption extends AbstractSSCVariableResolverMixin { | ||
@Option(names="--Variable", descriptionKey = "fcli.ssc.variable.resolver.NameOrIdOrGuid") | ||
@Getter private String VariableNameOrIdOrGuid; | ||
} | ||
|
||
public static class PositionalParameterSingle extends AbstractSSCVariableResolverMixin { | ||
@Parameters(index = "0", arity = "1", descriptionKey = "fcli.ssc.variable.resolver.NameOrIdOrGuid") | ||
@Getter private String VariableNameOrIdOrGuid; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ore/fcli-ssc/src/main/java/com/fortify/cli/ssc/variable/helper/SSCVariableDescriptor.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,28 @@ | ||
/******************************************************************************* | ||
* 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.variable.helper; | ||
|
||
import com.formkiq.graalvm.annotations.Reflectable; | ||
import com.fortify.cli.common.json.JsonNodeHolder; | ||
|
||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Reflectable @NoArgsConstructor | ||
@Data @EqualsAndHashCode(callSuper=true) | ||
public class SSCVariableDescriptor extends JsonNodeHolder { | ||
private String id; | ||
private String guid; | ||
private String name; | ||
} |
Oops, something went wrong.