megam_api 0.90 → 0.91

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bc860601d6f110c60235eb167e5a74df74fca9d
4
- data.tar.gz: ff49084b1935212cc832f82dfd803d0dd2fbb3b0
3
+ metadata.gz: 24f8d9e0e0b83654018d7c36d661b04450ce4352
4
+ data.tar.gz: 90ba0a6376f73313c9b2f3968de3a689bad8ec57
5
5
  SHA512:
6
- metadata.gz: d6432b20efbd64287f86cb506f37126507de50b722b3bcd9573f84fc5568941b32ca9544aeacfff310efad75cba627ca27ab31a47083b99d29ea21518c40879f
7
- data.tar.gz: 50ff9a3a5c480e9b5a414d7725a90ea543f875f7bb734a7b5b05b926c5d170b10320a86cc2d2f963d4d06125543e89d0dacacce27f5db205425e8ddd87504892
6
+ metadata.gz: 48e996c374ae1a5eb1778552d09642de04a6d3738cbebfce7873953b0ba88f88c193240acd81b4f306e284e10decb0aad3e72f4a0bd07f048c9dda808c6e58be
7
+ data.tar.gz: 878b68737b7f770714a36a1e572ad27c19675ac224715eb1b34a0b0cbfffaf3bea2f8e81116c4ecdc63a5c5b2fe466a4f9ccc461c64e5eee911e6fa2bf1fb42f
@@ -21,5 +21,16 @@ module Megam
21
21
  body: @options[:body]
22
22
  )
23
23
  end
24
+
25
+ def upgrade_assembly(asm_id)
26
+ @options = { path: "/assembly/upgrade/#{asm_id}", body: '' }.merge(@options)
27
+
28
+ request(
29
+ expects: [200, 201],
30
+ method: :get,
31
+ body: @options[:body]
32
+ )
33
+ end
34
+
24
35
  end
25
36
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.90"
3
+ VERSION = "0.91"
4
4
  end
5
5
  end
@@ -203,10 +203,15 @@ module Megam
203
203
  asm.update
204
204
  end
205
205
 
206
+ def self.upgrade(params)
207
+ asm = from_hash(params, params['email'] || params[:email], params['api_key'] || params[:api_key], params['host'] || params[:host])
208
+ asm.megam_rest.upgrade_assembly(params['id'])
209
+ end
210
+
206
211
  # Create the node via the REST API
207
212
  def update
208
213
  megam_rest.update_assembly(to_hash)
209
- end
214
+ end
210
215
 
211
216
  def to_s
212
217
  Megam::Stuff.styled_hash(to_hash)
@@ -5,9 +5,10 @@ require File.expand_path("#{File.dirname(__FILE__)}/outputs")
5
5
  module Megam
6
6
  class Mixins
7
7
  class Assembly
8
- attr_reader :name, :components, :policies, :outputs, :envs, :mixins
8
+ attr_reader :id, :name, :components, :policies, :outputs, :envs, :mixins
9
9
  def initialize(params)
10
10
  params = Hash[params.map { |k, v| [k.to_sym, v] }]
11
+ @id = params[:id] || params[:assemblyID] || ''
11
12
  @name = params[:assemblyname]
12
13
  @mixins = CommonDeployable.new(params)
13
14
  @outputs = Outputs.new(params)
@@ -17,6 +18,7 @@ module Megam
17
18
 
18
19
  def to_hash
19
20
  result = @mixins.to_hash
21
+ result[:id] = @id if @id
20
22
  result[:name] = @name if @name
21
23
  result[:components] = @components if @components
22
24
  result[:outputs] = @outputs.to_array if @outputs
@@ -23,8 +23,8 @@ module Megam
23
23
  @tosca_type = ''
24
24
  @status = 'launching'
25
25
  bld_toscatype(params)
26
- @inputs = InputGroupData.new(params)
27
26
  set_attributes(params)
27
+ @inputs = InputGroupData.new(params)
28
28
  end
29
29
 
30
30
  def to_hash
@@ -5,10 +5,11 @@ require File.expand_path("#{File.dirname(__FILE__)}/outputs")
5
5
  module Megam
6
6
  class Mixins
7
7
  class Components
8
- attr_reader :mixins, :name, :repo, :related_components, :operations, :artifacts, :envs, :outputs
8
+ attr_reader :mixins, :name, :repo, :related_components, :operations, :artifacts, :envs, :outputs, :id
9
9
  def initialize(params)
10
10
  @mixins = CommonDeployable.new(params)
11
- @name = params[:componentname] if params[:componentname]
11
+ @id = params[:id] if params[:id]
12
+ @name = params[:componentname] || params[:name] || ''
12
13
  @outputs = Outputs.new(params)
13
14
  @operations = add_operations(params)
14
15
  @related_components = add_related_components(params)
@@ -19,6 +20,7 @@ module Megam
19
20
 
20
21
  def to_hash
21
22
  result = @mixins.to_hash
23
+ result[:id] = @id if @id
22
24
  result[:name] = @name if @name
23
25
  result[:artifacts] = @artifacts if @artifacts
24
26
  result[:repo] = @repo if @repo
@@ -26,7 +28,7 @@ module Megam
26
28
  result[:outputs] = @outputs.to_array if @outputs
27
29
  result[:related_components] = @related_components if @related_components
28
30
  result[:envs] = @envs if @envs
29
- result
31
+ result.to_hash
30
32
  end
31
33
 
32
34
  def to_a
@@ -40,14 +42,14 @@ module Megam
40
42
  end
41
43
 
42
44
  def add_related_components(params)
43
- related_components = []
44
- related_components << "#{params[:bind_type]}" if params.key?(:bind_type)
45
+ @related_components = []
46
+ @related_components << "#{params[:bind_type]}" if params.key?(:bind_type)
45
47
  end
46
48
 
47
49
  def add_operations(params)
48
- operations = []
49
- operations.push(create_operation(Operations::CI, Operations::CI_DESCRIPTON, params)) if params[:scm_name] && params[:scm_name].strip.empty?
50
- operations.push(create_operation(Operations::BIND, Operations::BIND_DESCRIPTON, params)) if params.key?(:bind_type)
50
+ @operations = []
51
+ @operations.push(create_operation(Operations::CI, Operations::CI_DESCRIPTON, params)) if params[:scm_name] && params[:scm_name].strip.empty?
52
+ @operations.push(create_operation(Operations::BIND, Operations::BIND_DESCRIPTON, params)) if params.key?(:bind_type)
51
53
  end
52
54
 
53
55
  def create_operation(type, desc, params)
@@ -74,10 +76,10 @@ module Megam
74
76
 
75
77
  def initialize(params)
76
78
  set_attributes(params)
77
- @type = params[:type]
78
- @source = params[:scm_name]
79
- @url = params[:source]
80
- @oneclick = params[:oneclick]
79
+ @type = params[:type] || ""
80
+ @source = params[:scm_name] || ""
81
+ @url = params[:source] || ""
82
+ @oneclick = params[:oneclick] || ""
81
83
  end
82
84
 
83
85
  def tohash
@@ -97,7 +99,7 @@ module Megam
97
99
 
98
100
  CI = 'CI'.freeze
99
101
  CI_DESCRIPTON = 'always up to date code. sweet.'
100
-
102
+ NOTBOUND = "notbound".freeze
101
103
  BIND = 'bind'.freeze
102
104
  BIND_DESCRIPTON = 'bind. sweet.'
103
105
  def initialize(params, type, desc)
@@ -114,16 +116,18 @@ module Megam
114
116
  def tohash
115
117
  { operation_type: @type,
116
118
  description: @desc,
117
- properties: @prop
119
+ properties: @prop,
120
+ status: NOTBOUND
118
121
  }
119
122
  end
120
123
 
121
124
  # Key_name mismatch. Key_name is to be changed.
122
125
  def prop(params)
123
126
  op = []
124
- op << { 'key' => 'type', 'value' => params[:scm_name] }
125
- op << { 'key' => 'token', 'value' => params[:scmtoken] || '' }
126
- op << { 'key' => 'username', 'value' => params[:scmowner] || '' }
127
+ op << { 'key' => 'type', 'value' => params[:scm_name] } if params.key?(:scm_name)
128
+ op << { 'key' => 'token', 'value' => params[:scmtoken] } if params.key?(:scmtoken)
129
+ op << { 'key' => 'username', 'value' => params[:scmowner] } if params.key?(:scmowner)
130
+ op << { 'key' => 'related_component', 'value' => params[:bind_type] } if params.key?(:bind_type)
127
131
  op
128
132
  end
129
133
  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: '0.90'
4
+ version: '0.91'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan,
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-28 00:00:00.000000000 Z
12
+ date: 2015-12-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
@@ -261,36 +261,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  requirements: []
263
263
  rubyforge_project:
264
- rubygems_version: 2.4.8
264
+ rubygems_version: 2.4.7
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Ruby Client for the Megam
268
- test_files:
269
- - test/mixins/test_assemblies.rb
270
- - test/mixins/test_assembly.rb
271
- - test/mixins/test_component.rb
272
- - test/test_accounts.rb
273
- - test/test_assemblies.rb
274
- - test/test_assembly.rb
275
- - test/test_availableunits.rb
276
- - test/test_balances.rb
277
- - test/test_billedhistories.rb
278
- - test/test_billings.rb
279
- - test/test_cat_requests.rb
280
- - test/test_components.rb
281
- - test/test_credithistories.rb
282
- - test/test_csars.rb
283
- - test/test_discounts.rb
284
- - test/test_domains.rb
285
- - test/test_helper.rb
286
- - test/test_invoices.rb
287
- - test/test_login.rb
288
- - test/test_marketplaceaddons.rb
289
- - test/test_marketplaces.rb
290
- - test/test_organizations.rb
291
- - test/test_predefclouds.rb
292
- - test/test_promos.rb
293
- - test/test_requests.rb
294
- - test/test_sensors.rb
295
- - test/test_sshkeys.rb
296
- - test/test_subscriptions.rb
268
+ test_files: []