megam_api 1.52.1 → 1.52.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/megam/api/flavors.rb +2 -2
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/flavors.rb +52 -34
- data/lib/megam/core/flavors_collection.rb +13 -14
- data/lib/megam/mixins/common_deployable.rb +4 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b2ea5c73edfa904feb67a7421d440a3a9861ebf
|
4
|
+
data.tar.gz: 631d53cde48a7e687c419b806760dfda2fb8650b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6da36555070aaff7e7a96ea0865f1dbb31b0df6702a60530b17cad6b8cd240f8910fbbc73eb8b5ee7b2b7bb9b64afb5375efebdb4afcbd5316a3a5b51c94df3c
|
7
|
+
data.tar.gz: 25c872e5cf053f6c673e99ad1ca725c55b6b4bbf2e9ec5a8e8174a9cdba338a11870ea5452424cfea3ffaee460b729f06027d01d0ca7da9c147195c0867927be
|
data/lib/megam/api/flavors.rb
CHANGED
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/flavors.rb
CHANGED
@@ -11,6 +11,7 @@ module Megam
|
|
11
11
|
@regions = []
|
12
12
|
@price = []
|
13
13
|
@properties = []
|
14
|
+
@category = []
|
14
15
|
@status = nil
|
15
16
|
@created_at = nil
|
16
17
|
@updated_at = nil
|
@@ -18,12 +19,12 @@ module Megam
|
|
18
19
|
super(o)
|
19
20
|
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def flavors
|
23
|
+
self
|
24
|
+
end
|
24
25
|
|
25
26
|
def id(arg = nil)
|
26
|
-
|
27
|
+
if arg != nil
|
27
28
|
@id = arg
|
28
29
|
else
|
29
30
|
@id
|
@@ -31,23 +32,23 @@ module Megam
|
|
31
32
|
end
|
32
33
|
|
33
34
|
def org_id(arg = nil)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
if arg != nil
|
36
|
+
@org_id = arg
|
37
|
+
else
|
38
|
+
@org_id
|
39
|
+
end
|
39
40
|
end
|
40
41
|
|
41
42
|
def account_id(arg=nil)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
if arg != nil
|
44
|
+
@account_id = arg
|
45
|
+
else
|
46
|
+
@account_id
|
47
|
+
end
|
47
48
|
end
|
48
49
|
|
49
50
|
def name(arg = nil)
|
50
|
-
|
51
|
+
if arg != nil
|
51
52
|
@name = arg
|
52
53
|
else
|
53
54
|
@name
|
@@ -56,7 +57,7 @@ module Megam
|
|
56
57
|
|
57
58
|
|
58
59
|
def cpu(arg = nil)
|
59
|
-
|
60
|
+
if arg != nil
|
60
61
|
@cpu = arg
|
61
62
|
else
|
62
63
|
@cpu
|
@@ -96,13 +97,21 @@ module Megam
|
|
96
97
|
end
|
97
98
|
|
98
99
|
def properties(arg = [])
|
99
|
-
|
100
|
+
if arg != []
|
100
101
|
@properties = arg
|
101
102
|
else
|
102
103
|
@properties
|
103
104
|
end
|
104
105
|
end
|
105
106
|
|
107
|
+
def category(arg = [])
|
108
|
+
if arg != []
|
109
|
+
@category = arg
|
110
|
+
else
|
111
|
+
@category
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
106
115
|
def status(arg=nil)
|
107
116
|
if arg != nil
|
108
117
|
@status = arg
|
@@ -119,7 +128,7 @@ module Megam
|
|
119
128
|
end
|
120
129
|
end
|
121
130
|
|
122
|
-
|
131
|
+
def updated_at(arg=nil)
|
123
132
|
if arg != nil
|
124
133
|
@updated_at = arg
|
125
134
|
else
|
@@ -131,6 +140,7 @@ module Megam
|
|
131
140
|
crocked = true if some_msg.key?(:msg_type) && some_msg[:msg_type] == 'error'
|
132
141
|
end
|
133
142
|
|
143
|
+
|
134
144
|
def some_msg(arg=nil)
|
135
145
|
if arg != nil
|
136
146
|
@some_msg = arg
|
@@ -139,6 +149,7 @@ module Megam
|
|
139
149
|
end
|
140
150
|
end
|
141
151
|
|
152
|
+
|
142
153
|
# Transform the ruby obj -> to a Hash
|
143
154
|
def to_hash
|
144
155
|
index_hash = Hash.new
|
@@ -153,6 +164,7 @@ module Megam
|
|
153
164
|
index_hash['regions'] = regions
|
154
165
|
index_hash['price'] = price
|
155
166
|
index_hash['properties'] = properties
|
167
|
+
index_hash['category'] = category
|
156
168
|
index_hash['status'] = status
|
157
169
|
index_hash['created_at'] = created_at
|
158
170
|
index_hash['updated_at'] = updated_at
|
@@ -178,6 +190,7 @@ module Megam
|
|
178
190
|
'regions' => regions,
|
179
191
|
'price' => price,
|
180
192
|
'properties' => properties,
|
193
|
+
'category' => category,
|
181
194
|
'status' => status,
|
182
195
|
'created_at' => created_at,
|
183
196
|
'updated_at' => updated_at
|
@@ -198,6 +211,7 @@ module Megam
|
|
198
211
|
fav.regions(o['regions']) if o.key?('regions')
|
199
212
|
fav.price(o['price']) if o.key?('price')
|
200
213
|
fav.properties(o['properties']) if o.key?('properties')
|
214
|
+
fav.category(o['category']) if o.key?('category')
|
201
215
|
fav.status(o['status']) if o.key?('status')
|
202
216
|
fav.created_at(o['created_at']) if o.key?('created_at')
|
203
217
|
fav.updated_at(o['updated_at']) if o.key?('updated_at')
|
@@ -209,9 +223,9 @@ module Megam
|
|
209
223
|
end
|
210
224
|
|
211
225
|
def self.from_hash(o)
|
212
|
-
|
213
|
-
|
214
|
-
|
226
|
+
sps = self.new(o)
|
227
|
+
sps.from_hash(o)
|
228
|
+
sps
|
215
229
|
end
|
216
230
|
|
217
231
|
def from_hash(o)
|
@@ -225,23 +239,14 @@ module Megam
|
|
225
239
|
@regions = o[:regions] if o.has_key?(:regions)
|
226
240
|
@price = o[:price] if o.has_key?(:price)
|
227
241
|
@properties = o[:properties] if o.has_key?(:properties)
|
242
|
+
@category = o[:category] if o.has_key?(:category)
|
228
243
|
@status = o[:status] if o.has_key?(:status)
|
229
244
|
@created_at = o[:created_at] if o.has_key?(:created_at)
|
230
245
|
@updated_at = o[:updated_at] if o.has_key?(:updated_at)
|
231
246
|
self
|
232
247
|
end
|
233
248
|
|
234
|
-
|
235
|
-
def self.show(params)
|
236
|
-
fav = self.new(params)
|
237
|
-
fav.megam_rest.get_one_flavor(params[:name])
|
238
|
-
end
|
239
|
-
|
240
|
-
def self.list(params)
|
241
|
-
fav = self.new(params)
|
242
|
-
fav.megam_rest.get_flavors
|
243
|
-
end
|
244
|
-
|
249
|
+
# Create the node via the REST API
|
245
250
|
def self.create(params)
|
246
251
|
fav = from_hash(params)
|
247
252
|
fav.create
|
@@ -251,8 +256,16 @@ module Megam
|
|
251
256
|
megam_rest.post_flavors(to_hash)
|
252
257
|
end
|
253
258
|
|
254
|
-
|
255
|
-
|
259
|
+
|
260
|
+
|
261
|
+
def self.list(params)
|
262
|
+
fav = self.new(params)
|
263
|
+
fav.megam_rest.get_flavors
|
264
|
+
end
|
265
|
+
|
266
|
+
def self.show(params)
|
267
|
+
fav = self.new(params)
|
268
|
+
fav.megam_rest.get_one_flavor(params[:id])
|
256
269
|
end
|
257
270
|
|
258
271
|
def self.update(params)
|
@@ -260,6 +273,10 @@ module Megam
|
|
260
273
|
fav.update
|
261
274
|
end
|
262
275
|
|
276
|
+
def update
|
277
|
+
megam_rest.update_flavors(to_hash)
|
278
|
+
end
|
279
|
+
|
263
280
|
def self.remove(o)
|
264
281
|
fav = from_hash(o)
|
265
282
|
fav.remove
|
@@ -272,5 +289,6 @@ module Megam
|
|
272
289
|
def to_s
|
273
290
|
Megam::Stuff.styled_hash(to_hash)
|
274
291
|
end
|
292
|
+
|
275
293
|
end
|
276
294
|
end
|
@@ -3,7 +3,6 @@ module Megam
|
|
3
3
|
include Enumerable
|
4
4
|
|
5
5
|
attr_reader :iterator
|
6
|
-
|
7
6
|
def initialize
|
8
7
|
@flavors = Array.new
|
9
8
|
@flavors_by_name = Hash.new
|
@@ -21,14 +20,14 @@ module Megam
|
|
21
20
|
def []=(index, arg)
|
22
21
|
is_megam_flavors(arg)
|
23
22
|
@flavors[index] = arg
|
24
|
-
@flavors_by_name[arg.
|
23
|
+
@flavors_by_name[arg.account_id] = index
|
25
24
|
end
|
26
25
|
|
27
26
|
def <<(*args)
|
28
27
|
args.flatten.each do |a|
|
29
28
|
is_megam_flavors(a)
|
30
29
|
@flavors << a
|
31
|
-
@flavors_by_name[a.
|
30
|
+
@flavors_by_name[a.account_id] = @flavors.length - 1
|
32
31
|
end
|
33
32
|
self
|
34
33
|
end
|
@@ -39,19 +38,19 @@ module Megam
|
|
39
38
|
def insert(flavors)
|
40
39
|
is_megam_flavors(flavors)
|
41
40
|
if @insert_after_idx
|
42
|
-
# in the middle of executing a run, so any
|
41
|
+
# in the middle of executing a run, so any nodes inserted now should
|
43
42
|
# be placed after the most recent addition done by the currently executing
|
44
|
-
#
|
43
|
+
# node
|
45
44
|
@flavors.insert(@insert_after_idx + 1, flavors)
|
46
|
-
# update name -> location mappings and register new
|
45
|
+
# update name -> location mappings and register new node
|
47
46
|
@flavors_by_name.each_key do |key|
|
48
|
-
@flavors_by_name[key] += 1 if@flavors_by_name[key] > @insert_after_idx
|
47
|
+
@flavors_by_name[key] += 1 if @flavors_by_name[key] > @insert_after_idx
|
49
48
|
end
|
50
|
-
@flavors_by_name[flavors.
|
49
|
+
@flavors_by_name[flavors.account_id] = @insert_after_idx + 1
|
51
50
|
@insert_after_idx += 1
|
52
51
|
else
|
53
52
|
@flavors << flavors
|
54
|
-
@flavors_by_name[flavors.
|
53
|
+
@flavors_by_name[flavors.account_id] = @flavors.length - 1
|
55
54
|
end
|
56
55
|
end
|
57
56
|
|
@@ -73,16 +72,16 @@ module Megam
|
|
73
72
|
|
74
73
|
def lookup(flavors)
|
75
74
|
lookup_by = nil
|
76
|
-
if
|
77
|
-
lookup_by = flavors.
|
75
|
+
if events.kind_of?(Megam::Flavors)
|
76
|
+
lookup_by = flavors.account_id
|
78
77
|
elsif flavors.kind_of?(String)
|
79
78
|
lookup_by = flavors
|
80
79
|
else
|
81
|
-
raise ArgumentError, "Must pass a Megam::
|
80
|
+
raise ArgumentError, "Must pass a Megam::Flavors or String to lookup"
|
82
81
|
end
|
83
|
-
res
|
82
|
+
res = @flavors_by_name[lookup_by]
|
84
83
|
unless res
|
85
|
-
raise ArgumentError, "Cannot find a
|
84
|
+
raise ArgumentError, "Cannot find a node matching #{lookup_by} (did you define it first?)"
|
86
85
|
end
|
87
86
|
@flavors[res]
|
88
87
|
end
|
@@ -35,10 +35,8 @@ module Megam
|
|
35
35
|
include Nilavu::MegamAttributes
|
36
36
|
|
37
37
|
attr_reader :domain, :keypairoption, :root_password, :sshkey, :provider, :cpu, :ram, :hdd,
|
38
|
-
:version, :display_name, :password, :region, :
|
39
|
-
:public_ipv4, :private_ipv4, :public_ipv6, :private_ipv6, :bitnami_username, :bitnami_password, :root_username, :backup, :backup_name, :quota_ids,
|
40
|
-
:vm_cpu_cost_per_hour, :vm_ram_cost_per_hour,
|
41
|
-
:vm_disk_cost_per_hour, :container_cpu_cost_per_hour, :container_memory_cost_per_hour,:app_username, :app_password, :user_launch_patternname
|
38
|
+
:version, :display_name, :password, :region, :flavor_id, :storage_hddtype,
|
39
|
+
:public_ipv4, :private_ipv4, :public_ipv6, :private_ipv6, :bitnami_username, :bitnami_password, :root_username, :backup, :backup_name, :quota_ids,:app_username, :app_password, :user_launch_patternname, :flavor_id
|
42
40
|
|
43
41
|
ATTRIBUTES = [
|
44
42
|
:domain,
|
@@ -46,14 +44,11 @@ module Megam
|
|
46
44
|
:root_password,
|
47
45
|
:sshkey,
|
48
46
|
:provider,
|
49
|
-
:cpu,
|
50
|
-
:ram,
|
51
|
-
:hdd,
|
52
47
|
:version,
|
53
48
|
:display_name,
|
54
49
|
:password,
|
55
50
|
:region,
|
56
|
-
:
|
51
|
+
:flavor_id,
|
57
52
|
:storage_hddtype,
|
58
53
|
:private_ipv4,
|
59
54
|
:public_ipv4,
|
@@ -67,12 +62,7 @@ module Megam
|
|
67
62
|
:backup,
|
68
63
|
:backup_name,
|
69
64
|
:quota_ids,
|
70
|
-
:user_launch_patternname,
|
71
|
-
:vm_cpu_cost_per_hour,
|
72
|
-
:vm_ram_cost_per_hour,
|
73
|
-
:vm_disk_cost_per_hour,
|
74
|
-
:container_cpu_cost_per_hour,
|
75
|
-
:container_memory_cost_per_hour]
|
65
|
+
:user_launch_patternname,]
|
76
66
|
|
77
67
|
def attributes
|
78
68
|
ATTRIBUTES
|
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.52.
|
4
|
+
version: 1.52.2
|
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-
|
12
|
+
date: 2017-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|