-
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.
feat: Add
fcli fod release wait-for
command to wait for release(s) …
…to leave suspended state (resolves #624)
- Loading branch information
Showing
4 changed files
with
97 additions
and
2 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
48 changes: 48 additions & 0 deletions
48
.../fcli-fod/src/main/java/com/fortify/cli/fod/release/cli/cmd/FoDReleaseWaitForCommand.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,48 @@ | ||
/******************************************************************************* | ||
* 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.release.cli.cmd; | ||
|
||
import java.util.Set; | ||
|
||
import com.fortify.cli.common.output.cli.mixin.OutputHelperMixins; | ||
import com.fortify.cli.common.rest.cli.cmd.AbstractWaitForCommand; | ||
import com.fortify.cli.common.rest.wait.WaitHelper.WaitHelperBuilder; | ||
import com.fortify.cli.fod._common.cli.mixin.FoDDelimiterMixin; | ||
import com.fortify.cli.fod._common.session.cli.mixin.FoDUnirestInstanceSupplierMixin; | ||
import com.fortify.cli.fod.release.cli.mixin.FoDReleaseByQualifiedNameOrIdResolverMixin; | ||
|
||
import kong.unirest.UnirestInstance; | ||
import lombok.Getter; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
import picocli.CommandLine.Option; | ||
|
||
@Command(name = OutputHelperMixins.WaitFor.CMD_NAME) | ||
public final class FoDReleaseWaitForCommand extends AbstractWaitForCommand { | ||
@Getter @Mixin private FoDUnirestInstanceSupplierMixin unirestInstanceSupplier; | ||
@Mixin private FoDDelimiterMixin delimiterMixin; // Is automatically injected in resolver mixins | ||
@Mixin private FoDReleaseByQualifiedNameOrIdResolverMixin.PositionalParameterMulti releaseResolver; | ||
@Option(names={"-s", "--suspended"}, paramLabel="true|false", required=true, defaultValue="false", arity="1") | ||
private boolean suspended; | ||
|
||
@Override | ||
protected final WaitHelperBuilder configure(UnirestInstance unirest, WaitHelperBuilder builder) { | ||
return builder | ||
.recordsSupplier(releaseResolver::getReleaseDescriptorJsonNodes) | ||
.currentStateProperty("suspended") | ||
.knownStates("true", "false") | ||
.failureStates() | ||
.matchStates(Set.of(String.valueOf(suspended))); | ||
} | ||
} |
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