cloudstack-cli 0.3.11 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +3 -1
- data/bin/cs +1 -2
- data/cloudstack-cli.gemspec +1 -0
- data/lib/{cloudstack_cli.rb → cloudstack-cli.rb} +2 -0
- data/lib/cloudstack-cli/commands/router.rb +3 -1
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +24 -44
- data/lib/cloudstack-client/client.rb +0 -136
- data/lib/cloudstack-client/commands/account.rb +0 -22
- data/lib/cloudstack-client/commands/capacity.rb +0 -19
- data/lib/cloudstack-client/commands/cluster.rb +0 -19
- data/lib/cloudstack-client/commands/disk_offering.rb +0 -49
- data/lib/cloudstack-client/commands/domain.rb +0 -22
- data/lib/cloudstack-client/commands/host.rb +0 -28
- data/lib/cloudstack-client/commands/ip_address.rb +0 -82
- data/lib/cloudstack-client/commands/iso.rb +0 -64
- data/lib/cloudstack-client/commands/job.rb +0 -29
- data/lib/cloudstack-client/commands/load_balancer_rule.rb +0 -61
- data/lib/cloudstack-client/commands/network.rb +0 -128
- data/lib/cloudstack-client/commands/pod.rb +0 -19
- data/lib/cloudstack-client/commands/port_forwarding_rule.rb +0 -49
- data/lib/cloudstack-client/commands/project.rb +0 -32
- data/lib/cloudstack-client/commands/router.rb +0 -89
- data/lib/cloudstack-client/commands/server.rb +0 -311
- data/lib/cloudstack-client/commands/service_offering.rb +0 -98
- data/lib/cloudstack-client/commands/snapshot.rb +0 -40
- data/lib/cloudstack-client/commands/ssh_key_pair.rb +0 -106
- data/lib/cloudstack-client/commands/template.rb +0 -60
- data/lib/cloudstack-client/commands/user.rb +0 -32
- data/lib/cloudstack-client/commands/volume.rb +0 -20
- data/lib/cloudstack-client/commands/zone.rb +0 -57
- data/lib/cloudstack-client/version.rb +0 -3
- data/lib/cloudstack_client.rb +0 -2
@@ -1,40 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module Snapshot
|
4
|
-
|
5
|
-
##
|
6
|
-
# Lists snapshots.
|
7
|
-
|
8
|
-
def list_snapshots(args = {})
|
9
|
-
params = {
|
10
|
-
'command' => 'listSnapshots',
|
11
|
-
'isrecursive' => 'true'
|
12
|
-
}
|
13
|
-
params['name'] = args[:name] if args[:name]
|
14
|
-
|
15
|
-
if args[:project]
|
16
|
-
project = get_project(args[:project])
|
17
|
-
unless project
|
18
|
-
puts "Error: project #{args[:project]} not found."
|
19
|
-
exit 1
|
20
|
-
end
|
21
|
-
params['projectid'] = project['id']
|
22
|
-
end
|
23
|
-
if args[:account]
|
24
|
-
account = list_accounts({name: args[:account]}).first
|
25
|
-
unless account
|
26
|
-
puts "Error: Account #{args[:account]} not found."
|
27
|
-
exit 1
|
28
|
-
end
|
29
|
-
params['domainid'] = account["domainid"]
|
30
|
-
params['account'] = args[:account]
|
31
|
-
end
|
32
|
-
params['listall'] = args[:listall] if args[:listall]
|
33
|
-
|
34
|
-
json = send_request(params)
|
35
|
-
json['snapshot'] || []
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module SshKeyPair
|
4
|
-
|
5
|
-
##
|
6
|
-
# Lists ssh key pairs.
|
7
|
-
#
|
8
|
-
|
9
|
-
def list_ssh_key_pairs(args = {})
|
10
|
-
params = {
|
11
|
-
'command' => 'listSSHKeyPairs',
|
12
|
-
'isrecursive' => true
|
13
|
-
}
|
14
|
-
params['listall'] = true if args[:listall]
|
15
|
-
params['name'] = args[:name] if args[:name]
|
16
|
-
|
17
|
-
if args[:project]
|
18
|
-
project = get_project(args[:project])
|
19
|
-
unless project
|
20
|
-
puts "Error: project #{args[:project]} not found."
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
params['projectid'] = project['id']
|
24
|
-
end
|
25
|
-
|
26
|
-
if args[:account]
|
27
|
-
account = list_accounts({name: args[:account]}).first
|
28
|
-
unless account
|
29
|
-
puts "Error: Account #{args[:account]} not found."
|
30
|
-
exit 1
|
31
|
-
end
|
32
|
-
params['domainid'] = account["domainid"]
|
33
|
-
params['account'] = args[:account]
|
34
|
-
end
|
35
|
-
|
36
|
-
json = send_request(params)
|
37
|
-
json['sshkeypair'] || []
|
38
|
-
end
|
39
|
-
|
40
|
-
##
|
41
|
-
# Create ssh key pairs.
|
42
|
-
#
|
43
|
-
|
44
|
-
def create_ssh_key_pair(name, args = {})
|
45
|
-
params = {
|
46
|
-
'command' => 'createSSHKeyPair',
|
47
|
-
'name' => name
|
48
|
-
}
|
49
|
-
if args[:project]
|
50
|
-
project = get_project(args[:project])
|
51
|
-
unless project
|
52
|
-
puts "Error: project #{args[:project]} not found."
|
53
|
-
exit 1
|
54
|
-
end
|
55
|
-
params['projectid'] = project['id']
|
56
|
-
end
|
57
|
-
|
58
|
-
if args[:account]
|
59
|
-
account = list_accounts({name: args[:account]}).first
|
60
|
-
unless account
|
61
|
-
puts "Error: Account #{args[:account]} not found."
|
62
|
-
exit 1
|
63
|
-
end
|
64
|
-
params['domainid'] = account["domainid"]
|
65
|
-
params['account'] = args[:account]
|
66
|
-
end
|
67
|
-
params['publickey'] = args[:public_key] if args[:public_key]
|
68
|
-
|
69
|
-
json = send_request(params)['keypair']
|
70
|
-
end
|
71
|
-
|
72
|
-
##
|
73
|
-
# Delete ssh key pairs.
|
74
|
-
#
|
75
|
-
|
76
|
-
def delete_ssh_key_pair(name, args = {})
|
77
|
-
params = {
|
78
|
-
'command' => 'deleteSSHKeyPair',
|
79
|
-
'name' => name
|
80
|
-
}
|
81
|
-
|
82
|
-
if args[:project]
|
83
|
-
project = get_project(args[:project])
|
84
|
-
unless project
|
85
|
-
puts "Error: project #{args[:project]} not found."
|
86
|
-
exit 1
|
87
|
-
end
|
88
|
-
params['projectid'] = project['id']
|
89
|
-
end
|
90
|
-
|
91
|
-
if args[:account]
|
92
|
-
account = list_accounts({name: args[:account]}).first
|
93
|
-
unless account
|
94
|
-
puts "Error: Account #{args[:account]} not found."
|
95
|
-
exit 1
|
96
|
-
end
|
97
|
-
params['domainid'] = account["domainid"]
|
98
|
-
params['account'] = args[:account]
|
99
|
-
end
|
100
|
-
|
101
|
-
json = send_request(params)
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module Template
|
4
|
-
|
5
|
-
##
|
6
|
-
# Finds the template with the specified name.
|
7
|
-
|
8
|
-
def get_template(name)
|
9
|
-
|
10
|
-
# TODO: use name parameter
|
11
|
-
# listTemplates in CloudStack 2.2 doesn't seem to work
|
12
|
-
# when the name parameter is specified. When this is fixed,
|
13
|
-
# the name parameter should be added to the request.
|
14
|
-
params = {
|
15
|
-
'command' => 'listTemplates',
|
16
|
-
'templateFilter' => 'executable'
|
17
|
-
}
|
18
|
-
json = send_request(params)
|
19
|
-
|
20
|
-
templates = json['template']
|
21
|
-
if !templates then
|
22
|
-
return nil
|
23
|
-
end
|
24
|
-
|
25
|
-
templates.each { |t|
|
26
|
-
if t['name'] == name then
|
27
|
-
return t
|
28
|
-
end
|
29
|
-
}
|
30
|
-
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Lists all templates that match the specified filter.
|
36
|
-
#
|
37
|
-
# Allowable filter values are:
|
38
|
-
#
|
39
|
-
# * featured - templates that are featured and are public
|
40
|
-
# * self - templates that have been registered/created by the owner
|
41
|
-
# * self-executable - templates that have been registered/created by the owner that can be used to deploy a new VM
|
42
|
-
# * executable - all templates that can be used to deploy a new VM
|
43
|
-
# * community - templates that are public
|
44
|
-
|
45
|
-
def list_templates(args = {})
|
46
|
-
filter = args[:filter] || 'featured'
|
47
|
-
params = {
|
48
|
-
'command' => 'listTemplates',
|
49
|
-
'templateFilter' => filter
|
50
|
-
}
|
51
|
-
params['projectid'] = args[:project_id] if args[:project_id]
|
52
|
-
params['zoneid'] = args[:zone_id] if args[:zone_id]
|
53
|
-
|
54
|
-
json = send_request(params)
|
55
|
-
json['template'] || []
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module User
|
4
|
-
|
5
|
-
##
|
6
|
-
# Lists users.
|
7
|
-
#
|
8
|
-
|
9
|
-
def list_users(args = {})
|
10
|
-
params = {
|
11
|
-
'command' => 'listUsers',
|
12
|
-
'isrecursive' => true
|
13
|
-
}
|
14
|
-
params['listall'] = true if args[:listall]
|
15
|
-
|
16
|
-
if args[:account]
|
17
|
-
account = list_accounts({name: args[:account]}).first
|
18
|
-
unless account
|
19
|
-
puts "Error: Account #{args[:account]} not found."
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
params['domainid'] = account["domainid"]
|
23
|
-
params['account'] = args[:account]
|
24
|
-
end
|
25
|
-
|
26
|
-
json = send_request(params)
|
27
|
-
json['user'] || []
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module Volume
|
4
|
-
|
5
|
-
##
|
6
|
-
# Lists all volumes.
|
7
|
-
|
8
|
-
def list_volumes(project_id = nil)
|
9
|
-
params = {
|
10
|
-
'command' => 'listVolumes',
|
11
|
-
'listall' => true,
|
12
|
-
}
|
13
|
-
params['projectid'] = project_id if project_id
|
14
|
-
json = send_request(params)
|
15
|
-
json['volume'] || []
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module CloudstackClient
|
2
|
-
|
3
|
-
module Zone
|
4
|
-
|
5
|
-
##
|
6
|
-
# Finds the zone with the specified name.
|
7
|
-
|
8
|
-
def get_zone(name)
|
9
|
-
params = {
|
10
|
-
'command' => 'listZones',
|
11
|
-
'available' => 'true'
|
12
|
-
}
|
13
|
-
json = send_request(params)
|
14
|
-
|
15
|
-
networks = json['zone']
|
16
|
-
return nil unless networks
|
17
|
-
|
18
|
-
networks.each { |z|
|
19
|
-
if z['name'] == name then
|
20
|
-
return z
|
21
|
-
end
|
22
|
-
}
|
23
|
-
|
24
|
-
nil
|
25
|
-
end
|
26
|
-
|
27
|
-
##
|
28
|
-
# Finds the default zone for your account.
|
29
|
-
|
30
|
-
def get_default_zone
|
31
|
-
params = {
|
32
|
-
'command' => 'listZones',
|
33
|
-
'available' => 'true'
|
34
|
-
}
|
35
|
-
json = send_request(params)
|
36
|
-
|
37
|
-
zones = json['zone']
|
38
|
-
return nil unless zones
|
39
|
-
|
40
|
-
zones.first
|
41
|
-
end
|
42
|
-
|
43
|
-
##
|
44
|
-
# Lists all available zones.
|
45
|
-
|
46
|
-
def list_zones
|
47
|
-
params = {
|
48
|
-
'command' => 'listZones',
|
49
|
-
'available' => 'true'
|
50
|
-
}
|
51
|
-
json = send_request(params)
|
52
|
-
json['zone'] || []
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
data/lib/cloudstack_client.rb
DELETED