cloudstack_client 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 171bc985ca8b4d679cd61c18e2eb801f72b329d2
4
- data.tar.gz: 278d768791e1374a3811f1fa5f312b310e984ac7
3
+ metadata.gz: 27bacba7ee958ce9cc4740cd8809ba6e28aec1e2
4
+ data.tar.gz: a3fbb5d8d8ec97b925fc04fcd4ca5c2915d98849
5
5
  SHA512:
6
- metadata.gz: 7b94a587d9b4ff1a57bf6a8821312e720f702db85dfecea2fadd25041d9f9e79767bc48af63bd391213cf7e191e5597548662a63b3fbff0fa78a339ddb438450
7
- data.tar.gz: b3ba8d97417319f749390706fee563dc3d8719f6d3e4cbbfe25badbe60ada487f43e21314fa699afd111fda4d3bcccc1feecde5cace56dd04cfa35b85e6f1051
6
+ metadata.gz: f3823d7fd58ecafbc630006d778d987cd81d133ffad0c490156adff6b564541b0b95228085916565363fe110620bdcb8f8af7fe1fbee825dcaf4264453fe61df
7
+ data.tar.gz: 6de78d65687f146bfe727b9006c17e818f3a3ee26a6003c38d62c5fe93834db28edec4c059a4846996dd0ee956a11f25bba5b01fa86a11864bf451d8c05b6a6a
@@ -1,7 +1,6 @@
1
1
  module CloudstackClient
2
2
 
3
3
  module ResourceLimit
4
-
5
4
  ##
6
5
  # List resource limits.
7
6
 
@@ -16,7 +15,7 @@ module CloudstackClient
16
15
  puts "Error: Account #{args[:account]} not found."
17
16
  exit 1
18
17
  end
19
- params['domainid'] = account["domainid"]
18
+ params['domainid'] = account['domainid']
20
19
  params['account'] = args[:account]
21
20
  end
22
21
 
@@ -38,6 +37,89 @@ module CloudstackClient
38
37
  json['resourcelimit'] || []
39
38
  end
40
39
 
40
+ ##
41
+ # Recalculate and update resource count for an account or domain.
42
+
43
+ def update_resource_count(args = {})
44
+ params = {
45
+ 'command' => 'updateResourceCount',
46
+ }
47
+
48
+ if args[:account]
49
+ account = list_accounts({name: args[:account]}).first
50
+ unless account
51
+ puts "Error: Account #{args[:account]} not found."
52
+ exit 1
53
+ end
54
+ params['domainid'] = account['domainid']
55
+ params['account'] = args[:account]
56
+ end
57
+
58
+ if args[:project]
59
+ project = get_project(args[:project])
60
+ if !project
61
+ msg = "Project '#{args[:project]}' is invalid"
62
+ puts "Error: #{msg}"
63
+ exit 1
64
+ end
65
+ params['domainid'] = project['domainid']
66
+ params['projectid'] = project['id']
67
+ elsif args[:project_id]
68
+ params['projectid'] = args[:project_id]
69
+ end
70
+
71
+ params['resourcetype'] = args[:resource_type] if args[:resource_type]
72
+ params['domainid'] = args[:domain_id] if args[:domain_id]
73
+
74
+ json = send_request(params)
75
+ json['resourcecount'] || []
76
+ end
77
+
78
+ ##
79
+ # Updates resource limits for an account or domain.
80
+
81
+ def update_resource_limit(args = {})
82
+ params = {
83
+ 'command' => 'updateResourceLimit',
84
+ }
85
+
86
+ if args[:resource_type]
87
+ params['resourcetype'] = args[:resource_type]
88
+ else
89
+ puts "Error: Resource Type must be specified."
90
+ exit 1
91
+ end
92
+
93
+ if args[:account]
94
+ account = list_accounts({name: args[:account]}).first
95
+ unless account
96
+ puts "Error: Account #{args[:account]} not found."
97
+ exit 1
98
+ end
99
+ params['domainid'] = account['domainid']
100
+ params['account'] = args[:account]
101
+ end
102
+
103
+ if args[:project]
104
+ project = get_project(args[:project])
105
+ if !project
106
+ msg = "Project '#{args[:project]}' is invalid"
107
+ puts "Error: #{msg}"
108
+ exit 1
109
+ end
110
+ params['domainid'] = project['domainid']
111
+ params['projectid'] = project['id']
112
+ elsif args[:project_id]
113
+ params['projectid'] = args[:project_id]
114
+ end
115
+
116
+ params['domainid'] = args[:domain_id] if args[:domain_id]
117
+ params['max'] = args[:max] if args[:max]
118
+
119
+ json = send_request(params)
120
+ json['resourcelimit'] || []
121
+ end
122
+
41
123
  end
42
124
 
43
125
  end
@@ -1,3 +1,3 @@
1
1
  module CloudstackClient
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.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-02 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc