megam_api 0.47 → 0.48
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/version.rb +1 -1
- data/lib/megam/core/assemblies.rb +4 -13
- data/lib/megam/core/assembly.rb +19 -6
- data/lib/megam/core/components.rb +34 -245
- data/lib/megam/core/marketplace.rb +2 -2
- data/lib/megam/core/sshkey.rb +15 -18
- data/test/test_assembly.rb +2 -2
- data/test/test_components.rb +6 -31
- 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: 29b0f91925f8e19dfecd89a26036ae8cd61cbe58
|
4
|
+
data.tar.gz: 299771d843954f270fe2e8687555caf668a46a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb4a60d63ba3dd2e04f48f2972dd391c0a3eaa44d5b5b6a3d8243ed7c89e8be4ea81dd4c055a0f80c37a0d61446dda539dfd3dbbb59036ab8d87d4c1a3f5b421
|
7
|
+
data.tar.gz: 8251a9b21b9cebf7b859d9a49ea22d6473fccdcacd241ead52acf9b1bfc044502451f9414553df4464c692204b72ea900af4f43b19813ccd6c944e6f11f2f774
|
data/lib/megam/api/version.rb
CHANGED
@@ -21,10 +21,7 @@ module Megam
|
|
21
21
|
@accounts_id = nil
|
22
22
|
@name = nil
|
23
23
|
@assemblies = []
|
24
|
-
@
|
25
|
-
@inputs = {}
|
26
|
-
@label = nil
|
27
|
-
@cloudsettings = []
|
24
|
+
@inputs = []
|
28
25
|
@created_at = nil
|
29
26
|
super(email, api_key)
|
30
27
|
end
|
@@ -124,12 +121,7 @@ module Megam
|
|
124
121
|
asm.name(o["name"]) if o.has_key?("name")
|
125
122
|
asm.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
|
126
123
|
asm.assemblies(o["assemblies"]) if o.has_key?("assemblies") #this will be an array? can hash store array?
|
127
|
-
|
128
|
-
oq = o["inputs"]
|
129
|
-
asm.inputs[:id] = oq["id"] if oq && oq.has_key?("id")
|
130
|
-
asm.inputs[:assemblies_type] = oq["assemblies_type"] if oq && oq.has_key?("assemblies_type")
|
131
|
-
asm.inputs[:label] = oq["label"] if oq && oq.has_key?("label")
|
132
|
-
asm.inputs[:cloudsettings] = oq["cloudsettings"] if oq && oq.has_key?("cloudsettings")
|
124
|
+
asm.inputs(o["inputs"]) if o.has_key?("inputs")
|
133
125
|
asm.created_at(o["created_at"]) if o.has_key?("created_at")
|
134
126
|
asm
|
135
127
|
end
|
@@ -146,13 +138,12 @@ module Megam
|
|
146
138
|
@accounts_id = o["accounts_id"] if o.has_key?("accounts_id")
|
147
139
|
@assemblies = o["assemblies"] if o.has_key?("assemblies")
|
148
140
|
@inputs = o["inputs"] if o.has_key?("inputs")
|
149
|
-
@label = o["label"] if o.has_key?("label")
|
150
141
|
@created_at = o["created_at"] if o.has_key?("created_at")
|
151
142
|
self
|
152
143
|
end
|
153
144
|
|
154
|
-
def self.create(
|
155
|
-
asm = from_hash(
|
145
|
+
def self.create(params)
|
146
|
+
asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
|
156
147
|
asm.create
|
157
148
|
end
|
158
149
|
|
data/lib/megam/core/assembly.rb
CHANGED
@@ -21,9 +21,10 @@ module Megam
|
|
21
21
|
@name = nil
|
22
22
|
@tosca_type = nil
|
23
23
|
@components = []
|
24
|
+
@requirements = []
|
24
25
|
@policies=[]
|
25
26
|
@inputs = []
|
26
|
-
@operations =
|
27
|
+
@operations = []
|
27
28
|
@outputs = []
|
28
29
|
@status = nil
|
29
30
|
@created_at = nil
|
@@ -65,6 +66,14 @@ module Megam
|
|
65
66
|
@components
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
def requirements(arg=[])
|
71
|
+
if arg != []
|
72
|
+
@requirements = arg
|
73
|
+
else
|
74
|
+
@requirements
|
75
|
+
end
|
76
|
+
end
|
68
77
|
|
69
78
|
def policies(arg=[])
|
70
79
|
if arg != []
|
@@ -126,6 +135,7 @@ module Megam
|
|
126
135
|
index_hash["name"] = name
|
127
136
|
index_hash["tosca_type"] = tosca_type
|
128
137
|
index_hash["components"] = components
|
138
|
+
index_hash["requirements"] = requirements
|
129
139
|
index_hash["policies"] = policies
|
130
140
|
index_hash["inputs"] = inputs
|
131
141
|
index_hash["operations"] = operations
|
@@ -147,6 +157,7 @@ module Megam
|
|
147
157
|
"name" => name,
|
148
158
|
"tosca_type" => tosca_type,
|
149
159
|
"components" => components,
|
160
|
+
"requirements" => requirements,
|
150
161
|
"policies" => policies,
|
151
162
|
"inputs" => inputs,
|
152
163
|
"operations" => operations,
|
@@ -164,6 +175,7 @@ module Megam
|
|
164
175
|
asm.name(o["name"]) if o.has_key?("name")
|
165
176
|
asm.tosca_type(o["tosca_type"]) if o.has_key?("tosca_type")
|
166
177
|
asm.components(o["components"]) if o.has_key?("components")
|
178
|
+
asm.requirements(o["requirements"]) if o.has_key?("requirements")
|
167
179
|
asm.policies(o["policies"]) if o.has_key?("policies") #this will be an array? can hash store array?
|
168
180
|
asm.inputs(o["inputs"]) if o.has_key?("inputs")
|
169
181
|
asm.operations(o["operations"]) if o.has_key?("operations")
|
@@ -184,6 +196,7 @@ module Megam
|
|
184
196
|
@name = o["name"] if o.has_key?("name")
|
185
197
|
@tosca_type = o["tosca_type"] if o.has_key?("tosca_type")
|
186
198
|
@components = o["components"] if o.has_key?("components")
|
199
|
+
@requirements = o["requirements"] if o.has_key?("requirements")
|
187
200
|
@policies = o["policies"] if o.has_key?("policies")
|
188
201
|
@inputs = o["inputs"] if o.has_key?("inputs")
|
189
202
|
@operations = o["operations"] if o.has_key?("operations")
|
@@ -194,13 +207,13 @@ module Megam
|
|
194
207
|
end
|
195
208
|
|
196
209
|
|
197
|
-
def self.show(
|
198
|
-
asm = self.new(
|
199
|
-
asm.megam_rest.get_one_assembly(
|
210
|
+
def self.show(params)
|
211
|
+
asm = self.new(params["email"], params["api_key"])
|
212
|
+
asm.megam_rest.get_one_assembly(params["id"])
|
200
213
|
end
|
201
214
|
|
202
|
-
def self.update(
|
203
|
-
asm = from_hash(
|
215
|
+
def self.update(params)
|
216
|
+
asm = from_hash(params, params["email"], params["api_key"])
|
204
217
|
asm.update
|
205
218
|
end
|
206
219
|
|
@@ -20,35 +20,15 @@ module Megam
|
|
20
20
|
@id = nil
|
21
21
|
@name =nil
|
22
22
|
@tosca_type = nil
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@dummy = nil
|
26
|
-
@inputs = {}
|
27
|
-
@domain = nil
|
28
|
-
@port = nil
|
29
|
-
@username = nil
|
30
|
-
@password = nil
|
31
|
-
@version = nil
|
32
|
-
@source = nil
|
33
|
-
@design_inputs = nil
|
34
|
-
@x = nil
|
35
|
-
@y = nil
|
36
|
-
@z = nil
|
37
|
-
@wires = []
|
38
|
-
@service_inputs = nil
|
39
|
-
@ci_id = nil
|
40
|
-
@dbname = nil
|
41
|
-
@dbpassword = nil
|
42
|
-
@external_management_resource = nil
|
23
|
+
@inputs = []
|
24
|
+
@outputs = []
|
43
25
|
@artifacts = {}
|
44
26
|
@artifact_type = nil
|
45
27
|
@content = nil
|
46
|
-
@artifact_requirements =
|
28
|
+
@artifact_requirements = []
|
47
29
|
@related_components = nil
|
48
|
-
@operations =
|
49
|
-
@
|
50
|
-
@target_resource = nil
|
51
|
-
@others = []
|
30
|
+
@operations = []
|
31
|
+
@status = nil
|
52
32
|
@created_at = nil
|
53
33
|
|
54
34
|
super(email, api_key)
|
@@ -81,31 +61,7 @@ module Megam
|
|
81
61
|
@tosca_type
|
82
62
|
end
|
83
63
|
end
|
84
|
-
|
85
|
-
def requirements(arg=nil)
|
86
|
-
if arg != nil
|
87
|
-
@requirements = arg
|
88
|
-
else
|
89
|
-
@requirements
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def host(arg=nil)
|
94
|
-
if arg != nil
|
95
|
-
@host = arg
|
96
|
-
else
|
97
|
-
@host
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def dummy(arg=nil)
|
102
|
-
if arg != nil
|
103
|
-
@dummy = arg
|
104
|
-
else
|
105
|
-
@dummy
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
64
|
+
|
109
65
|
def inputs(arg=[])
|
110
66
|
if arg != []
|
111
67
|
@inputs = arg
|
@@ -113,132 +69,12 @@ module Megam
|
|
113
69
|
@inputs
|
114
70
|
end
|
115
71
|
end
|
116
|
-
|
117
|
-
def domain(arg=nil)
|
118
|
-
if arg != nil
|
119
|
-
@domain = arg
|
120
|
-
else
|
121
|
-
@domain
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
def port(arg=nil)
|
126
|
-
if arg != nil
|
127
|
-
@port = arg
|
128
|
-
else
|
129
|
-
@port
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def username(arg=nil)
|
134
|
-
if arg != nil
|
135
|
-
@username = arg
|
136
|
-
else
|
137
|
-
@username
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
def password(arg=nil)
|
142
|
-
if arg != nil
|
143
|
-
@password = arg
|
144
|
-
else
|
145
|
-
@password
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
def version(arg=nil)
|
150
|
-
if arg != nil
|
151
|
-
@version = arg
|
152
|
-
else
|
153
|
-
@version
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def source(arg=nil)
|
158
|
-
if arg != nil
|
159
|
-
@source = arg
|
160
|
-
else
|
161
|
-
@source
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def design_inputs(arg=nil)
|
166
|
-
if arg != nil
|
167
|
-
@design_inputs = arg
|
168
|
-
else
|
169
|
-
@design_inputs
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def x(arg=nil)
|
174
|
-
if arg != nil
|
175
|
-
@x = arg
|
176
|
-
else
|
177
|
-
@x
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def y(arg=nil)
|
182
|
-
if arg != nil
|
183
|
-
@y = arg
|
184
|
-
else
|
185
|
-
@y
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
def z(arg=nil)
|
190
|
-
if arg != nil
|
191
|
-
@z = arg
|
192
|
-
else
|
193
|
-
@z
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
def wires(arg=nil)
|
198
|
-
if arg != nil
|
199
|
-
@wires = arg
|
200
|
-
else
|
201
|
-
@wires
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def service_inputs(arg=nil)
|
206
|
-
if arg != nil
|
207
|
-
@service_inputs = arg
|
208
|
-
else
|
209
|
-
@service_inputs
|
210
|
-
end
|
211
|
-
end
|
212
72
|
|
213
|
-
|
214
|
-
if arg !=
|
215
|
-
@
|
216
|
-
else
|
217
|
-
@ci_id
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
def dbname(arg=nil)
|
222
|
-
if arg != nil
|
223
|
-
@dbname = arg
|
224
|
-
else
|
225
|
-
@dbname
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
def dbpassword(arg=nil)
|
230
|
-
if arg != nil
|
231
|
-
@dbpassword = arg
|
232
|
-
else
|
233
|
-
@dbpassword
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
def external_management_resource(arg=nil)
|
238
|
-
if arg != nil
|
239
|
-
@external_management_resource = arg
|
73
|
+
def outputs(arg=[])
|
74
|
+
if arg != []
|
75
|
+
@outputs = arg
|
240
76
|
else
|
241
|
-
@
|
77
|
+
@outputs
|
242
78
|
end
|
243
79
|
end
|
244
80
|
|
@@ -266,8 +102,8 @@ module Megam
|
|
266
102
|
end
|
267
103
|
end
|
268
104
|
|
269
|
-
def artifact_requirements(arg=
|
270
|
-
if arg !=
|
105
|
+
def artifact_requirements(arg=[])
|
106
|
+
if arg != []
|
271
107
|
@artifact_requirements = arg
|
272
108
|
else
|
273
109
|
@artifact_requirements
|
@@ -282,35 +118,19 @@ module Megam
|
|
282
118
|
end
|
283
119
|
end
|
284
120
|
|
285
|
-
def operations(arg=
|
286
|
-
if arg !=
|
121
|
+
def operations(arg=[])
|
122
|
+
if arg != []
|
287
123
|
@operations = arg
|
288
124
|
else
|
289
125
|
@operations
|
290
126
|
end
|
291
127
|
end
|
292
|
-
|
293
|
-
def operation_type(arg=nil)
|
294
|
-
if arg != nil
|
295
|
-
@operation_type = arg
|
296
|
-
else
|
297
|
-
@operation_type
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
def target_resource(arg=nil)
|
302
|
-
if arg != nil
|
303
|
-
@target_resource = arg
|
304
|
-
else
|
305
|
-
@target_resource
|
306
|
-
end
|
307
|
-
end
|
308
128
|
|
309
|
-
def
|
129
|
+
def status(arg=nil)
|
310
130
|
if arg != nil
|
311
|
-
@
|
131
|
+
@status = arg
|
312
132
|
else
|
313
|
-
@
|
133
|
+
@status
|
314
134
|
end
|
315
135
|
end
|
316
136
|
|
@@ -333,13 +153,12 @@ module Megam
|
|
333
153
|
index_hash["id"] = id
|
334
154
|
index_hash["name"] = name
|
335
155
|
index_hash["tosca_type"] = tosca_type
|
336
|
-
index_hash["requirements"] = requirements
|
337
156
|
index_hash["inputs"] = inputs
|
338
|
-
index_hash["
|
157
|
+
index_hash["outputs"] = outputs
|
339
158
|
index_hash["artifacts"] = artifacts
|
340
159
|
index_hash["related_components"] = related_components
|
341
160
|
index_hash["operations"] = operations
|
342
|
-
index_hash["
|
161
|
+
index_hash["status"] = status
|
343
162
|
index_hash["created_at"] = created_at
|
344
163
|
index_hash
|
345
164
|
end
|
@@ -355,13 +174,12 @@ module Megam
|
|
355
174
|
"id" => id,
|
356
175
|
"name" => name,
|
357
176
|
"tosca_type" => tosca_type,
|
358
|
-
"requirements" => requirements,
|
359
177
|
"inputs" => inputs,
|
360
|
-
"
|
178
|
+
"outputs" => outputs,
|
361
179
|
"artifacts" => artifacts,
|
362
180
|
"related_components" => related_components,
|
363
181
|
"operations" => operations,
|
364
|
-
"
|
182
|
+
"status" => status,
|
365
183
|
"created_at" => created_at
|
366
184
|
}
|
367
185
|
result
|
@@ -372,32 +190,8 @@ module Megam
|
|
372
190
|
asm.id(o["id"]) if o.has_key?("id")
|
373
191
|
asm.name(o["name"]) if o.has_key?("name")
|
374
192
|
asm.tosca_type(o["tosca_type"]) if o.has_key?("tosca_type")
|
375
|
-
|
376
|
-
|
377
|
-
asm.requirements[:host] = oq["host"] if oq && oq.has_key?("host")
|
378
|
-
asm.requirements[:dummy] = oq["dummy"] if oq && oq.has_key?("dummy")
|
379
|
-
|
380
|
-
inp = o["inputs"]
|
381
|
-
asm.inputs[:domain] = inp["domain"] if inp && inp.has_key?("domain")
|
382
|
-
asm.inputs[:port] = inp["port"] if inp && inp.has_key?("port")
|
383
|
-
asm.inputs[:username] = inp["username"] if inp && inp.has_key?("username")
|
384
|
-
asm.inputs[:password] = inp["password"] if inp && inp.has_key?("password")
|
385
|
-
asm.inputs[:version] = inp["version"] if inp && inp.has_key?("version")
|
386
|
-
asm.inputs[:source] = inp["source"] if inp && inp.has_key?("source")
|
387
|
-
asm.inputs[:design_inputs] = inp["design_inputs"] if inp && inp.has_key?("design_inputs")
|
388
|
-
asm.inputs[:service_inputs] = inp["service_inputs"] if inp && inp.has_key?("service_inputs")
|
389
|
-
asm.inputs[:ci_id] = inp["ci_id"] if inp && inp.has_key?("ci_id")
|
390
|
-
# ind = inp["design_inputs"]
|
391
|
-
# asm.inputs["design_inputs"][:did] = ind["did"] if ind && ind.has_key?("did")
|
392
|
-
# asm.inputs[:design_inputs][:x] = ind["x"] if ind && ind.has_key?("x")
|
393
|
-
# asm.inputs[:design_inputs][:y] = ind["y"] if ind && ind.has_key?("y")
|
394
|
-
# asm.inputs[:design_inputs][:z] = ind["z"] if ind && ind.has_key?("z")
|
395
|
-
# asm.inputs[:design_inputs][:wires] = ind["wires"] if ind && ind.has_key?("wires")
|
396
|
-
# ins = o["inputs"]["service_inputs"]
|
397
|
-
# asm.inputs[:service_inputs][:dbname] = ins["dbname"] if ins && ins.has_key?("dbname")
|
398
|
-
# asm.inputs[:service_inputs][:dbpassword] = ins["dbpassword"] if ins && ins.has_key?("dbpassword")
|
399
|
-
|
400
|
-
asm.external_management_resource(o["external_management_resource"]) if o.has_key?("external_management_resource")
|
193
|
+
asm.inputs(o["inputs"]) if o.has_key?("inputs")
|
194
|
+
asm.outputs(o["outputs"]) if o.has_key?("outputs")
|
401
195
|
|
402
196
|
ar = o["artifacts"]
|
403
197
|
asm.artifacts[:artifact_type] = ar["artifact_type"] if ar && ar.has_key?("artifact_type")
|
@@ -405,12 +199,8 @@ module Megam
|
|
405
199
|
asm.artifacts[:artifact_requirements] = ar["artifact_requirements"] if ar && ar.has_key?("artifact_requirements")
|
406
200
|
|
407
201
|
asm.related_components(o["related_components"]) if o.has_key?("related_components")
|
408
|
-
|
409
|
-
|
410
|
-
asm.operations[:operation_type] = ope["operation_type"] if ope && ope.has_key?("operation_type")
|
411
|
-
asm.operations[:target_resource] = ope["target_resource"] if ope && ope.has_key?("target_resource")
|
412
|
-
|
413
|
-
asm.others(o["others"]) if o.has_key?("others")
|
202
|
+
asm.operations(o["operations"]) if o.has_key?("operations")
|
203
|
+
asm.status(o["status"]) if o.has_key?("status")
|
414
204
|
asm.created_at(o["created_at"]) if o.has_key?("created_at")
|
415
205
|
asm
|
416
206
|
end
|
@@ -425,30 +215,29 @@ module Megam
|
|
425
215
|
@id = o["id"] if o.has_key?("id")
|
426
216
|
@name = o["name"] if o.has_key?("name")
|
427
217
|
@tosca_type = o["tosca_type"] if o.has_key?("tosca_type")
|
428
|
-
@requirements = o["requirements"] if o.has_key?("requirements")
|
429
218
|
@inputs = o["inputs"] if o.has_key?("inputs")
|
430
|
-
@
|
219
|
+
@outputs = o["outputs"] if o.has_key?("outputs")
|
431
220
|
@artifacts = o["artifacts"] if o.has_key?("artifacts")
|
432
221
|
@related_components = o["related_components"] if o.has_key?("related_components")
|
433
222
|
@operations = o["operations"] if o.has_key?("operations")
|
434
|
-
@
|
223
|
+
@status = o["status"] if o.has_key?("status")
|
435
224
|
@created_at = o["created_at"] if o.has_key?("created_at")
|
436
225
|
self
|
437
226
|
end
|
438
227
|
|
439
|
-
def self.create(
|
440
|
-
asm = from_hash(
|
228
|
+
def self.create(params)
|
229
|
+
asm = from_hash(params, params["email"], params["api_key"])
|
441
230
|
asm.create
|
442
231
|
end
|
443
232
|
|
444
233
|
# Load a account by email_p
|
445
|
-
def self.show(
|
446
|
-
asm = self.new(
|
447
|
-
asm.megam_rest.get_components(
|
234
|
+
def self.show(params)
|
235
|
+
asm = self.new(params["email"], params["api_key"])
|
236
|
+
asm.megam_rest.get_components(params["id"])
|
448
237
|
end
|
449
238
|
|
450
|
-
def self.update(
|
451
|
-
asm = from_hash(
|
239
|
+
def self.update(params)
|
240
|
+
asm = from_hash(params, params["email"], params["api_key"])
|
452
241
|
asm.update
|
453
242
|
end
|
454
243
|
|
@@ -192,8 +192,8 @@ module Megam
|
|
192
192
|
self
|
193
193
|
end
|
194
194
|
|
195
|
-
def self.create(
|
196
|
-
acct = from_hash(
|
195
|
+
def self.create(params)
|
196
|
+
acct = from_hash(params, params["email"], params["api_key"])
|
197
197
|
acct.create
|
198
198
|
end
|
199
199
|
|
data/lib/megam/core/sshkey.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# Copyright:: Copyright (c) 2012, 2014 Megam Systems
|
3
2
|
# License:: Apache License, Version 2.0
|
4
3
|
#
|
@@ -19,8 +18,8 @@ module Megam
|
|
19
18
|
def initialize(email=nil, api_key=nil)
|
20
19
|
@id = nil
|
21
20
|
@name = nil
|
22
|
-
@accounts_id = nil
|
23
|
-
@path=nil
|
21
|
+
@accounts_id = nil
|
22
|
+
@path=nil
|
24
23
|
@created_at = nil
|
25
24
|
@some_msg = {}
|
26
25
|
super(email, api_key)
|
@@ -30,7 +29,6 @@ module Megam
|
|
30
29
|
self
|
31
30
|
end
|
32
31
|
|
33
|
-
|
34
32
|
def id(arg=nil)
|
35
33
|
if arg != nil
|
36
34
|
@id = arg
|
@@ -54,7 +52,6 @@ module Megam
|
|
54
52
|
@accounts_id
|
55
53
|
end
|
56
54
|
end
|
57
|
-
|
58
55
|
|
59
56
|
def path(arg=nil)
|
60
57
|
if arg != nil
|
@@ -62,7 +59,7 @@ module Megam
|
|
62
59
|
else
|
63
60
|
@path
|
64
61
|
end
|
65
|
-
end
|
62
|
+
end
|
66
63
|
|
67
64
|
def created_at(arg=nil)
|
68
65
|
if arg != nil
|
@@ -91,7 +88,7 @@ module Megam
|
|
91
88
|
index_hash["id"] = id
|
92
89
|
index_hash["name"] = name
|
93
90
|
index_hash["accounts_id"] = accounts_id
|
94
|
-
index_hash["path"] = path
|
91
|
+
index_hash["path"] = path
|
95
92
|
index_hash["created_at"] = created_at
|
96
93
|
index_hash
|
97
94
|
end
|
@@ -107,7 +104,7 @@ module Megam
|
|
107
104
|
"id" => id,
|
108
105
|
"name" => name,
|
109
106
|
"accounts_id" => accounts_id,
|
110
|
-
"path" => path,
|
107
|
+
"path" => path,
|
111
108
|
"created_at" => created_at
|
112
109
|
}
|
113
110
|
result
|
@@ -117,8 +114,8 @@ module Megam
|
|
117
114
|
def self.json_create(o)
|
118
115
|
sshKey = new
|
119
116
|
sshKey.id(o["id"]) if o.has_key?("id")
|
120
|
-
sshKey.name(o["name"]) if o.has_key?("name")
|
121
|
-
sshKey.path(o["path"]) if o.has_key?("path")
|
117
|
+
sshKey.name(o["name"]) if o.has_key?("name")
|
118
|
+
sshKey.path(o["path"]) if o.has_key?("path")
|
122
119
|
sshKey.created_at(o["created_at"]) if o.has_key?("created_at")
|
123
120
|
#success or error
|
124
121
|
sshKey.some_msg[:code] = o["code"] if o.has_key?("code")
|
@@ -136,14 +133,14 @@ module Megam
|
|
136
133
|
|
137
134
|
def from_hash(o)
|
138
135
|
@id = o[:id] if o.has_key?(:id)
|
139
|
-
@name = o[:name] if o.has_key?(:name)
|
140
|
-
@path = o[:path] if o.has_key?(:path)
|
136
|
+
@name = o[:name] if o.has_key?(:name)
|
137
|
+
@path = o[:path] if o.has_key?(:path)
|
141
138
|
@created_at = o[:created_at] if o.has_key?(:created_at)
|
142
139
|
self
|
143
140
|
end
|
144
141
|
|
145
|
-
def self.create(
|
146
|
-
acct = from_hash(
|
142
|
+
def self.create(params)
|
143
|
+
acct = from_hash(params, params["email"], params["api_key"])
|
147
144
|
acct.create
|
148
145
|
end
|
149
146
|
|
@@ -156,15 +153,15 @@ module Megam
|
|
156
153
|
# returns a sshkeysCollection
|
157
154
|
# don't return self. check if the Megam::SshKeyCollection is returned.
|
158
155
|
def self.list(params)
|
159
|
-
|
156
|
+
sshKey = self.new(params["email"], params["api_key"])
|
160
157
|
sshKey.megam_rest.get_sshkeys
|
161
158
|
end
|
162
159
|
|
163
160
|
# Show a particular sshKey by name,
|
164
161
|
# Megam::SshKey
|
165
|
-
def self.show(
|
166
|
-
|
167
|
-
|
162
|
+
def self.show(params)
|
163
|
+
pre = self.new(params["email"], params["api_key"])
|
164
|
+
pre.megam_rest.get_sshkey(params["name"])
|
168
165
|
end
|
169
166
|
|
170
167
|
def to_s
|
data/test/test_assembly.rb
CHANGED
@@ -18,8 +18,8 @@ class TestApps < MiniTest::Unit::TestCase
|
|
18
18
|
"ptype" => "colocated",
|
19
19
|
"members" => ["calcines.megam.co/MattieGarcia","calcines.megam.co/parsnip"]
|
20
20
|
}],
|
21
|
-
"inputs" =>
|
22
|
-
"operations" =>
|
21
|
+
"inputs" => [],
|
22
|
+
"operations" => [],
|
23
23
|
"output" => [],
|
24
24
|
"status" => "Launching",
|
25
25
|
"created_at" => "2014-10-29 13:24:06 +0000"
|
data/test/test_components.rb
CHANGED
@@ -10,42 +10,17 @@ class TestApps < MiniTest::Unit::TestCase
|
|
10
10
|
tmp_hash = {
|
11
11
|
"id" => "COM1139245887592202240",
|
12
12
|
"name" => "NettieMoore",
|
13
|
-
"tosca_type" => "tosca.web.redis",
|
14
|
-
"
|
15
|
-
|
16
|
-
"dummy" => ""
|
17
|
-
},
|
18
|
-
"inputs" => {
|
19
|
-
"domain" => "megam.co",
|
20
|
-
"port" => "6379",
|
21
|
-
"username" => "",
|
22
|
-
"password" => "",
|
23
|
-
"version" => "",
|
24
|
-
"source" => "",
|
25
|
-
"design_inputs" => {
|
26
|
-
"id" => "39bb18e7.c644e8",
|
27
|
-
"x" => "802",
|
28
|
-
"y" => "331",
|
29
|
-
"z" => "3f43bde9.c0bc42",
|
30
|
-
"wires" => ["cae50d7.f351af"]
|
31
|
-
},
|
32
|
-
"service_inputs" => {
|
33
|
-
"dbname" => "",
|
34
|
-
"dbpassword" => ""
|
35
|
-
}
|
36
|
-
},
|
37
|
-
"external_management_resource" => "",
|
13
|
+
"tosca_type" => "tosca.web.redis",
|
14
|
+
"inputs" => [],
|
15
|
+
"outputs" => [],
|
38
16
|
"artifacts" => {
|
39
17
|
"artifact_type" => "tosca type",
|
40
18
|
"content" => "",
|
41
|
-
"artifact_requirements" =>
|
19
|
+
"artifact_requirements" => []
|
42
20
|
},
|
43
21
|
"related_components" => "AntonioMcCormick.megam.co/TimothyHenderson",
|
44
|
-
"operations" =>
|
45
|
-
|
46
|
-
"target_resource" => ""
|
47
|
-
},
|
48
|
-
"others" => [],
|
22
|
+
"operations" => [],
|
23
|
+
"status" => "",
|
49
24
|
"created_at" => "2014-10-29 14:06:39 +0000"
|
50
25
|
}
|
51
26
|
response = megams.update_component(tmp_hash)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.48'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|