-
Notifications
You must be signed in to change notification settings - Fork 12
Adding an API call to the Java CLI
Ryan Moore edited this page Jun 28, 2016
·
3 revisions
To add a command to the CLI:
- Create a Result by implementing Result in com.spectralogic.ds3cli.models or finding one that will work. DeleteResult is appropriate for calls that return no content. If one is very similar, you can add a constructor that takes the Response. (e.g., DataPoliciesResult can be built from either a DataPolicy or DataPolicyList).
- Create the Command by extending CliCommand com.spectralogic.ds3cli.command. The init() method collects and verifies arguments and the call() method processes the API call.
- Add the command name to com.spectralogic.ds3cli.CommmandValue. This will be the argument provided for -c in the CLI.
- Add (or co-opt) a CLI view in com.spectralogic.ds3cli.views.cli.
- Add (or co-opt) a JSON view in com.spectralogic.ds3cli.views.json.
- Add the new command to Dcom.spectralogic.ds3cli.Ds3Cli in three places: Add the command and cli view to the map returned by getCliViews(); Add the command and JSON view to the map returned by getJsonViews(); and add the command to the switch statement from hell in getCommandExecutor();
- Add the individual command help string to -- Add (or co-opt) a CLI view in ds3_java_cli/src/resources/com/spectralogic/ds3clihelp.properties.
- Add Unit Tests to Ds3Cli_Test for success and failure cases.