cloudstack-cli 0.12.3 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/cloudstack-cli.gemspec +1 -1
- data/lib/cloudstack-cli/commands/account.rb +10 -5
- data/lib/cloudstack-cli/commands/resource_limit.rb +59 -0
- data/lib/cloudstack-cli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59af9b18e579f5acce2144abcf2aff9db1affb2d
|
4
|
+
data.tar.gz: 49e7e5d576b28cd87ade5522a4541de96b662395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 420b6b48551919f82f1614e1f223012e8091cc80f01341fe79ad578457663c9e486acd594e5ba5d131a408e7bd45686e86600eabb480762feacce45fd7deeb0c
|
7
|
+
data.tar.gz: 04932a176b192b6f1f070abacfad2a86b91a1b6f560a898197f2d266b9b3d8e601addb0c73b9b9a049992dddc4a78bba5b42a30eb35aea7e5341782e3d02c6fc
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git@github.com:niwo/cloudstack_client.git
|
3
|
-
revision:
|
3
|
+
revision: 9bffcd5b7ed587973b09ced13fae52030b77ff72
|
4
4
|
branch: master
|
5
5
|
specs:
|
6
|
-
cloudstack_client (0.
|
6
|
+
cloudstack_client (0.9.0)
|
7
7
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
cloudstack-cli (0.
|
12
|
-
cloudstack_client (~> 0.
|
11
|
+
cloudstack-cli (0.13.0)
|
12
|
+
cloudstack_client (~> 0.9.0)
|
13
13
|
thor (~> 0.19.1)
|
14
14
|
|
15
15
|
GEM
|
data/cloudstack-cli.gemspec
CHANGED
@@ -22,15 +22,20 @@ class Account < CloudstackCli::Base
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
desc 'list
|
26
|
-
def list
|
27
|
-
accounts = client.list_accounts
|
25
|
+
desc 'list', 'list accounts'
|
26
|
+
def list
|
27
|
+
accounts = client.list_accounts
|
28
28
|
if accounts.size < 1
|
29
29
|
puts "No accounts found."
|
30
30
|
else
|
31
|
-
table = [
|
31
|
+
table = [%w(Name Type Domain State)]
|
32
32
|
accounts.each do |account|
|
33
|
-
table << [
|
33
|
+
table << [
|
34
|
+
account['name'],
|
35
|
+
TYPES[account['accounttype']],
|
36
|
+
account['domain'],
|
37
|
+
account['state']
|
38
|
+
]
|
34
39
|
end
|
35
40
|
print_table table
|
36
41
|
say "Total number of accounts: #{accounts.size}"
|
@@ -36,6 +36,55 @@ class ResourceLimit < CloudstackCli::Base
|
|
36
36
|
print_table table
|
37
37
|
end
|
38
38
|
|
39
|
+
desc "refresh", "refresh resource counts"
|
40
|
+
option :domain, desc: "refresh resource for a specified domain"
|
41
|
+
option :account, desc: "refresh resource for a specified account"
|
42
|
+
option :project, desc: "refresh resource for a specified project"
|
43
|
+
option :type, desc: "specify type, see types for a list of types"
|
44
|
+
def refresh
|
45
|
+
set_domain_id if options[:domain]
|
46
|
+
options[:resource_type] = options[:type] if options[:type]
|
47
|
+
|
48
|
+
unless ['domain_id', 'account', 'project'].any? {|k| options.key?(k)}
|
49
|
+
say "Error: Please provide domain, account or project.", :red
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
|
53
|
+
if resource_count = client.update_resource_count(options)
|
54
|
+
say "Sucessfully refreshed resource limits.", :green
|
55
|
+
else
|
56
|
+
say "Error refreshing resource limits.", :red
|
57
|
+
exit 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
desc "update", "update resource counts"
|
62
|
+
option :domain, desc: "update resource for a specified domain"
|
63
|
+
option :account, desc: "update resource for a specified account"
|
64
|
+
option :project, desc: "update resource for a specified project"
|
65
|
+
option :type,
|
66
|
+
desc: "specify type, see types for a list of types",
|
67
|
+
required: true
|
68
|
+
option :max,
|
69
|
+
desc: "Maximum resource limit.",
|
70
|
+
required: true
|
71
|
+
def update
|
72
|
+
set_domain_id if options[:domain]
|
73
|
+
options[:resource_type] = options[:type]
|
74
|
+
|
75
|
+
unless ['domain_id', 'account', 'project'].any? {|k| options.key?(k)}
|
76
|
+
say "Error: Please provide domain, account or project.", :red
|
77
|
+
exit 1
|
78
|
+
end
|
79
|
+
|
80
|
+
if resource_count = client.update_resource_limit(options)
|
81
|
+
say "Sucessfully updated resource limits.", :green
|
82
|
+
else
|
83
|
+
say "Error updating resource limits.", :red
|
84
|
+
exit 1
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
39
88
|
desc "types", "show resource types"
|
40
89
|
def types
|
41
90
|
table = [['type', 'name']]
|
@@ -48,6 +97,7 @@ class ResourceLimit < CloudstackCli::Base
|
|
48
97
|
no_commands do
|
49
98
|
|
50
99
|
def resource_to_s(limit, entity)
|
100
|
+
return '-1 (unlimited)' if limit['max'] == -1
|
51
101
|
value = RESOURCE_TYPES[limit['resourcetype']][:divider] ?
|
52
102
|
(limit[entity] / RESOURCE_TYPES[limit['resourcetype']][:divider]).round(1) :
|
53
103
|
limit[entity]
|
@@ -56,6 +106,15 @@ class ResourceLimit < CloudstackCli::Base
|
|
56
106
|
value.to_s
|
57
107
|
end
|
58
108
|
|
109
|
+
def set_domain_id
|
110
|
+
domains = client.list_domains(options[:domain])
|
111
|
+
if domains.size < 1
|
112
|
+
say "Domain #{options[:domain]} not found.", :red
|
113
|
+
else
|
114
|
+
options[:domain_id] = domains.first['id']
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
59
118
|
end
|
60
119
|
|
61
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudstack-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nik Wolfgramm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.9.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.9.0
|
69
69
|
description: cloudstack-cli is a CloudStack API command line client written in Ruby.
|
70
70
|
email:
|
71
71
|
- nik.wolfgramm@gmail.com
|