virtengine_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +5 -0
  5. data/LICENSE +21 -0
  6. data/README.md +27 -0
  7. data/Rakefile +10 -0
  8. data/lib/megam/api.rb +329 -0
  9. data/lib/megam/api/accounts.rb +96 -0
  10. data/lib/megam/api/addons.rb +27 -0
  11. data/lib/megam/api/assemblies.rb +49 -0
  12. data/lib/megam/api/assembly.rb +56 -0
  13. data/lib/megam/api/backups.rb +57 -0
  14. data/lib/megam/api/balances.rb +45 -0
  15. data/lib/megam/api/billedhistories.rb +35 -0
  16. data/lib/megam/api/billingtransactions.rb +25 -0
  17. data/lib/megam/api/components.rb +24 -0
  18. data/lib/megam/api/credits.rb +34 -0
  19. data/lib/megam/api/disks.rb +44 -0
  20. data/lib/megam/api/domains.rb +25 -0
  21. data/lib/megam/api/errors.rb +29 -0
  22. data/lib/megam/api/eventsall.rb +36 -0
  23. data/lib/megam/api/eventsbilling.rb +35 -0
  24. data/lib/megam/api/eventscontainer.rb +35 -0
  25. data/lib/megam/api/eventsmarketplace.rb +35 -0
  26. data/lib/megam/api/eventsstorage.rb +24 -0
  27. data/lib/megam/api/eventsvm.rb +35 -0
  28. data/lib/megam/api/flavors.rb +56 -0
  29. data/lib/megam/api/license.rb +26 -0
  30. data/lib/megam/api/marketplaces.rb +68 -0
  31. data/lib/megam/api/organizations.rb +50 -0
  32. data/lib/megam/api/promos.rb +18 -0
  33. data/lib/megam/api/quotas.rb +47 -0
  34. data/lib/megam/api/rawimages.rb +36 -0
  35. data/lib/megam/api/reports.rb +24 -0
  36. data/lib/megam/api/requests.rb +36 -0
  37. data/lib/megam/api/sensors.rb +35 -0
  38. data/lib/megam/api/snapshots.rb +46 -0
  39. data/lib/megam/api/sshkeys.rb +35 -0
  40. data/lib/megam/api/subscriptions.rb +26 -0
  41. data/lib/megam/api/version.rb +6 -0
  42. data/lib/megam/core/account.rb +245 -0
  43. data/lib/megam/core/account_collection.rb +122 -0
  44. data/lib/megam/core/addons.rb +169 -0
  45. data/lib/megam/core/addons_collection.rb +121 -0
  46. data/lib/megam/core/assemblies.rb +191 -0
  47. data/lib/megam/core/assemblies_collection.rb +122 -0
  48. data/lib/megam/core/assembly.rb +226 -0
  49. data/lib/megam/core/assembly_collection.rb +122 -0
  50. data/lib/megam/core/backups.rb +259 -0
  51. data/lib/megam/core/backups_collection.rb +122 -0
  52. data/lib/megam/core/balances.rb +187 -0
  53. data/lib/megam/core/balances_collection.rb +121 -0
  54. data/lib/megam/core/billedhistories.rb +190 -0
  55. data/lib/megam/core/billedhistories_collection.rb +121 -0
  56. data/lib/megam/core/billingtransactions.rb +214 -0
  57. data/lib/megam/core/billingtransactions_collection.rb +122 -0
  58. data/lib/megam/core/components.rb +326 -0
  59. data/lib/megam/core/components_collection.rb +123 -0
  60. data/lib/megam/core/credits.rb +146 -0
  61. data/lib/megam/core/credits_collection.rb +121 -0
  62. data/lib/megam/core/disks.rb +199 -0
  63. data/lib/megam/core/disks_collection.rb +122 -0
  64. data/lib/megam/core/domain_collection.rb +122 -0
  65. data/lib/megam/core/domains.rb +118 -0
  66. data/lib/megam/core/error.rb +70 -0
  67. data/lib/megam/core/eventsall.rb +186 -0
  68. data/lib/megam/core/eventsall_collection.rb +122 -0
  69. data/lib/megam/core/eventsbilling.rb +174 -0
  70. data/lib/megam/core/eventsbilling_collection.rb +122 -0
  71. data/lib/megam/core/eventscontainer.rb +187 -0
  72. data/lib/megam/core/eventscontainer_collection.rb +122 -0
  73. data/lib/megam/core/eventsmarketplace.rb +187 -0
  74. data/lib/megam/core/eventsmarketplace_collection.rb +122 -0
  75. data/lib/megam/core/eventsstorage.rb +156 -0
  76. data/lib/megam/core/eventsstorage_collection.rb +122 -0
  77. data/lib/megam/core/eventsvm.rb +187 -0
  78. data/lib/megam/core/eventsvm_collection.rb +122 -0
  79. data/lib/megam/core/flavors.rb +294 -0
  80. data/lib/megam/core/flavors_collection.rb +121 -0
  81. data/lib/megam/core/json_compat.rb +289 -0
  82. data/lib/megam/core/konipai.rb +42 -0
  83. data/lib/megam/core/license.rb +101 -0
  84. data/lib/megam/core/license_collection.rb +122 -0
  85. data/lib/megam/core/log.rb +19 -0
  86. data/lib/megam/core/marketplace.rb +308 -0
  87. data/lib/megam/core/marketplace_collection.rb +123 -0
  88. data/lib/megam/core/monologger.rb +89 -0
  89. data/lib/megam/core/organizations.rb +142 -0
  90. data/lib/megam/core/organizations_collection.rb +121 -0
  91. data/lib/megam/core/promos.rb +145 -0
  92. data/lib/megam/core/quotas.rb +215 -0
  93. data/lib/megam/core/quotas_collection.rb +121 -0
  94. data/lib/megam/core/rawimages.rb +194 -0
  95. data/lib/megam/core/rawimages_collection.rb +121 -0
  96. data/lib/megam/core/reports.rb +176 -0
  97. data/lib/megam/core/reports_collection.rb +121 -0
  98. data/lib/megam/core/request.rb +197 -0
  99. data/lib/megam/core/request_collection.rb +121 -0
  100. data/lib/megam/core/rest_adapter.rb +44 -0
  101. data/lib/megam/core/sensors.rb +141 -0
  102. data/lib/megam/core/sensors_collection.rb +121 -0
  103. data/lib/megam/core/snapshots.rb +268 -0
  104. data/lib/megam/core/snapshots_collection.rb +122 -0
  105. data/lib/megam/core/sshkey.rb +173 -0
  106. data/lib/megam/core/sshkey_collection.rb +122 -0
  107. data/lib/megam/core/stuff.rb +22 -0
  108. data/lib/megam/core/subscriptions.rb +167 -0
  109. data/lib/megam/core/subscriptions_collection.rb +121 -0
  110. data/lib/megam/core/text.rb +87 -0
  111. data/lib/megam/core/text_formatter.rb +64 -0
  112. data/lib/megam/mixins/assemblies.rb +16 -0
  113. data/lib/megam/mixins/assembly.rb +59 -0
  114. data/lib/megam/mixins/common_deployable.rb +78 -0
  115. data/lib/megam/mixins/components.rb +182 -0
  116. data/lib/megam/mixins/megam_attributes.rb +30 -0
  117. data/lib/megam/mixins/outputs.rb +23 -0
  118. data/lib/megam/mixins/policies.rb +27 -0
  119. data/lib/megam_api.rb +1 -0
  120. data/megam_api.gemspec +26 -0
  121. data/test/mixins/test_assemblies.rb +113 -0
  122. data/test/mixins/test_assembly.rb +74 -0
  123. data/test/mixins/test_component.rb +19 -0
  124. data/test/test_accounts.rb +127 -0
  125. data/test/test_addons.rb +26 -0
  126. data/test/test_assemblies.rb +88 -0
  127. data/test/test_assembly.rb +37 -0
  128. data/test/test_backups.rb +29 -0
  129. data/test/test_balances.rb +38 -0
  130. data/test/test_billedhistories.rb +30 -0
  131. data/test/test_billingtranscations.rb +35 -0
  132. data/test/test_components.rb +42 -0
  133. data/test/test_credits.rb +28 -0
  134. data/test/test_disks.rb +25 -0
  135. data/test/test_domains.rb +29 -0
  136. data/test/test_eventsbilling.rb +30 -0
  137. data/test/test_eventscontainer.rb +26 -0
  138. data/test/test_eventsstorage.rb +12 -0
  139. data/test/test_eventsvm.rb +26 -0
  140. data/test/test_helper.rb +77 -0
  141. data/test/test_marketplaces.rb +38 -0
  142. data/test/test_organizations.rb +45 -0
  143. data/test/test_promos.rb +11 -0
  144. data/test/test_quotas.rb +33 -0
  145. data/test/test_reports.rb +32 -0
  146. data/test/test_requests.rb +95 -0
  147. data/test/test_sensors.rb +50 -0
  148. data/test/test_snapshots.rb +30 -0
  149. data/test/test_sshkeys.rb +50 -0
  150. data/test/test_subscriptions.rb +22 -0
  151. metadata +325 -0
@@ -0,0 +1,36 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventsall(limit)
5
+ @options = {:path => "/eventsvm/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+
15
+ def get_eventsall(limit, new_events)
16
+ @options = {:path => "/eventsall/show/#{limit}",
17
+ :body => Megam::JSONCompat.to_json(new_events)}.merge(@options)
18
+ request(
19
+ :expects => 200,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+
26
+ def index_eventsall
27
+ @options = {:path => "/eventsall",:body => ""}.merge(@options)
28
+
29
+ request(
30
+ :expects => 200,
31
+ :method => :get,
32
+ :body => @options[:body]
33
+ )
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,35 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventsbilling(limit)
5
+ @options = {:path => "/eventsbilling/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+
15
+ def get_eventsbilling(limit, new_events)
16
+ @options = {:path => "/eventsbilling/show/#{limit}",
17
+ :body => Megam::JSONCompat.to_json(new_events)}.merge(@options)
18
+ request(
19
+ :expects => 200,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+ def index_eventsbilling
26
+ @options = {:path => "/eventsbilling",:body => ""}.merge(@options)
27
+
28
+ request(
29
+ :expects => 200,
30
+ :method => :get,
31
+ :body => @options[:body]
32
+ )
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventscontainer(limit)
5
+ @options = {:path => "/eventscontainer/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+
15
+ def get_eventscontainer(limit, new_events)
16
+ @options = {:path => "/eventscontainer/show/#{limit}",
17
+ :body => Megam::JSONCompat.to_json(new_events)}.merge(@options)
18
+ request(
19
+ :expects => 200,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+ def index_eventscontainer
26
+ @options = {:path => "/eventscontainer",:body => ""}.merge(@options)
27
+
28
+ request(
29
+ :expects => 200,
30
+ :method => :get,
31
+ :body => @options[:body]
32
+ )
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventsMarketplace(limit)
5
+ @options = {:path => "/eventsmarketplace/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+
15
+ def get_eventsMarketplace(limit, new_events)
16
+ @options = {:path => "/eventsmarketplace/show/#{limit}",
17
+ :body => Megam::JSONCompat.to_json(new_events)}.merge(@options)
18
+ request(
19
+ :expects => 200,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+ def index_eventsMarketplace
26
+ @options = {:path => "/eventsmarketplace",:body => ""}.merge(@options)
27
+
28
+ request(
29
+ :expects => 200,
30
+ :method => :get,
31
+ :body => @options[:body]
32
+ )
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,24 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventsstorage(limit)
5
+ @options = {:path => "/eventsstorage/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+ def index_eventsstorage
15
+ @options = {:path => "/eventsstorage",:body => ""}.merge(@options)
16
+
17
+ request(
18
+ :expects => 200,
19
+ :method => :get,
20
+ :body => @options[:body]
21
+ )
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,35 @@
1
+ module Megam
2
+ class API
3
+ # GET /nodes
4
+ def list_eventsvm(limit)
5
+ @options = {:path => "/eventsvm/#{limit}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+
15
+ def get_eventsvm(limit, new_events)
16
+ @options = {:path => "/eventsvm/show/#{limit}",
17
+ :body => Megam::JSONCompat.to_json(new_events)}.merge(@options)
18
+ request(
19
+ :expects => 200,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+ def index_eventsvm
26
+ @options = {:path => "/eventsvm",:body => ""}.merge(@options)
27
+
28
+ request(
29
+ :expects => 200,
30
+ :method => :get,
31
+ :body => @options[:body]
32
+ )
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,56 @@
1
+ module Megam
2
+ class API
3
+
4
+ def get_flavors()
5
+ @options = {:path => "/flavors",:body => ""}.merge(@options)
6
+ request(
7
+ :expects => 200,
8
+ :method => :get,
9
+ :body => @options[:body]
10
+ )
11
+ end
12
+
13
+ def get_one_flavor(id)
14
+ @options = { path: "/flavors/#{id}", body: '' }.merge(@options)
15
+
16
+ request(
17
+ expects: 200,
18
+ method: :get,
19
+ body: @options[:body]
20
+ )
21
+ end
22
+
23
+ def post_flavors(new_flavors)
24
+ @options = {:path => "/flavors/content",
25
+ :body => Megam::JSONCompat.to_json(new_flavors)}.merge(@options)
26
+ request(
27
+ :expects => 201,
28
+ :method => :post,
29
+ :body => @options[:body]
30
+ )
31
+ end
32
+
33
+ def update_flavors(update_flavors)
34
+ @options = {:path => '/flavors/update',
35
+ :body => Megam::JSONCompat.to_json(update_flavors)}.merge(@options)
36
+
37
+ request(
38
+ :expects => 201,
39
+ :method => :post,
40
+ :body => @options[:body]
41
+ )
42
+ end
43
+
44
+ def delete_flavors(delete_flavors)
45
+ @options = {path: "/flavors/#{delete_flavors["name"]}",
46
+ :body => ''}.merge(@options)
47
+
48
+ request(
49
+ :expects => 201,
50
+ :method => :delete,
51
+ :body => @options[:body]
52
+ )
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,26 @@
1
+ module Megam
2
+ class API
3
+
4
+ def get_license(license_id)
5
+ @options = {:path => "/admin/licenses/#{license_id}",:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+ def post_license(new_license)
15
+ @options = {:path => '/admin/licenses/content',
16
+ :body => Megam::JSONCompat.to_json(new_license)}.merge(@options)
17
+
18
+ request(
19
+ :expects => 201,
20
+ :method => :post,
21
+ :body => @options[:body]
22
+ )
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,68 @@
1
+ module Megam
2
+ class API
3
+
4
+ def get_marketplaceapps
5
+ @options = {:path => '/marketplaces',:body => ""}.merge(@options)
6
+
7
+ request(
8
+ :expects => 200,
9
+ :method => :get,
10
+ :body => @options[:body]
11
+ )
12
+ end
13
+
14
+ def get_marketplaceapp(id)
15
+ @options = {:path => "/marketplaces/#{id}",:body => ""}.merge(@options)
16
+
17
+ request(
18
+ :expects => 200,
19
+ :method => :get,
20
+ :body => @options[:body]
21
+ )
22
+ end
23
+
24
+ def get_marketplaceprovider(provider)
25
+ @options = {:path => "/marketplaces/p/#{provider}" ,:body => ""}.merge(@options)
26
+
27
+ request(
28
+ :expects => 200,
29
+ :method => :get,
30
+ :body => @options[:body]
31
+ )
32
+ end
33
+
34
+ def get_marketplaceflavor(flavor)
35
+ @options = {:path => "/marketplaces/f/#{flavor}",:body => ""}.merge(@options)
36
+ request(
37
+ :expects => 200,
38
+ :method => :get,
39
+ :body => @options[:body]
40
+ )
41
+ end
42
+
43
+ def post_marketplaceapp(catitem)
44
+ @options = {:path => '/marketplaces/content',
45
+ :body => Megam::JSONCompat.to_json(catitem)}.merge(@options)
46
+
47
+ request(
48
+ :expects => 201,
49
+ :method => :post,
50
+ :body => @options[:body]
51
+ )
52
+ end
53
+
54
+ #Yet to be tested
55
+ # DELETE /marketplacess/:node_id
56
+ def delete_marketplaceapp(catitem_id)
57
+ @options = {:path => '/marketplaces/#{catitem_id}',
58
+ :body => ""}.merge(@options)
59
+
60
+ request(
61
+ :expects => 200,
62
+ :method => :delete,
63
+ :body => @options[:body]
64
+ )
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,50 @@
1
+ module Megam
2
+ class API
3
+ def get_organizations
4
+ @options = {:path => '/organizations',:body => ''}.merge(@options)
5
+
6
+ request(
7
+ :expects => 200,
8
+ :method => :get,
9
+ :body => @options[:body]
10
+
11
+ )
12
+ end
13
+
14
+ def get_organization(id)
15
+
16
+ @options = {:path => "/organizations/#{id}",
17
+ :body => ''}.merge(@options)
18
+
19
+ request(
20
+ :expects => 200,
21
+ :method => :get,
22
+ :body => @options[:body]
23
+ )
24
+ end
25
+
26
+ def post_organization(new_organization)
27
+
28
+ @options = {:path => '/organizations/content',
29
+ :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
30
+
31
+ request(
32
+ :expects => 201,
33
+ :method => :post,
34
+ :body => @options[:body]
35
+ )
36
+ end
37
+
38
+ def update_organization(new_organization)
39
+
40
+ @options = {:path => '/organizations/update',
41
+ :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
42
+
43
+ request(
44
+ :expects => 201,
45
+ :method => :post,
46
+ :body => @options[:body]
47
+ )
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,18 @@
1
+ module Megam
2
+ class API
3
+
4
+
5
+ def get_promos(id)
6
+ @options = {:path => "/promos/#{id}", :body => ""}.merge(@options)
7
+
8
+ request(
9
+ :expects => 200,
10
+ :method => :get,
11
+ :body => @options[:body]
12
+ )
13
+ end
14
+
15
+
16
+
17
+ end
18
+ end
@@ -0,0 +1,47 @@
1
+ module Megam
2
+ class API
3
+
4
+ def get_one_quota(name)
5
+ @options = { path: "/quotas/#{name}", body: '' }.merge(@options)
6
+
7
+ request(
8
+ expects: 200,
9
+ method: :get,
10
+ body: @options[:body]
11
+ )
12
+ end
13
+
14
+ def update_quotas(new_asm)
15
+ @options = { path: '/quotas/update',
16
+ body: Megam::JSONCompat.to_json(new_asm) }.merge(@options)
17
+
18
+ request(
19
+ expects: [200, 201],
20
+ method: :post,
21
+ body: @options[:body]
22
+ )
23
+ end
24
+
25
+ def list_quotas
26
+ @options = {:path => "/quotas",:body => ""}.merge(@options)
27
+
28
+ request(
29
+ :expects => 200,
30
+ :method => :get,
31
+ :body => @options[:body]
32
+ )
33
+ end
34
+
35
+ def post_quotas(new_sps)
36
+ @options = {:path => '/quotas/content',
37
+ :body => Megam::JSONCompat.to_json(new_sps)}.merge(@options)
38
+
39
+ request(
40
+ :expects => 201,
41
+ :method => :post,
42
+ :body => @options[:body]
43
+ )
44
+ end
45
+
46
+ end
47
+ end