Created
August 7, 2020 02:29
-
-
Save jhanley-com/03ba5dd65a0cb9611173dd090c6a80b2 to your computer and use it in GitHub Desktop.
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
@set APIKEY=your_cloud_api_key | |
@set URI=https://clients.hostwinds.com/cloud/api.php | |
@set FILENAME=instances.json | |
@if exist %FILENAME% del %FILENAME% | |
@curl %URI% ^ | |
-sS ^ | |
-X POST ^ | |
-d "action=get_instances&API=%APIKEY%" > %FILENAME% | |
@if %errorlevel% equ 0 ( | |
@REM - Print instance names | |
@echo Instances | |
@echo IP OS ServerName Hostname | |
@echo ---------------------------------------------------------------------- | |
@cat %FILENAME% | jq -r ".success | .[] | [.main_ip, .image.name, .srvrname, .hostname] | @tsv" 2>error.log | |
@if %errorlevel% equ 0 ( | |
@echo. | |
@echo ------------------------------ | |
@echo Success | |
) else ( | |
@REM @echo Exit Code is %errorlevel% | |
@echo Failed | |
@cat %FILENAME% | jq | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment