hyperonecom / h1-cli

Command-line interface for HyperOne platform
MIT License
6 stars 4 forks source link

Powershell wrapper for CLI #73

Open gregorybrzeski opened 6 years ago

gregorybrzeski commented 6 years ago

Powershell also known as PS is a default MS Windows shell, which is used by MS Windows administrators for scripting and management.

CLI can be used on MS Windows however:

Some preliminary ideas for conversion of CLI command syntax to PS:

Lifecycle

CLI command PS Command
h1 vm create .... new-h1vm ...
h1 vm show --vm ... get-h1vm --vm ....
h1 vm list get-h1vm
h1 vm delete --vm .... remove-h1vm --vm ...

Actions

CLI command PS Command
h1 vm start --vm .... start-h1vm --vm ...
h1 vm stop --vm .... stop-h1vm --vm ...
h1 vm turnoff --vm .... stop-h1vm --vm ... --turnoff
h1 vm rename --vm ... rename-h1vm --vm ...
h1 vm restart --vm ... restart-h1vm --vm ...
h1 vm passwordreset --vm ... reset-h1vmPassword --vm ...

Resource Management

CLI command PS Command
h1 vm disk list --vm ... get-vmh1Disk --vm ...
h1 vm disk attach --vm ... --disk ... add-vmh1Disk --vm ... --disk ...
h1 vm disk dettach --vm ... --disk ... remove-vmh1Disk --vm ... --disk ...

Some basic information how to build Powershell Modules: https://kevinmarquette.github.io/2017-05-27-Powershell-module-building-basics/

PrzemyslawKlys commented 6 years ago

I can try to help with this. I would need some test account / access so I can see how things work wiith current command line.

My idea in my current knowledge of product would be to use binary h1 (I assume this works by installing node.js as shown here - https://blog.teamtreehouse.com/install-node-js-npm-windows and you would run it node.exe h1.js - sorry I've not played with NPM before. If it's run differently on Windows just give me some basic use case.

I would try to make it compliant with Window starting with PowerShell 5.1. I can try to add 6.0+ support as long as it's behavior is the same on Linux/Mac (returning data in same way). Otherwise it would be additional workload.

ad-m commented 6 years ago

@PrzemyslawKlys , the use of CLI does not require download and installation of NodeJS. We bundle our version of NodeJS during release. For development NodeJS environment is required.

See installation instruction at https://github.com/hyperonecom/h1-cli#instalacja . It require only download binary & run.

For account please create account at https://panel.hyperone.com/signup

PrzemyslawKlys commented 6 years ago

@ad-m Right, where do I get CLI binary for Windows then ? If I want to run this on Windows (which is not in the installation instructions)? Or do you mean it is required to install NodeJS (your message says it's not required - so a bit confusing).

ad-m commented 6 years ago

@PrzemyslawKlys , the binary is available at https://github.com/hyperonecom/h1-cli/releases/tag/v1.1.0 . Using CLI does not require installl NodeJS, just download our binary. Our binary includes our NodeJS in itself.