megam_api 1.52.1 → 1.52.2

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: 82f4868b44b3471243d6f35f4b2773fb070b4af5
4
- data.tar.gz: 7b8847bce125c0ce9c4be38fdf0e7e8c2315022d
3
+ metadata.gz: 5b2ea5c73edfa904feb67a7421d440a3a9861ebf
4
+ data.tar.gz: 631d53cde48a7e687c419b806760dfda2fb8650b
5
5
  SHA512:
6
- metadata.gz: b1b17c64e80d7dbfc7e80f202c3f766d30ec63037fa951d39e7801f6882c147d4150137f9d6a9bd9600fda9f9c3245a75be0787210178194aa0ca5d7d062f03a
7
- data.tar.gz: 197de5554d26ea8a291ed7c197f0edf5a49f671508ec4a0cdbd4264c17b67407ed26f789f1eb7d17d977c3da5b206f9195ca7b2e9b25f1209155e60c9a286e42
6
+ metadata.gz: 6da36555070aaff7e7a96ea0865f1dbb31b0df6702a60530b17cad6b8cd240f8910fbbc73eb8b5ee7b2b7bb9b64afb5375efebdb4afcbd5316a3a5b51c94df3c
7
+ data.tar.gz: 25c872e5cf053f6c673e99ad1ca725c55b6b4bbf2e9ec5a8e8174a9cdba338a11870ea5452424cfea3ffaee460b729f06027d01d0ca7da9c147195c0867927be
@@ -10,8 +10,8 @@ module Megam
10
10
  )
11
11
  end
12
12
 
13
- def get_one_flavor(name)
14
- @options = { path: "/flavors/#{name}", body: '' }.merge(@options)
13
+ def get_one_flavor(id)
14
+ @options = { path: "/flavors/#{id}", body: '' }.merge(@options)
15
15
 
16
16
  request(
17
17
  expects: 200,
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "1.52.1"
3
+ VERSION = "1.52.2"
4
4
  end
5
5
  end
@@ -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
- def flavors
22
- self
23
- end
22
+ def flavors
23
+ self
24
+ end
24
25
 
25
26
  def id(arg = nil)
26
- if arg != nil
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
- if arg != nil
35
- @org_id = arg
36
- else
37
- @org_id
38
- end
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
- if arg != nil
43
- @account_id = arg
44
- else
45
- @account_id
46
- end
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
- if arg != nil
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
- if arg != nil
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
- if arg != []
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
- def updated_at(arg=nil)
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
- fav = self.new(o)
213
- fav.from_hash(o)
214
- fav
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
- def update
255
- megam_rest.update_flavors(to_hash)
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.name] = index
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.name] =@flavors.length - 1
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 flavors inserted now should
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
- # flavors
43
+ # node
45
44
  @flavors.insert(@insert_after_idx + 1, flavors)
46
- # update name -> location mappings and register new flavors
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.name] = @insert_after_idx + 1
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.name] =@flavors.length - 1
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 flavors.kind_of?(Megam::Flavors)
77
- lookup_by = flavors.name
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::flavors or String to lookup"
80
+ raise ArgumentError, "Must pass a Megam::Flavors or String to lookup"
82
81
  end
83
- res =@flavors_by_name[lookup_by]
82
+ res = @flavors_by_name[lookup_by]
84
83
  unless res
85
- raise ArgumentError, "Cannot find a flavors matching #{lookup_by} (did you define it first?)"
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, :resource, :storage_hddtype,
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
- :resource,
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.1
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-03-29 00:00:00.000000000 Z
12
+ date: 2017-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon