megam_api 1.11.1 → 1.50.1
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 +4 -4
- data/lib/megam/api/assembly.rb +11 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/assembly.rb +5 -0
- data/lib/megam/core/quotas.rb +26 -0
- data/test/test_quotas.rb +33 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1203e2c0e4a221a28d814f4fa87c28b5ffc204
|
4
|
+
data.tar.gz: f00e89bddb834be3afebd353643ad3bd2f57137f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac97397a7c26ff5d892bd7163fdbc1675422825ad919d8be765fed875fba7ed05e7b527963ee66a6231fc7b156d1546f39f98ec076fff3045fd23884b9c2540e
|
7
|
+
data.tar.gz: 8d30f457632a424a36b9bbbc8c730868c9afb19faab6e3a0824c6f92466058b2c30a752276c341d66c882fb91febcaf92330066233f6c43353833da812e1cd4a
|
data/lib/megam/api/assembly.rb
CHANGED
@@ -41,5 +41,16 @@ module Megam
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
+
def delete_assembly(delete_assembly)
|
45
|
+
@options = {path: "/admin/assembly/#{delete_assembly}",
|
46
|
+
:body => ''}.merge(@options)
|
47
|
+
|
48
|
+
request(
|
49
|
+
:expects => 200,
|
50
|
+
:method => :delete,
|
51
|
+
:body => @options[:body]
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
44
55
|
end
|
45
56
|
end
|
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/assembly.rb
CHANGED
@@ -209,6 +209,11 @@ module Megam
|
|
209
209
|
asm.megam_rest.list_assembly
|
210
210
|
end
|
211
211
|
|
212
|
+
def self.remove(params)
|
213
|
+
asm = self.new(params)
|
214
|
+
asm.megam_rest.delete_assembly(params['id'])
|
215
|
+
end
|
216
|
+
|
212
217
|
# Create the node via the REST API
|
213
218
|
def update
|
214
219
|
megam_rest.update_assembly(to_hash)
|
data/lib/megam/core/quotas.rb
CHANGED
@@ -7,6 +7,8 @@ module Megam
|
|
7
7
|
@cost = nil
|
8
8
|
@allowed = nil
|
9
9
|
@allocated_to = nil
|
10
|
+
@quota_type = nil
|
11
|
+
@status = nil
|
10
12
|
@inputs = []
|
11
13
|
@created_at = nil
|
12
14
|
@updated_at = nil
|
@@ -65,6 +67,22 @@ module Megam
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
70
|
+
def quota_type(arg = nil)
|
71
|
+
if !arg.nil?
|
72
|
+
@quota_type = arg
|
73
|
+
else
|
74
|
+
@quota_type
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def status(arg = nil)
|
79
|
+
if !arg.nil?
|
80
|
+
@status = arg
|
81
|
+
else
|
82
|
+
@status
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
68
86
|
def created_at(arg = nil)
|
69
87
|
if !arg.nil?
|
70
88
|
@created_at = arg
|
@@ -94,6 +112,8 @@ module Megam
|
|
94
112
|
index_hash['name'] = name
|
95
113
|
index_hash['allowed'] = allowed
|
96
114
|
index_hash['allocated_to'] = allocated_to
|
115
|
+
index_hash['quota_type'] = quota_type
|
116
|
+
index_hash['status'] = status
|
97
117
|
index_hash['inputs'] = inputs
|
98
118
|
index_hash['created_at'] = created_at
|
99
119
|
index_hash['updated_at'] = updated_at
|
@@ -114,6 +134,8 @@ module Megam
|
|
114
134
|
'allowed' => allowed,
|
115
135
|
'allocated_to' => allocated_to,
|
116
136
|
'inputs' => inputs,
|
137
|
+
'quota_type' => quota_type,
|
138
|
+
'status' => status,
|
117
139
|
'created_at' => created_at,
|
118
140
|
'updated_at' => updated_at
|
119
141
|
}
|
@@ -129,6 +151,8 @@ module Megam
|
|
129
151
|
quo.allowed(o['allowed']) if o.key?('allowed')
|
130
152
|
quo.allocated_to(o['allocated_to']) if o.key?('allocated_to') # this will be an array? can hash store array?
|
131
153
|
quo.inputs(o['inputs']) if o.key?('inputs')
|
154
|
+
quo.quota_type(o['quota_type']) if o.key?('quota_type')
|
155
|
+
quo.status(o['status']) if o.key?('status')
|
132
156
|
quo.created_at(o['created_at']) if o.key?('created_at')
|
133
157
|
quo.updated_at(o['updated_at']) if o.key?('updated_at')
|
134
158
|
quo
|
@@ -147,6 +171,8 @@ module Megam
|
|
147
171
|
@allowed = o['allowed'] if o.key?('allowed')
|
148
172
|
@allocated_to = o['allocated_to'] if o.key?('allocated_to')
|
149
173
|
@inputs = o['inputs'] if o.key?('inputs')
|
174
|
+
@quota_type = o['quota_type'] if o.key?('quota_type')
|
175
|
+
@status = o['status'] if o.key?('status')
|
150
176
|
@created_at = o['created_at'] if o.key?('created_at')
|
151
177
|
@updated_at = o['updated_at'] if o.key?('updated_at')
|
152
178
|
self
|
data/test/test_quotas.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
|
+
|
3
|
+
class TestApps < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def test_post_quotas
|
6
|
+
tmp_hash = {
|
7
|
+
"name"=>"cloud-s01",
|
8
|
+
"account_id"=>"test@megam.io",
|
9
|
+
"allowed"=>[
|
10
|
+
{
|
11
|
+
"key" => "ram",
|
12
|
+
"value" => "4GB"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"key" => "cpu",
|
16
|
+
"value" => "2cores"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"key" => "disk",
|
20
|
+
"value" => "10GB"
|
21
|
+
},
|
22
|
+
],
|
23
|
+
"allocated_to" => "",
|
24
|
+
"quota_type"=> "vm",
|
25
|
+
"status" => "active",
|
26
|
+
"inputs" => [],
|
27
|
+
|
28
|
+
}
|
29
|
+
|
30
|
+
response = megams.post_quotas(tmp_hash)
|
31
|
+
assert_equal(201, response.status)
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.50.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Ranjitha R, Vinodhini V, Rathish VBR, Rajesh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-02-
|
12
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -262,6 +262,7 @@ files:
|
|
262
262
|
- test/test_marketplaces.rb
|
263
263
|
- test/test_organizations.rb
|
264
264
|
- test/test_promos.rb
|
265
|
+
- test/test_quotas.rb
|
265
266
|
- test/test_reports.rb
|
266
267
|
- test/test_requests.rb
|
267
268
|
- test/test_sensors.rb
|