-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathREADME.rst
executable file
·195 lines (150 loc) · 6.19 KB
/
README.rst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
vucli 0.0.3 (Vultr cloud server CLI tool)
======================
vucli is a CLI tool to manage Vultr VPS ,it invoked Vultr public REST service , see details https://www.vultr.com/api/
all functions are in single py file , you can also directly copy the code and run it .
.. contents::
Changes
-------
**0.0.1**: Initial drop
**0.0.2**: Add start script & snapshot management , create server with startscript or snapshot ,showing current_charge in serverlist
**0.0.3** Added Windows support - install pyreadline when on Windows , Thanks to PieterScheffers
Requirements
-------------
1. Python 2.6 +
2. python requests and argparse package if you want to directly run
Direct RUN
-------------
git clone https://github.com/yikaus/vultrcli
cd vultrcli/vucli
chmod +x vucli.py
./vucli.py
Installation (all dependency will be installed)
------------
$sudo pip install vucli
$vucli
To Use
------------
Interactive mode
------------
vucli
OR
./vucli.py
##########################
# Vultr Cloud CLI #
# #
# v1 #
# #
##########################
Type help to load help page .
vultr_cli>>help
Interactive Usage : vucli
Usage: vucli <command> [options]
Commands:
planlist list all VPS plans
regionlist list all available regions
oslist list all operating system images
snapshotlist list all snapshots
newsnapshot create a snapshot with subid
snapshotdestroy delete a snapshot
serverlist list all servers
reboot restart server by server id
halt hard stop server by server id
start start server by server id
destroy destroy server by server id
reinstall reinstall server by server id
create create new server
scriptlist list all start script
scriptdestroy delete particular start script
newscript create new server
create create start script
changekey reset API key (only worked in interactive mode)
quit quit interactive mode (only worked in interactive mode)
vultr_cli>>
vultr_cli>>regionlist
country state DCID name continent
FR 24 France Europe
JP 25 Tokyo Asia
AU 19 Australia Australia
US NJ 1 New Jersey North America
US TX 3 Dallas North America
...
...
vultr_cli>>oslist
OSID arch name family
151 i386 Debian 6 i386 (squeeze) debian
147 i386 CentOS 6 i386 centos
138 x64 Debian 6 x64 (squeeze) debian
140 x64 FreeBSD 10 x64 freebsd
...
...
vultr_cli>>serverlist
please enter your user key :xxxxxxxxxxxxxxxxx
SUBID os ram vcpu disk ip location DCID VPSPLANID Cost status
1371543 Ubuntu 12.04 x64 768 MB 1 Virtual 15 GB xxx.xx.xx.xxx Los Angeles 5 29 5.00 running
vultr_cli>>halt 1371543
Operation Successful!
vultr_cli>>serverlist
SUBID os ram vcpu disk ip location DCID VPSPLANID Cost status
1371543 Ubuntu 12.04 x64 768 MB 1 Virtual 15 GB xxx.xx.xx.xxx Los Angeles 5 29 5.00 stopped
vultr_cli>>start 1371543
Operation Successful!
vultr_cli>>serverlist
SUBID os ram vcpu disk ip location DCID VPSPLANID Cost status
1371543 Ubuntu 12.04 x64 768 MB 1 Virtual 15 GB xxx.xx.xx.xxx Los Angeles 5 29 5.00 running
Command mode
------------
./vucli.py -h
Interactive Usage : vucli
Usage: vucli <command> [options]
Commands:
planlist list all VPS plans
regionlist list all available regions
oslist list all operating system images
snapshotlist list all snapshots
newsnapshot create a snapshot with subid
snapshotdestroy delete a snapshot
serverlist list all servers
reboot restart server by server id
halt hard stop server by server id
start start server by server id
destroy destroy server by server id
reinstall reinstall server by server id
create create new server
scriptlist list all start script
scriptdestroy delete particular start script
newscript create new server
create create start script
changekey reset API key (only worked in interactive mode)
quit quit interactive mode (only worked in interactive mode)
Options:
-k <APIKEY> provide API key
-id <SUBID> provide server id
-d <DCID> provide datacenter DCID
-p <PLANID> provide PLANID
-os <OSID> provide OS image ID
-f <SCRIPTPATH> provide script file path
-st <SCRIPTID> provide script id
-sn <SCRIPTNAME> provide script name
-ss <SUBID> provide server id to create a snapshot
-sd <SNAPDESC> provide snapshot description
Examples:
create instance with OSID 128 at DCID 5 and planid 29 ,script id 245
vucli create -k <yourkey> -d 5 -p 29 -os 128 -st 245
create instance with SNAPSHOTID 53bdd6e0d6414 at DCID 5 and planid 29
vucli create -k <yourkey> -d 5 -p 29 -ss 53bdd6e0d6414
provide OS image ID
Usage example:
./vucli.py oslist
OSID arch name family
151 i386 Debian 6 i386 (squeeze) debian
147 i386 CentOS 6 i386 centos
138 x64 Debian 6 x64 (squeeze) debian
.....
./vucli.py create -k <yourkey> -d 5 -os 128 -p 29
Server Created with SUBID
{"SUBID":"1371543"}
./vucli.py serverlist -k <yourkey>
SUBID os ram vcpu disk ip location DCID VPSPLANID Cost status
1371543 Ubuntu 12.04 x64 768 MB 1 Virtual 15 GB xxx.xx.xx.xxx Los Angeles 5 29 5.00 running
./vucli.py reboot -k <yourkey> -id 1371543
Operation Successful!